Export a signed audit bundle for a decided approval
const url = 'https://example.com/v1/approvals/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/audit-bundle';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"signingKeyId":"example","includeMessages":false}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/approvals/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/audit-bundle \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "signingKeyId": "example", "includeMessages": false }'Canonicalizes the approval + decision + evidence as sorted-key JSON and signs with the deployment’s Ed25519 key looked up by signingKeyId. Envelope shape mirrors provenance.export byte-for-byte so SDK clients can reuse a single verifyEd25519 wrapper for both. Only meaningful post-decision — pending approvals return 409 approval-not-decided.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”ApprovalId — opaque branded string (a UUID).
Header Parameters
Section titled “Header Parameters”Caller-supplied idempotency key. Retries with the same key return the original response byte-identical (per docs/API-ROUTE-CONVENTIONS.md §3.1).
Request Bodyrequired
Section titled “Request Bodyrequired”Body for POST /v1/approvals/{approvalId}/audit-bundle. signingKeyId selects the Ed25519 key from the deployment’s signingKey binding. includeMessages optionally hydrates conversation messages tied to the approval’s run.
object
The SigningKeyId the deployment plugs into its signingKey binding. Server looks up the private key via signingKey.getPrivateKey(signingKeyId) — 404 if unknown.
When true, hydrates conversation messages tied to the approval’s run (agent turns pin runId === conversationId). Empty array for non-agent runs — field always present when requested.
Responses
Section titled “Responses”Signed audit bundle.
Signed exportable audit bundle. Same envelope shape as ExportProvenanceResult — clients can reuse the same verifyEd25519 wrapper for both. bundle is base64 of the exact bytes that were signed (sorted-key canonical JSON, no whitespace). Bundle body: { bundleVersion, approvalId, tenantId, subjectKind, subjectRef, requiredRole, status, decision, decidedAt?, evidence: { guardrailResults?, messages? }, createdAt, exportedAt }.
object
Base64-encoded canonical JSON of the bundle body.
Integer schema version for the bundle body shape. Currently 1.
Base64-encoded Ed25519 signature over bundle (after base64-decode).
PEM-encoded Ed25519 public key (DER SPKI envelope). Pass into parsePublicKeyPem for verification.
Canonicalization algorithm — sorted-key JSON, no whitespace. Same algorithm as canonicalize.
Example
{ "algorithm": "ed25519", "canonicalization": "sorted-key-json"}Malformed request body.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Token lacks a reviewer role.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Approval not found, signing key id unknown, or signing not configured on this deployment.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Idempotency-Key was reused with a different body, or resource-state conflict.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Server error (unmapped domain code or framework crash).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}