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 specific subject (object, user etc.) to be associated with the object. A subject can either be a specific object (by id) or a group of objects defined by a set containing an objectType, objectId and relation.JSON bodyyes

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"
}
}