PlatformXeDocs
Get API Key

Permission Check

API reference for checking and batch-checking permissions.

The permission check endpoint evaluates whether a user is allowed to perform an action, running through the full 4-layer evaluation pipeline (overrides, role capabilities, ABAC conditions, resource policies, ReBAC graph).

Check a single permission

POST /api/v1/permissions/check

Scope: permissions:check

Request body

FieldTypeRequiredDescription
adminIdstringYesThe user ID to check permissions for
pathstringYesThe permission path (e.g., articles, orders.refunds)
actionstringYesThe action to check (e.g., read, write, delete)
resourceobjectNoResource attributes for ABAC/ReBAC evaluation
contextobjectNoRequest context for ABAC condition evaluation (e.g., IP, time, custom attributes)

Response

{
  "success": true,
  "data": {
    "allowed": true,
    "source": "role"
  }
}
FieldTypeDescription
allowedbooleanWhether the action is permitted
sourcestringWhich evaluation layer produced the decision

Source values

SourceDescription
roleGranted by a role capability
override_grantGranted by an admin override
override_denyDenied by an admin override
policy_grantGranted by a resource policy
policy_denyDenied by a resource policy
rebacGranted by a ReBAC relationship
noneNo matching rule found (defaults to deny)

Examples

curl — basic check

curl -X POST https://api.platformxe.com/api/v1/permissions/check \
  -H "Content-Type: application/json" \
  -H "x-api-key: pxk_live_your_api_key_here" \
  -d '{
    "adminId": "user_xyz789",
    "path": "articles",
    "action": "read"
  }'

curl — with resource and context

curl -X POST https://api.platformxe.com/api/v1/permissions/check \
  -H "Content-Type: application/json" \
  -H "x-api-key: pxk_live_your_api_key_here" \
  -d '{
    "adminId": "user_xyz789",
    "path": "orders",
    "action": "refund",
    "resource": {
      "id": "order_abc123",
      "type": "order",
      "ownerId": "user_xyz789",
      "amount": 50000
    },
    "context": {
      "ip": "102.89.23.45",
      "time": "2026-04-05T14:30:00.000Z",
      "department": "finance"
    }
  }'

SDK — basic check

const result = await px.permissions.check({
  adminId: 'user_xyz789',
  path: 'articles',
  action: 'read',
});

console.log(result.data.allowed); // true
console.log(result.data.source);  // "role"

SDK — with resource and context

const result = await px.permissions.check({
  adminId: 'user_xyz789',
  path: 'orders',
  action: 'refund',
  resource: {
    id: 'order_abc123',
    type: 'order',
    ownerId: 'user_xyz789',
    amount: 50000,
  },
  context: {
    ip: '102.89.23.45',
    time: '2026-04-05T14:30:00.000Z',
    department: 'finance',
  },
});

Batch check

Check up to 100 permissions in a single request. Useful for rendering a UI where you need to know which actions a user can perform across multiple resources.

POST /api/v1/permissions/check-batch

Scope: permissions:check

Request body

FieldTypeRequiredDescription
adminIdstringYesThe user ID to check permissions for
checksArray<{ path: string, action: string, resource?: object }>YesArray of permission checks (max 100)
contextobjectNoShared request context applied to all checks

curl

curl -X POST https://api.platformxe.com/api/v1/permissions/check-batch \
  -H "Content-Type: application/json" \
  -H "x-api-key: pxk_live_your_api_key_here" \
  -d '{
    "adminId": "user_xyz789",
    "checks": [
      { "path": "articles", "action": "read" },
      { "path": "articles", "action": "write" },
      { "path": "articles", "action": "delete" },
      { "path": "settings", "action": "manage" }
    ]
  }'

SDK

const result = await px.permissions.checkBatch({
  adminId: 'user_xyz789',
  checks: [
    { path: 'articles', action: 'read' },
    { path: 'articles', action: 'write' },
    { path: 'articles', action: 'delete' },
    { path: 'settings', action: 'manage' },
  ],
});

for (const check of result.data.results) {
  console.log(`${check.path}:${check.action} → ${check.allowed}`);
}

Response

{
  "success": true,
  "data": {
    "results": [
      { "path": "articles", "action": "read", "allowed": true, "source": "role" },
      { "path": "articles", "action": "write", "allowed": true, "source": "role" },
      { "path": "articles", "action": "delete", "allowed": true, "source": "role" },
      { "path": "settings", "action": "manage", "allowed": false, "source": "none" }
    ]
  }
}

Batch checks are significantly faster than making individual requests. Use them when you need to resolve multiple permissions for the same user — for example, when rendering navigation or action menus.

Error responses

CodeDescription
BAD_REQUESTMissing required fields or invalid check format
FORBIDDENAPI key does not have the permissions:check scope
RATE_LIMITEDExceeded 5,000 checks/hr limit