Auth API reference

Auth API · Consumer-Verify

post/{app_slug}/v1/authorize

Verify a token + check one or more permissions

Returns `{ authorized: boolean }`. Pass `permission` (string) for a single check, or `permissions` (array) when ALL must be held. Token source: `body.token` if provided, else the `Authorization: Bearer <jwt>` header. At least one must be present.

Path parameters

app_slug*string

Slug of the app.

Request body

tokenstring

JWT to verify and authorize. Optional — if omitted, the token is read from the `Authorization: Bearer <jwt>` header.

permissionstring

Single permission to check, e.g. 'user.read'. Use this OR `permissions`.

Example: "invoice.read"

permissionsarray

Multiple permissions; the token must hold ALL of them.

Response · 200

authorized*boolean

True when the token is valid and holds every requested permission.

errorstring

Failure code on `authorized: false`.

missing_permissionsarray

Permissions the token does not hold.

Example

Request

POST https://api.auth.productcraft.co/{app_slug}/v1/authorize
Content-Type: application/json

{
  "token": "string",
  "permission": "invoice.read",
  "permissions": [
    "string"
  ]
}

Response

{
  "authorized": false,
  "error": "string",
  "missing_permissions": [
    "string"
  ]
}