Auth API reference

Auth API · Consumer-Verify

post/{app_slug}/v1/authorize/batch

Multi-permission authorization in a single round-trip

Runs N permission checks against the same token in one call. Each check accepts `permission` (singular) or `permissions` (array — ALL must be held); pass an `id` to correlate results back to inputs. Each result reports `authorized` plus the missing permissions (if any). 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 against each check. Optional — if omitted, the token is read from the `Authorization: Bearer <jwt>` header.

checks*array

List of checks. Each returns { id?, authorized, missing_permissions }.

Response · 200

results*array

One result per check, in request order, each echoing its `id`.

Example

Request

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

{
  "token": "string",
  "checks": [
    {
      "id": "string",
      "permission": "string",
      "permissions": [
        "string"
      ]
    }
  ]
}

Response

{
  "results": [
    {
      "id": "string",
      "authorized": false,
      "missing_permissions": [
        "string"
      ]
    }
  ]
}