Skip to main content

Query

Use the Warrant Query Language (WQL) to list the set of subjects that have access to a particular object or to list the set of objects a particular subject has access to.

Endpoint
GET /v2/query

Request

Headers


Warrant-Token string, optional

A valid Warrant-Token from a previous write operation or latest. Used to specify desired consistency for this read operation.


Query Params


q string

A query written in the Warrant Query Language (WQL).


context string, optional

A serialized, url-safe JSON object containing contextual data to use while resolving the query. This data is used to evaluate any policies on warrants matched by the query. Any warrants with an attached policy that are matched by the query will not contribute any results to the result unless their attached policy evaluates to true using the provided context.


This endpoint supports all of the query parameters specified in the Pagination & Sorting section. Supported values for the sortBy parameter are objectType, objectId, and createdAt.


GET /v2/query
curl "https://api.warrant.dev/v2/query?q=select+pricing-tier,feature+where+user:12+is+member" \
-H "Authorization: ApiKey YOUR_KEY"

Response

Body


results array

A list of query results.


prevCursor string

This attribute will be omitted from the response if there are no previous results to fetch.


nextCursor string

This attribute will be omitted from the response if there are no more results to fetch.


200 OK
{
"results": [
{
"objectType": "pricing-tier",
"objectId": "enterprise",
"warrant": {
"objectType": "pricing-tier",
"objectId": "enterprise",
"relation": "member",
"subject": {
"objectType": "user",
"objectId": "12"
}
},
"isImplicit": false,
"meta": {
"name": "Enterprise",
"description": "Grants customers access to the features in our Enterprise tier."
}
},
{
"objectType": "pricing-tier",
"objectId": "basic",
"warrant": {
"objectType": "pricing-tier",
"objectId": "enterprise",
"relation": "member",
"subject": {
"objectType": "user",
"objectId": "12"
}
},
"isImplicit": true,
"meta": {
"name": "Basic",
"description": "Grants customers access to the features in our Free tier."
}
},
{
"objectType": "feature",
"objectId": "analytics",
"warrant": {
"objectType": "pricing-tier",
"objectId": "enterprise",
"relation": "member",
"subject": {
"objectType": "user",
"objectId": "12"
}
},
"isImplicit": true,
"meta": {
"name": "Analytics",
"description": "Grants customers access to the Custom Analytics value-add feature."
}
}
]
}