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
Request body
- required
application/jsonkindstring required- Allowed:
confirmation,elevation
- Allowed:
operationstring required- Allowed:
publish,deploy,version_rollback,domain_purchase,domain_dns_change
- Allowed:
requestedScopesstring[]- max items 32 · default: []
rationalestring required- min length 1 · max length 1024
resourceobject required- Show properties
kindstring required- Allowed:
team,space,version,domain,connector_run
- Allowed:
idstring required- min length 1
revisionstring | integer required
Responses
201 Response for status 201
\$schemastring- Canonical JSON Schema URL for this response body. The server also sends it in the `Link: rel="describedby"` response header.
dataobject requiredapprovalIdstring required
requiresActionobject requiredactionTypestring required- Allowed:
device_authorization,confirmation,elevation
- Allowed:
instructionstring required- One sentence an agent can show a person, naming what they have to do.
urlstring| any pollUrlstringcontinuationTokenstring required- min length 1
pollAfterSecondsinteger required- max 9007199254740991
expiresAtstringrequired - ISO 8601 deadline for the human step. Resuming after it answers
expired.
- ISO 8601 deadline for the human step. Resuming after it answers
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"
}