The PlanResources API generates a query plan that describes the conditions under which a principal can perform specific actions on a resource kind. This is particularly useful for implementing filtered list views where you need to show only the resources a user has access to.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/cerbos/cerbos/llms.txt
Use this file to discover all available pages before exploring further.
Endpoint
Request Parameters
Optional application-specific ID useful for correlating logs for analysis.Example:
"c2db17b8-4f9f-4fb1-acfd-9162a02be42b"Opt to receive request processing metadata in the response.
A person or application attempting to perform the actions on the set of resources.
The resource kind to generate the query plan for.
Deprecated: Use
actions instead. Action to be applied to each resource in the list.Example: "view"List of actions to generate the query plan for. Mutually exclusive with the singular
action field. Must contain at least one action and all actions must be unique.Example: ["view", "edit"]Structured auxiliary data useful for evaluating the request.
Response Fields
Request ID provided in the request.Example:
"c2db17b8-4f9f-4fb1-acfd-9162a02be42b"Deprecated: The action from the request.
Actions from the request.Example:
["view", "edit"]Resource kind.Example:
"album:object"The policy version.Example:
"default"Filter that describes the conditions for accessing resources.
Optional metadata about the request evaluation process.
List of validation errors (if schema validation is enabled).
Audit log call ID associated with this request.
Example
Use Cases
Filtered List Views
The most common use case is implementing filtered list views where you need to show only the resources a user can access:- KIND_ALWAYS_ALLOWED: Return all documents
- KIND_ALWAYS_DENIED: Return no documents
- KIND_CONDITIONAL: Use the condition to filter the query (e.g.,
WHERE owner = 'user123')
Multiple Actions
Generate a query plan for multiple actions at once:With Known Resource Attributes
If you have some resource attributes known at query time, include them to get more specific query plans:Query Plan Adapters
The filter returned by PlanResources can be converted to database-specific queries using query plan adapters:- Prisma: Prisma Query Plan Adapter
- SQLAlchemy: SQLAlchemy Query Plan Adapter