Skip to main content
The CheckResources API is the primary authorization endpoint for checking whether a principal has permission to perform specific actions on resources. It supports checking multiple resources and actions in a single request.

Endpoint

rpc CheckResources(CheckResourcesRequest) returns (CheckResourcesResponse)

Request Parameters

requestId
string
Optional application-specific ID useful for correlating logs for analysis.Example: "c2db17b8-4f9f-4fb1-acfd-9162a02be42b"
includeMeta
boolean
Add request processing metadata to the response. When true, the response includes information about which policies matched and which derived roles were effective.
principal
object
required
A person or application attempting to perform the actions on the set of resources.
resources
object[]
required
List of resources and actions to check. Must contain at least one resource.
auxData
object
Structured auxiliary data useful for evaluating the request.

Response Fields

requestId
string
Request ID provided in the request.Example: "c2db17b8-4f9f-4fb1-acfd-9162a02be42b"
results
object[]
Result for each resource.
cerbosCallId
string
Audit log call ID associated with this request.

Example

cat <<EOF | curl --silent "http://localhost:3592/api/check/resources?pretty" -d @-
{
  "requestId": "test01",
  "includeMeta": true,
  "principal": {
    "id": "alicia",
    "roles": [
      "user"
    ]
  },
  "resources": [
    {
      "actions": [
        "view"
      ],
      "resource": {
        "id": "XX125",
        "kind": "album:object",
        "attr": {
          "owner": "alicia",
          "public": false,
          "flagged": false
        }
      }
    }
  ]
}
EOF

Use Cases

Single Resource Check

The most common use case is checking if a user can perform actions on a single resource:
{
  "principal": {
    "id": "user123",
    "roles": ["user"]
  },
  "resources": [
    {
      "actions": ["view", "edit", "delete"],
      "resource": {
        "kind": "document",
        "id": "doc456",
        "attr": {
          "owner": "user123"
        }
      }
    }
  ]
}

Batch Resource Check

You can check permissions for multiple heterogeneous resources in a single request:
{
  "principal": {
    "id": "user123",
    "roles": ["user"]
  },
  "resources": [
    {
      "actions": ["view"],
      "resource": {
        "kind": "document",
        "id": "doc456"
      }
    },
    {
      "actions": ["approve"],
      "resource": {
        "kind": "expense",
        "id": "exp789"
      }
    }
  ]
}

With Metadata

Request metadata to understand which policies matched:
{
  "includeMeta": true,
  "principal": {
    "id": "user123",
    "roles": ["user"]
  },
  "resources": [
    {
      "actions": ["view"],
      "resource": {
        "kind": "document",
        "id": "doc456"
      }
    }
  ]
}