Authorization API reference

Use these endpoints to manage roles, role assignments, and authorization queries, and to list built-in policies.

Authorization query endpoints

Table 1. Authorization query endpoints
Endpoint Description
POST /api/v1/authz/can_i Check if current user can perform an action
POST /api/v1/authz/who_can List users who can perform an action (admin only)
POST /api/v1/authz/what_can_i List all permissions for current user
GET /api/v1/authz/resource_actions List all resource types and valid actions (authentication required, no specific permission)
GET /api/v1/authz/validate_name Validate a resource name against naming rules

Validate a resource name

Use this endpoint for real-time validation of project or role names before creation.

GET /api/v1/authz/validate_name?name=my-role&resource_type=role

Names must start and end with a letter or digit, and may contain letters, digits, colons, hyphens, and underscores. Maximum length is 255 characters. This endpoint requires authentication but does not require any specific permission.

Example response (valid):

{
  "valid": true,
  "name": "my-role",
  "reason": ""
}

Example response (invalid):

{
  "valid": false,
  "name": "-invalid",
  "reason": "Name must start and end with a letter or digit, and may contain letters, digits, colons, hyphens, and underscores"
}

Role management endpoints

Table 2. Role management endpoints
Method Path Description
GET /api/v1/roles List roles with filtering and pagination
POST /api/v1/roles Create a custom role
GET /api/v1/roles/{role_id} Get a role by ID
PATCH /api/v1/roles/{role_id} Partial update a role
PUT /api/v1/roles/{role_id} Full replacement update a role
DELETE /api/v1/roles/{role_id} Delete a role (returns 204)

Query parameters: limit, cursor, include_total, sort, name, is_builtin, project_id

Built-in roles (is_builtin: true) cannot be modified or deleted.

Create a custom role:

curl -X POST https://orchestrator.example.com/api/v1/roles \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "workflow-operator",
    "description": "Can read and execute workflows",
    "policies": [
      "workflow:read:project",
      "execution:read:project",
      "execution:run:project"
    ],
    "labels": {},
    "project_id": "project-id"
  }'

Response: 201 Created with RoleRead (id, name, description, policies, is_builtin, is_system_scoped, project_id, labels, created_at, updated_at).

The is_system_scoped field is a computed boolean: true when the role is not scoped to a specific project.

Policy endpoints

Automation orchestrator ships built-in policies only. You cannot create, update, or delete policies. Use these endpoints to list and inspect built-in policies when you build custom roles.

Table 3. Policy endpoints
Method Path Description
GET /api/v1/policies List policies with filtering and pagination
GET /api/v1/policies/{policy_id} Get a policy by ID

Query parameters: limit, cursor, include_total, sort, name, is_builtin, project_id, project_eligible

The project_eligible filter returns policies that you can assign to project roles.

PolicyRead includes two computed fields:

  • is_system_scopedtrue when the policy is not scoped to a specific project.
  • is_project_eligibletrue when the policy can be used in project-scoped role assignments.

Role assignment endpoints

Use these endpoints to assign and remove roles for users and groups. Each role assignment targets either a user or service account (by principal_id) or a group (by group_id). Exactly one of principal_id or group_id must be provided.

Global role assignments:

Table 4. Global role assignment endpoints
Method Path Description
GET /api/v1/role_assignments List all role assignments with filtering and pagination
POST /api/v1/role_assignments Create a role assignment ({principal_id?, group_id?, role_name, project_id?})
GET /api/v1/role_assignments/{assignment_id} Get a role assignment by ID
DELETE /api/v1/role_assignments/{assignment_id} Remove a role assignment (returns 204)

Query parameters: principal_id, group_id, principal_name, role_name, project_id, limit, cursor, include_total, sort

Sub-resource role assignments (user-scoped):

Table 5. User-scoped role assignment endpoints
Method Path Description
GET /api/v1/users/{user_id}/role_assignments List role assignments for a user
POST /api/v1/users/{user_id}/role_assignments Assign a role to a user ({role_name, project_id?})
DELETE /api/v1/users/{user_id}/role_assignments/{assignment_id} Remove a user role assignment

Sub-resource role assignments (group-scoped):

Table 6. Group-scoped role assignment endpoints
Method Path Description
GET /api/v1/groups/{group_id}/role_assignments List role assignments for a group
POST /api/v1/groups/{group_id}/role_assignments Assign a role to a group ({role_name, project_id?})
DELETE /api/v1/groups/{group_id}/role_assignments/{assignment_id} Remove a group role assignment

Role assignment response fields:

Table 7. Role assignment response fields
Field Type Description
id UUID Assignment identifier
principal_id UUID or null User or service account ID. Null when the assignment targets a group.
group_id UUID or null Group ID. Null when the assignment targets a user or service account.
principal_name string User, service account, or group name
role_name string Name of the assigned role
role_description string Description of the assigned role
role_policies list Policies included in the assigned role
project_id UUID or null Project scope (null for system-scope assignments)
project_name string or null Project name (null for system-scope assignments)
created_at ISO 8601 timestamp When the assignment was created

Directory lookup endpoints

Use these endpoints for lightweight user and group lookups during role assignment workflows. Directory endpoints return only identifiers and names, avoiding PII exposure from the full user and group endpoints.

Table 8. Directory lookup endpoints
Method Path Description
GET /api/v1/users_directory List users with{id, username} only
GET /api/v1/groups_directory List groups with{id, name} only

Query parameters: limit, cursor

The role assignment UI uses directory endpoints for user and group selection. Full user and group detail endpoints (/api/v1/users, /api/v1/groups) require the admin or auditor role.

Error response format

Authorization errors use the RFC 9457 Problem Details format with content type application/problem+json. The type field uses the https://api.example.com/errors/ URL prefix.

{
  "type": "https://api.example.com/errors/forbidden",
  "title": "Forbidden",
  "detail": "You do not have permission to access this resource",
  "code": "AUTHORIZATION_DENIED",
  "retryable": false,
  "instance": "/api/v1/role_assignments"
}
Table 9. HTTP error status codes
Status When returned
401 Unauthorized Missing or invalid access token
403 Forbidden Insufficient permissions for the requested operation
404 Not Found Resource, group, role, or user not found
409 Conflict Assignment already exists or name conflict
500 Internal Server Error Server-side error processing the request