Complete a transaction
Endpoint
Section titled “Endpoint”POST /v1/transactions/{transactionId}/complete
Authentication
Section titled “Authentication”Requires Bearer token authentication.
Path Parameters
Section titled “Path Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
transactionId | string | Yes | Transaction ID to complete |
Request Body
Section titled “Request Body”{ "outcome": "success", "responseFacts": null}cURL Example
Section titled “cURL Example”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}'Response
Section titled “Response”{ "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" } ]}Error Responses
Section titled “Error Responses”| Status | Code | Description |
|---|---|---|
| 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.