Skip to main content
API reference

Approvals

Generated HTTP reference for the 3 operations the published OpenAPI document describes under approvals.

3 min read
View MarkdownEdit on GitHub

Approvals

This page is generated from the published OpenAPI document. It is complete with respect to that document and says nothing about surfaces the document does not describe yet. See what is generated here for what that means.

Base URL: https://api.codespar.dev

Every operation below requires a Bearer token. See Authentication.

GET /v1/approvals/health

Approval queue health

Responses

StatusBodyDescription
200objectOK

Response 200

FieldTypeRequiredDescription
last_sweep_atstring,null (date-time)yesDeployment-wide, not per-organization. See the description.
oldest_pending_age_secondsinteger,nullyesAge of the oldest pending hold, in seconds. Null when none is pending.
pending_countintegeryes
status"ok"yes

Example response

{
  "status": "ok",
  "pending_count": 1
}

Example request

curl -X GET https://api.codespar.dev/v1/approvals/health \
  -H "Authorization: Bearer $CODESPAR_API_KEY"

GET /v1/approvals/{id}

Read one approval

Path parameters

NameTypeRequiredDescription
idstringyes

Responses

StatusBodyDescription
200objectOK
404objectNot Found

Response 200

FieldTypeRequiredDescription
agent_idstringyes
created_atstring (date-time)yes
decided_atstring,null (date-time)yes
decided_bystring,nullyesThe approver, null while pending.
decision_reasonstring,nullyes
executed_atstring,null (date-time)yes
execution_resultobject,nullyesNull until an approved call has been replayed. Open shape, passed through verbatim.
expires_atstring (date-time)yesWhen the hold stops being decidable.
idstringyesapv_ + nanoid(16).
matched_rule_idstringyesThe policy rule that held the call.
matched_rule_namestringyes
org_idstringyes
project_idstring,nullyesNull for a hold raised outside any project.
session_idstring,nullyes
status"pending" | "approved" | "denied" | "expired" | "execution_failed"yes
tool_inputobjectyesThe arguments as RECORDED, which is not always the arguments as sent. Empty for a hold raised on the session execute path, and header-stripped on the proxy path.
tool_namestringyesThe held call, in whatever form the lane that raised the hold writes. There is no single format: see the operation description before matching on it.

Example response

{
  "id": "obj_0000000000000000",
  "org_id": "org_0000000000000000",
  "agent_id": "agt_0000000000000000",
  "matched_rule_id": "matchedrule_0000000000000000",
  "matched_rule_name": "Example",
  "tool_name": "Example",
  "tool_input": {},
  "status": "pending",
  "created_at": "2026-01-15T12:00:00.000Z",
  "expires_at": "2026-01-15T12:00:00.000Z"
}

Example request

curl -X GET https://api.codespar.dev/v1/approvals/{id} \
  -H "Authorization: Bearer $CODESPAR_API_KEY"

GET /v1/approvals/{id}/status

Poll a held call for its outcome

Path parameters

NameTypeRequiredDescription
idstringyes

Responses

StatusBodyDescription
200objectOK
404objectNot Found: no approval with that id in the caller's org and project.

Response 200

FieldTypeRequiredDescription
approval_idstringyes
approval_status"pending" | "approved" | "denied" | "expired" | "execution_failed"yes
created_atstring (date-time)yes
decided_atstring,null (date-time)yes
decided_bystring,nullyes
decision_reasonstring,nullyes
executed_atstring,null (date-time)yes
execution_resultobject,nullyes
expires_atstring (date-time)yes
tool_namestringyes

Example response

{
  "approval_id": "approval_0000000000000000",
  "approval_status": "pending",
  "tool_name": "Example",
  "created_at": "2026-01-15T12:00:00.000Z",
  "expires_at": "2026-01-15T12:00:00.000Z"
}

Example request

curl -X GET https://api.codespar.dev/v1/approvals/{id}/status \
  -H "Authorization: Bearer $CODESPAR_API_KEY"
Approvals | CodeSpar