Skip to main content
POST /v1/tenants/{tenant_id}/permissions/lookup-subject Lookup Subject answers questions of the form: “Which users can edit document:1?” The response is a paginated array of subject IDs that satisfy the requested permission on the given entity.

Path Parameters

tenant_id
string
required
The tenant identifier. Use t1 for single-tenant deployments. Must match ^([a-zA-Z0-9_\-@\.:+]{1,128}|\*)$.

Request Body

metadata
object
required
entity
object
required
The entity on which subjects’ permissions are evaluated.
permission
string
required
The permission or relation to evaluate. Must match ^[a-zA-Z_]{1,64}$.
subject_reference
object
required
Specifies the type of subject to look up.
context
object
Contextual data for this request.
page_size
integer
Number of subject IDs to return per page. Must be >= 1.
continuous_token
string
Pagination token from the previous response. Omit for the first page.

Response

subject_ids
array
List of subject IDs that have the requested permission on the entity.
continuous_token
string
Pagination token for the next page. Empty when there are no more results.

Example

curl --location --request POST 'localhost:3476/v1/tenants/{tenant_id}/permissions/lookup-subject' \
--header 'Content-Type: application/json' \
--data-raw '{
  "metadata": {
    "snap_token": "",
    "schema_version": "",
    "depth": 20
  },
  "entity": {
    "type": "document",
    "id": "1"
  },
  "permission": "edit",
  "subject_reference": {
    "type": "user",
    "relation": ""
  },
  "page_size": 20,
  "continuous_token": ""
}'
Request body
{
  "metadata": {
    "snap_token": "",
    "schema_version": "",
    "depth": 20
  },
  "entity": {
    "type": "document",
    "id": "1"
  },
  "permission": "edit",
  "subject_reference": {
    "type": "user",
    "relation": ""
  },
  "page_size": 20,
  "continuous_token": ""
}
Response
{
  "subject_ids": ["1", "42", "99"],
  "continuous_token": ""
}

Error Codes

HTTP StatusDescription
400Bad request — invalid fields
401Unauthorized
404Tenant not found
429Rate limit exceeded
500Internal server error

Build docs developers (and LLMs) love