Request a user decision - Spacefast Docs

Request a user decision

Creates a confirmation or temporary scope-elevation request for an agent action and returns its ID inside a requiresAction envelope carrying the page to send the user to, the poll endpoint, and a continuation token. Only an agent spending a user-owned grant can ask, and only that grant’s owner can answer. The action is identified by its operation, resource, and revision, so asking again for the same action returns the same decision and a reworded rationale cannot open a fresh one.

POST /v1/approvals

Authorization

Authorization: Bearer token · header required

`Authorization: Bearer ` with an API key (`sfa_` prefix), an OAuth access token, a session token, or a Space machine credential (`sfm_` prefix).

Request body

Responses

201 Response for status 201

Example Request

curl -X POST "https://api.spacefast.com/v1/approvals" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{\n  "kind": "confirmation",\n  "operation": "publish",\n  "requestedScopes": [],\n  "rationale": "string",\n  "resource": {\n    "kind": "team",\n    "id": "string",\n    "revision": "string"\n  },\n  "quote": null\n}'

Example Response

{
  "$schema": "http://example.com",
  "data": {
    "approvalId": "string"
  },
  "requiresAction": {
    "actionType": "device_authorization",
    "instruction": "string",
    "url": "http://example.com",
    "pollUrl": "http://example.com",
    "continuationToken": "string",
    "pollAfterSeconds": 9007199254740991,
    "expiresAt": "2019-08-24T14:15:22Z"
  }
}

Error Response Example

{
  "$schema": "http://example.com",
  "type": "string",
  "title": "string",
  "status": -9007199254740991,
  "detail": "string",
  "code": "string",
  "pointer": "string",
  "details": {
    "property1": null,
    "property2": null
  },
  "suggestions": [
    "string"
  ],
  "next": [
    "string"
  ],
  "requestId": "string"
}