Reauthorize a transaction with x402 payment data
Endpoint
Section titled “Endpoint”POST /v1/transactions/{transactionId}/reauthorize
Authentication
Section titled “Authentication”Requires Bearer token authentication.
Path Parameters
Section titled “Path Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
transactionId | string | Yes | Transaction ID to reauthorize |
Request Body
Section titled “Request Body”{ "x402": { "x402Version": 2, "resource": { "url": "https://api.example.com/resource", "description": "Access to API", "mimeType": "application/json" }, "accepts": [ { "scheme": "exact", "network": "eip155:84532", "asset": "USDC", "amount": "10500000", "payTo": "0x...", "maxTimeoutSeconds": 300 } ] }, "additionalProtocols": { "custom-protocol": {} }, "metadata": { "originalRequest": { "url": "https://api.openai.com/v1/chat/completions", "method": "POST" }, "responseHeaders": { "x-ratelimit-remaining": "0" }, "httpStatusCode": 402 }}cURL Example
Section titled “cURL Example”curl -X POST "https://api.sapiom.ai/v1/transactions/{transactionId}/reauthorize" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "x402": { "x402Version": 2, "resource": { "url": "https://api.example.com/resource", "description": "Access to API", "mimeType": "application/json" }, "accepts": [ { "scheme": "exact", "network": "eip155:84532", "asset": "USDC", "amount": "10500000", "payTo": "0x...", "maxTimeoutSeconds": 300 } ] }, "additionalProtocols": { "custom-protocol": {} }, "metadata": { "originalRequest": { "url": "https://api.openai.com/v1/chat/completions", "method": "POST" }, "responseHeaders": { "x-ratelimit-remaining": "0" }, "httpStatusCode": 402 }}'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 - no supported payment method found or transaction not in correct state |
| 401 | - | Unauthorized - invalid or missing API key |
| 404 | - | Transaction not found |
See API Introduction for error handling details.