Auth API reference

Auth API · Consumer-Agent-Access

post/{app_slug}/v1/agent-access/authorizations/{handle}/approveAuth

Approve an agent authorization

Call it when the user presses Allow, from your backend or your page, with the user's own token. Narrow `scopes` to what the user allowed and store your own `context` (e.g. the workspaces they chose; Auth keeps it opaque and returns it on introspection). Then send the browser to `redirect_to`. Single use: a second decision is 409.

Path parameters

app_slug*string

The app slug.

handle*string

The `request` handle.

Request body

scopesarray

The scopes the user allowed; a subset of the requested ones. Default: all requested.

contextobject

Your data, kept on the grant and returned by introspection (at most 2 KB as JSON), e.g. the workspaces the user chose. Keys round-trip exactly.

Response · 200 Approved; the connection exists.

redirect_to*string · uri

Send the browser here: the client's redirect URI with `code` (or `error`), `state` and `iss`.

grant_idstring

The new connection (approve only).

Example: "agr_9xY…"

Example

Request

POST https://api.auth.productcraft.co/{app_slug}/v1/agent-access/authorizations/{handle}/approve
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "scopes": [
    "string"
  ],
  "context": {}
}

Response

{
  "redirect_to": "string",
  "grant_id": "agr_9xY…"
}