Authorize a request
const url = 'https://outpost-iad.zstrike.io/authorize';const options = { method: 'POST', headers: {'X-Client-Token': '<X-Client-Token>', 'Content-Type': 'application/json'}, body: '{"principal":"User::\"alice\"","action":"Action::\"read\"","resource":"Document::\"doc-1\"","context":{},"entities":[{}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://outpost-iad.zstrike.io/authorize \ --header 'Content-Type: application/json' \ --header 'X-Client-Token: <X-Client-Token>' \ --data '{ "principal": "User::\"alice\"", "action": "Action::\"read\"", "resource": "Document::\"doc-1\"", "context": {}, "entities": [ {} ] }'Evaluates the Cedar policies of the project and returns Allow or Deny. The X-Client-Token header selects the project. If the project has an enabled trusted identity provider, send the user JWT (default header Authorization: Bearer <jwt>); the PDP then takes the principal from the JWT and denies the request if the body principal differs. A non-empty entities array requires an app token in x-app-token with the inline_entities: ["assert"] permission. Every error response carries a Deny decision.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Example
User::"alice"Example
Action::"read"Example
Document::"doc-1"object
Caller-asserted entities (the resource and its ancestors). Requires x-app-token.
object
Responses
Section titled “Responses”Decision (Allow or Deny)
object
object
object
IDs of the policies that decided the result
Example
{ "code": 200, "data": { "decision": "Allow" }}Invalid principal, action, resource, context, or inline entities
object
object
object
IDs of the policies that decided the result
Example
{ "code": 200, "data": { "decision": "Allow" }}Missing or unknown X-Client-Token, or JWT validation failed
object
object
object
IDs of the policies that decided the result
Example
{ "code": 200, "data": { "decision": "Allow" }}Body principal does not match the JWT, caller IP unavailable, or session state unavailable
object
object
object
IDs of the policies that decided the result
Example
{ "code": 200, "data": { "decision": "Allow" }}Authorization failed
object
object
object
IDs of the policies that decided the result
Example
{ "code": 200, "data": { "decision": "Allow" }}