Skip to main content

Create a Warrant

Create a new warrant that associates an object (objectType and objectId) to a subject via a relation.

POST /v1/warrants

Parameters

ParameterDescriptionTypeRequired
objectTypeThe type of object. Must be one of your system's existing object types.JSON bodyyes
objectIdThe id of the specific object.JSON bodyyes
relationThe relation for this object to subject association. The relation must be valid as per the object type definition.JSON bodyyes
subjectThe subject for which this warrant applies. Subject can be a specific object (by id) or a set of objects matching the given objectType, objectId and relation.JSON bodyyes
contextThe context under which this warrant applies. If context is provided, only access check queries that provide a matching context will match this warrant.JSON bodyno

Request

curl "https://api.warrant.dev/v1/warrants" \
-X POST \
-H "Authorization: ApiKey YOUR_KEY" \
--data-raw \
'{
"objectType": "report",
"objectId": "23ft346",
"relation": "editor",
"subject": {
"objectType": "user",
"objectId": "15ads7823a9df7as433gk23dd"
}
}'

Response

{
"objectType": "report",
"objectId": "23ft346",
"relation": "editor",
"subject": {
"objectType": "user",
"objectId": "15ads7823a9df7as433gk23dd"
}
}