Human approvals API
This page documents the 11 gateway endpoints tagged human approvals in the gateway's OpenAPI document. Every example targets a gateway on http://localhost:4000 and authenticates with the SPANWAY_API_KEY environment variable, which holds the master key or a virtual key that has access to the route. Request and response fields are taken from the schema the running gateway publishes at /openapi.json, and the same document is bundled with this site as openapi.json.
| Method | Path | Summary |
|---|---|---|
| GET | /v1/approvals/list | List approval requests |
| GET | /v1/approvals/info | Read one approval request |
| POST | /v1/approvals/link | Decide through a signed approval link |
| POST | /v1/approvals/approve | Approve a pending request |
| POST | /v1/approvals/reject | Reject a pending request |
| POST | /v1/approvals/cancel | Withdraw a pending request |
| GET | /v1/approvals/policies/list | List approval policies |
| GET | /v1/approvals/policies/info | Read one approval policy |
| POST | /v1/approvals/policies/new | Create an approval policy |
| POST | /v1/approvals/policies/update | Replace an approval policy |
| POST | /v1/approvals/policies/delete | Delete an approval policy |
Endpoints
GET /v1/approvals/list
List approval requests
List the approval requests the caller raised or may decide, newest first, optionally by status. Any signed-in
user or key may call it, and proxy admins and admin viewers see every request. Nothing changes.
Docs (https://docs.spanway.ai/docs/proxy/human_approval#decide-a-request)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
status | query | enum: "pending", "approved", "rejected", "expired", "cancelled", "consumed" or null | No |
Example request:
curl -X GET "http://localhost:4000/v1/approvals/list" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The approval requests the caller may see | application/json ApprovalPage |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Your Spanway license does not include the 'human_approval' feature. Contact sales@spanway.ai to add it. | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | DB not connected. This endpoint needs a database; set DATABASE_URL to a PostgreSQL connection string (postgresql://...) to enable it. See https://docs.spanway.ai/docs/proxy/virtual_keys | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
approvals | array of ApprovalView | Yes | Approvals |
GET /v1/approvals/info
Read one approval request
Read one approval request with each policy lane's progress and every decision so far. The caller must have
raised it, be able to decide it, or be an admin, otherwise it answers 404. Nothing changes.
Docs (https://docs.spanway.ai/docs/proxy/human_approval#decide-a-request)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
approval_id | query | string | Yes |
Example request:
curl -X GET "http://localhost:4000/v1/approvals/info?approval_id=approval_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The request with its lanes and decisions | application/json ApprovalView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Your Spanway license does not include the 'human_approval' feature. Contact sales@spanway.ai to add it. | application/json ErrorDetail |
| 404 | Approval request not found | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | DB not connected. This endpoint needs a database; set DATABASE_URL to a PostgreSQL connection string (postgresql://...) to enable it. See https://docs.spanway.ai/docs/proxy/virtual_keys | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
approval_id | string | Yes | Approval Id |
status | enum: "pending", "approved", "rejected", "expired", "cancelled", "consumed" | Yes | Status |
subject | ToolCallSubject or WorkflowStepSubject | Yes | Subject |
organization_id | string or null | Yes | Organization Id |
team_id | string or null | Yes | Team Id |
actor_user_id | string or null | Yes | Actor User Id |
workflow_run_id | string or null | Yes | Workflow Run Id |
expires_at | string | Yes | Expires At |
resolved_at | string or null | Yes | Resolved At |
created_at | string | Yes | Created At |
lanes | array of LaneView | Yes | Lanes |
decisions | array of DecisionView | Yes | Decisions |
POST /v1/approvals/link
Decide through a signed approval link
Record the approve or reject decision carried by a signed link from an approval email or chat message. The
approver must be signed in, and the decision is recorded as theirs with the same checks as the Admin UI and
written to the audit log. An expired link answers 410, so decide in the Admin UI instead.
Docs (https://docs.spanway.ai/docs/proxy/human_approval#approval-links)
Request body (application/json, schema LinkDecisionRequest):
| Field | Type | Required | Description |
|---|---|---|---|
token | string | Yes | Token |
note | string or null | No | Note |
Example request:
curl -X POST "http://localhost:4000/v1/approvals/link" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"token": "eyJ...",
"note": "Approved from the email link"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The request after the decision | application/json ApprovalView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | Approval request not found | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 410 | This approval link has expired. Decide in the Admin UI | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | DB not connected. This endpoint needs a database; set DATABASE_URL to a PostgreSQL connection string (postgresql://...) to enable it. See https://docs.spanway.ai/docs/proxy/virtual_keys | application/json ErrorDetail |
| 503 | Approval links need SPANWAY_SALT_KEY or a master key | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
approval_id | string | Yes | Approval Id |
status | enum: "pending", "approved", "rejected", "expired", "cancelled", "consumed" | Yes | Status |
subject | ToolCallSubject or WorkflowStepSubject | Yes | Subject |
organization_id | string or null | Yes | Organization Id |
team_id | string or null | Yes | Team Id |
actor_user_id | string or null | Yes | Actor User Id |
workflow_run_id | string or null | Yes | Workflow Run Id |
expires_at | string | Yes | Expires At |
resolved_at | string or null | Yes | Resolved At |
created_at | string | Yes | Created At |
lanes | array of LaneView | Yes | Lanes |
decisions | array of DecisionView | Yes | Decisions |
POST /v1/approvals/approve
Approve a pending request
Approve a pending request in every policy lane where the caller is an approver at the lane's current
level. Nobody may approve their own request. Once every lane has its required approvals the gated action goes
ahead. The decision and note are written to the audit log.
Docs (https://docs.spanway.ai/docs/proxy/human_approval#decide-a-request)
Request body (application/json, schema DecisionRequest):
| Field | Type | Required | Description |
|---|---|---|---|
approval_id | string | Yes | Approval Id |
note | string or null | No | Note |
Example request:
curl -X POST "http://localhost:4000/v1/approvals/approve" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"approval_id": "5f0c...",
"note": "Checked the change ticket"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The request after the approval | application/json ApprovalView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | Approval request not found | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | DB not connected. This endpoint needs a database; set DATABASE_URL to a PostgreSQL connection string (postgresql://...) to enable it. See https://docs.spanway.ai/docs/proxy/virtual_keys | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
approval_id | string | Yes | Approval Id |
status | enum: "pending", "approved", "rejected", "expired", "cancelled", "consumed" | Yes | Status |
subject | ToolCallSubject or WorkflowStepSubject | Yes | Subject |
organization_id | string or null | Yes | Organization Id |
team_id | string or null | Yes | Team Id |
actor_user_id | string or null | Yes | Actor User Id |
workflow_run_id | string or null | Yes | Workflow Run Id |
expires_at | string | Yes | Expires At |
resolved_at | string or null | Yes | Resolved At |
created_at | string | Yes | Created At |
lanes | array of LaneView | Yes | Lanes |
decisions | array of DecisionView | Yes | Decisions |
POST /v1/approvals/reject
Reject a pending request
Reject a pending request as one of its approvers. One rejection in any lane rejects the whole request, so
the gated action does not run. The decision and note are written to the audit log.
Docs (https://docs.spanway.ai/docs/proxy/human_approval#decide-a-request)
Request body (application/json, schema DecisionRequest):
| Field | Type | Required | Description |
|---|---|---|---|
approval_id | string | Yes | Approval Id |
note | string or null | No | Note |
Example request:
curl -X POST "http://localhost:4000/v1/approvals/reject" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"approval_id": "5f0c...",
"note": "No change ticket"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The request, now rejected | application/json ApprovalView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | Approval request not found | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | DB not connected. This endpoint needs a database; set DATABASE_URL to a PostgreSQL connection string (postgresql://...) to enable it. See https://docs.spanway.ai/docs/proxy/virtual_keys | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
approval_id | string | Yes | Approval Id |
status | enum: "pending", "approved", "rejected", "expired", "cancelled", "consumed" | Yes | Status |
subject | ToolCallSubject or WorkflowStepSubject | Yes | Subject |
organization_id | string or null | Yes | Organization Id |
team_id | string or null | Yes | Team Id |
actor_user_id | string or null | Yes | Actor User Id |
workflow_run_id | string or null | Yes | Workflow Run Id |
expires_at | string | Yes | Expires At |
resolved_at | string or null | Yes | Resolved At |
created_at | string | Yes | Created At |
lanes | array of LaneView | Yes | Lanes |
decisions | array of DecisionView | Yes | Decisions |
POST /v1/approvals/cancel
Withdraw a pending request
Withdraw a pending request, for example when the change it gates is no longer needed. Only its requester or
a proxy admin may, the gated action does not run, and the note is written to the audit log.
Docs (https://docs.spanway.ai/docs/proxy/human_approval#decide-a-request)
Request body (application/json, schema CancelRequest):
| Field | Type | Required | Description |
|---|---|---|---|
approval_id | string | Yes | Approval Id |
note | string | Yes | Note |
Example request:
curl -X POST "http://localhost:4000/v1/approvals/cancel" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"approval_id": "5f0c...",
"note": "Deploy postponed"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The request, now withdrawn | application/json ApprovalView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | Approval request not found | application/json ErrorDetail |
| 409 | Only a pending approval request can be cancelled | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | DB not connected. This endpoint needs a database; set DATABASE_URL to a PostgreSQL connection string (postgresql://...) to enable it. See https://docs.spanway.ai/docs/proxy/virtual_keys | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
approval_id | string | Yes | Approval Id |
status | enum: "pending", "approved", "rejected", "expired", "cancelled", "consumed" | Yes | Status |
subject | ToolCallSubject or WorkflowStepSubject | Yes | Subject |
organization_id | string or null | Yes | Organization Id |
team_id | string or null | Yes | Team Id |
actor_user_id | string or null | Yes | Actor User Id |
workflow_run_id | string or null | Yes | Workflow Run Id |
expires_at | string | Yes | Expires At |
resolved_at | string or null | Yes | Resolved At |
created_at | string | Yes | Created At |
lanes | array of LaneView | Yes | Lanes |
decisions | array of DecisionView | Yes | Decisions |
GET /v1/approvals/policies/list
List approval policies
List the approval policies the caller can see: global ones, their organizations' and their teams'. Proxy
admins and admin viewers see every policy. Nothing changes.
Docs (https://docs.spanway.ai/docs/proxy/human_approval#create-a-policy)
Example request:
curl -X GET "http://localhost:4000/v1/approvals/policies/list" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The approval policies in the caller's scope | application/json PolicyPage |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Your Spanway license does not include the 'human_approval' feature. Contact sales@spanway.ai to add it. | application/json ErrorDetail |
| 500 | DB not connected. This endpoint needs a database; set DATABASE_URL to a PostgreSQL connection string (postgresql://...) to enable it. See https://docs.spanway.ai/docs/proxy/virtual_keys | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
policies | array of PolicyView | Yes | Policies |
GET /v1/approvals/policies/info
Read one approval policy
Read one approval policy: what it gates, who approves, how many approvals it needs and how it escalates.
A policy outside the caller's scope answers 404. Nothing changes.
Docs (https://docs.spanway.ai/docs/proxy/human_approval#create-a-policy)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
policy_id | query | string | Yes |
Example request:
curl -X GET "http://localhost:4000/v1/approvals/policies/info?policy_id=policy_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The policy | application/json PolicyView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Your Spanway license does not include the 'human_approval' feature. Contact sales@spanway.ai to add it. | application/json ErrorDetail |
| 404 | Approval policy pol_01J... not found | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | DB not connected. This endpoint needs a database; set DATABASE_URL to a PostgreSQL connection string (postgresql://...) to enable it. See https://docs.spanway.ai/docs/proxy/virtual_keys | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name |
description | string or null | No | Description |
scope | GlobalScope or OrgScope or TeamScope | Yes | Scope |
match | McpToolMatch or McpWriteToolsMatch or McpFlaggedCallsMatch or WorkflowStepMatch | Yes | Match |
approvers | array of UserApprover or TeamAdminsApprover or TeamMembersApprover or ProxyAdminsApprover or RequesterTeamAdminsApprover | Yes | Approvers |
required_approvals | integer | No | Required Approvals |
timeout_seconds | integer | No | Timeout Seconds |
escalation | array of EscalationLevel | No | Escalation |
enabled | boolean | No | Enabled |
policy_id | string | Yes | Policy Id |
authority | enum: "team_admin", "org_admin", "proxy_admin" | Yes | Authority |
created_by | string | Yes | Created By |
updated_by | string | Yes | Updated By |
created_at | string | Yes | Created At |
updated_at | string | Yes | Updated At |
POST /v1/approvals/policies/new
Create an approval policy
Create an approval policy, so matching agent or workflow actions wait for a person to approve them. Proxy
admins may use any scope, org admins their organization and team admins their team, and view-only roles may
not. Approvers must sit inside the policy's scope. The creation is written to the audit log.
Docs (https://docs.spanway.ai/docs/proxy/human_approval#create-a-policy)
Request body (application/json, schema PolicyFields):
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name |
description | string or null | No | Description |
scope | GlobalScope or OrgScope or TeamScope | Yes | Scope |
match | McpToolMatch or McpWriteToolsMatch or McpFlaggedCallsMatch or WorkflowStepMatch | Yes | Match |
approvers | array of UserApprover or TeamAdminsApprover or TeamMembersApprover or ProxyAdminsApprover or RequesterTeamAdminsApprover | Yes | Approvers |
required_approvals | integer | No | Required Approvals |
timeout_seconds | integer | No | Timeout Seconds |
escalation | array of EscalationLevel | No | Escalation |
enabled | boolean | No | Enabled |
Example request:
curl -X POST "http://localhost:4000/v1/approvals/policies/new" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Production deploys",
"scope": {
"kind": "team",
"team_id": "platform"
},
"match": {
"kind": "workflow_step",
"target_ids": [
"deploy-agent"
]
},
"approvers": [
{
"kind": "team_admins",
"team_id": "platform"
}
],
"required_approvals": 2,
"timeout_seconds": 3600,
"escalation": [
{
"after_seconds": 900,
"approvers": [
{
"kind": "user",
"user_id": "oncall-lead"
}
]
}
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The new policy | application/json PolicyView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 422 | Approver user is outside the policy's team scope | application/json ErrorDetail |
| 500 | DB not connected. This endpoint needs a database; set DATABASE_URL to a PostgreSQL connection string (postgresql://...) to enable it. See https://docs.spanway.ai/docs/proxy/virtual_keys | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name |
description | string or null | No | Description |
scope | GlobalScope or OrgScope or TeamScope | Yes | Scope |
match | McpToolMatch or McpWriteToolsMatch or McpFlaggedCallsMatch or WorkflowStepMatch | Yes | Match |
approvers | array of UserApprover or TeamAdminsApprover or TeamMembersApprover or ProxyAdminsApprover or RequesterTeamAdminsApprover | Yes | Approvers |
required_approvals | integer | No | Required Approvals |
timeout_seconds | integer | No | Timeout Seconds |
escalation | array of EscalationLevel | No | Escalation |
enabled | boolean | No | Enabled |
policy_id | string | Yes | Policy Id |
authority | enum: "team_admin", "org_admin", "proxy_admin" | Yes | Authority |
created_by | string | Yes | Created By |
updated_by | string | Yes | Updated By |
created_at | string | Yes | Created At |
updated_at | string | Yes | Updated At |
POST /v1/approvals/policies/update
Replace an approval policy
Replace every field of an approval policy. Only a caller with authority equal to or above the one that last
saved it may change it, so a team admin cannot loosen a policy a proxy admin set. Requests already raised keep
their lanes. The change is written to the audit log.
Docs (https://docs.spanway.ai/docs/proxy/human_approval#create-a-policy)
Request body (application/json, schema PolicyUpdate):
| Field | Type | Required | Description |
|---|---|---|---|
policy_id | string | Yes | Policy Id |
fields | PolicyFields | Yes |
Example request:
curl -X POST "http://localhost:4000/v1/approvals/policies/update" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"policy_id": "pol_01J...",
"fields": {
"name": "Production deploys",
"scope": {
"kind": "team",
"team_id": "platform"
},
"match": {
"kind": "workflow_step",
"target_ids": [
"deploy-agent"
]
},
"approvers": [
{
"kind": "team_admins",
"team_id": "platform"
}
],
"required_approvals": 2,
"timeout_seconds": 3600,
"escalation": [
{
"after_seconds": 900,
"approvers": [
{
"kind": "user",
"user_id": "oncall-lead"
}
]
}
]
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The policy as saved | application/json PolicyView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | Approval policy pol_01J... not found | application/json ErrorDetail |
| 422 | Approver user is outside the policy's team scope | application/json ErrorDetail |
| 500 | DB not connected. This endpoint needs a database; set DATABASE_URL to a PostgreSQL connection string (postgresql://...) to enable it. See https://docs.spanway.ai/docs/proxy/virtual_keys | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name |
description | string or null | No | Description |
scope | GlobalScope or OrgScope or TeamScope | Yes | Scope |
match | McpToolMatch or McpWriteToolsMatch or McpFlaggedCallsMatch or WorkflowStepMatch | Yes | Match |
approvers | array of UserApprover or TeamAdminsApprover or TeamMembersApprover or ProxyAdminsApprover or RequesterTeamAdminsApprover | Yes | Approvers |
required_approvals | integer | No | Required Approvals |
timeout_seconds | integer | No | Timeout Seconds |
escalation | array of EscalationLevel | No | Escalation |
enabled | boolean | No | Enabled |
policy_id | string | Yes | Policy Id |
authority | enum: "team_admin", "org_admin", "proxy_admin" | Yes | Authority |
created_by | string | Yes | Created By |
updated_by | string | Yes | Updated By |
created_at | string | Yes | Created At |
updated_at | string | Yes | Updated At |
POST /v1/approvals/policies/delete
Delete an approval policy
Delete an approval policy, so new matching actions no longer wait for approval. Only a caller with authority
equal to or above the one that last saved it may delete it. Requests already raised keep the lanes they were
created with. The deletion is written to the audit log.
Docs (https://docs.spanway.ai/docs/proxy/human_approval#create-a-policy)
Request body (application/json, schema PolicyRef):
| Field | Type | Required | Description |
|---|---|---|---|
policy_id | string | Yes | Policy Id |
Example request:
curl -X POST "http://localhost:4000/v1/approvals/policies/delete" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"policy_id": "pol_01J..."
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The id of the deleted policy | application/json PolicyRef |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | Approval policy pol_01J... not found | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | DB not connected. This endpoint needs a database; set DATABASE_URL to a PostgreSQL connection string (postgresql://...) to enable it. See https://docs.spanway.ai/docs/proxy/virtual_keys | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
policy_id | string | Yes | Policy Id |