Skip to content
Go To Dashboard

Complete a transaction

POST /v1/transactions/{transactionId}/complete

Requires Bearer token authentication.

ParameterTypeRequiredDescription
transactionIdstringYesTransaction ID to complete
{
"outcome": "success",
"responseFacts": null
}
Terminal window
curl -X POST "https://api.sapiom.ai/v1/transactions/{transactionId}/complete" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"outcome": "success",
"responseFacts": null
}'
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"tenantId": "123e4567-e89b-12d3-a456-426614174000",
"serviceName": "openai",
"actionName": "completion",
"resourceName": "gpt-4",
"serviceId": "123e4567-e89b-12d3-a456-426614174000",
"status": "authorized",
"requiresPayment": true,
"qualifiers": {
"model": "gpt-4",
"tokens": 1000
},
"metadata": null,
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z",
"authorizedAt": "2024-01-01T00:00:00.000Z",
"completedAt": "2024-01-01T00:00:00.000Z",
"outcome": "success",
"currentPaymentTransactionId": "123e4567-e89b-12d3-a456-426614174000",
"payment": null,
"trace": null,
"agentId": "123e4567-e89b-12d3-a456-426614174000",
"agent": null,
"costs": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"transactionId": "123e4567-e89b-12d3-a456-426614174000",
"tenantId": "123e4567-e89b-12d3-a456-426614174000",
"paymentTransactionId": "123e4567-e89b-12d3-a456-426614174000",
"fiatAmount": "0.25",
"fiatAssetId": "123e4567-e89b-12d3-a456-426614174000",
"isEstimate": false,
"isActive": true,
"supersedesCostId": "123e4567-e89b-12d3-a456-426614174000",
"supersededAt": "2024-01-15T10:30:00Z",
"costDetails": {
"provider": "anthropic",
"model": "claude-3-5-sonnet-20241022",
"inputTokens": 1000,
"outputTokens": 5000
},
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
]
}
StatusCodeDescription
400-Invalid request - transaction not in AUTHORIZED state or already completed
401-Unauthorized - invalid or missing API key
404-Transaction not found

See API Introduction for error handling details.