PlatformXeDocs
Get API Key

Shadow Check

Compare local permission decisions against PlatformXe for migration validation.

The shadow check endpoint lets you validate your migration by comparing a local permission decision against PlatformXe's evaluation. This is essential during the dual-write phase of migrating to PlatformXe authorization.

Endpoint

POST /api/v1/permissions/shadow-check

Scope: permissions:check

Rate limit: 5,000/hr

Request body

FieldTypeRequiredDescription
adminIdstringYesThe user to check
pathstringYesPermission path
actionstringYesAction to check
localDecisionbooleanYesWhat your local system decided

curl

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

SDK

const result = await px.permissions.shadowCheck({
  adminId: 'user_xyz789',
  path: 'articles',
  action: 'delete',
  localDecision: true,
});

if (result.data.discrepancy) {
  console.warn('Permission mismatch:', {
    local: result.data.localAllowed,
    remote: result.data.remoteAllowed,
  });
}

Response

{
  "success": true,
  "data": {
    "adminId": "user_xyz789",
    "path": "articles",
    "action": "delete",
    "localAllowed": true,
    "remoteAllowed": false,
    "discrepancy": true,
    "remoteSource": "none"
  }
}
FieldTypeDescription
localAllowedbooleanThe local decision you provided
remoteAllowedbooleanPlatformXe's evaluation result
discrepancybooleantrue if local and remote disagree
remoteSourcestringWhich evaluation layer PlatformXe used

Migration workflow

  1. Shadow mode — call shadow check on every permission decision, log discrepancies
  2. Fix discrepancies — adjust roles, policies, or overrides in PlatformXe until discrepancies reach zero
  3. Read cutover — switch your app to read from PlatformXe instead of local
  4. Cleanup — remove local permission code

Run shadow checks in production for at least one week before cutting over. This ensures you catch edge cases that only appear under real traffic patterns.

Error responses

CodeDescription
BAD_REQUESTMissing required fields
FORBIDDENAPI key missing permissions:check scope