Skip to main content

Create an Object Type

Create a new object type.

Endpoint
POST /v2/object-types

Request

Body


type string

A string identifier for this object type. The type can only be composed of lower-case alphanumeric chars and/or '-' and '_'.


relations object

The set of relationships that subjects can have on objects of this type. See Key Concepts > Object Types to learn more.


POST /v2/object-types
curl "https://api.warrant.dev/v2/object-types" \
-X POST \
-H "Authorization: ApiKey YOUR_KEY" \
--data-raw \
'{
"type": "report",
"relations": {
"parent": {},
"owner": {},
"editor": {
"inheritIf": "owner"
},
"viewer": {
"inheritIf": "anyOf",
"rules": [
{
"inheritIf": "editor"
},
{
"inheritIf": "viewer",
"ofType": "report",
"withRelation": "parent"
}
]
}
}
}'

Response

Headers


Warrant-Token string

A unique transaction identifier for this write operation. Can be cached and passed on subsequent read requests.


Body


type string

A string identifier for this new object type. The type can only be composed of lower-case alphanumeric chars and/or '-' and '_'.


relations object

The set of relationships that subjects can have on objects of this type. See Key Concepts > Object Types to learn more.


200 OK
{
"type": "report",
"relations": {
"parent": {},
"owner": {},
"editor": {
"inheritIf": "owner"
},
"viewer": {
"inheritIf": "anyOf",
"rules": [
{
"inheritIf": "editor"
},
{
"inheritIf": "viewer",
"ofType": "report",
"withRelation": "parent"
}
]
}
}
}