Safely retire a credit purchase that never started
curl --request POST \
--url https://code.deepline.com/api/v2/billing/credit-purchases/recover \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"credits": 4503599627370496,
"org_id": "<string>"
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({credits: 4503599627370496, org_id: '<string>'})
};
fetch('https://code.deepline.com/api/v2/billing/credit-purchases/recover', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://code.deepline.com/api/v2/billing/credit-purchases/recover"
payload = {
"credits": 4503599627370496,
"org_id": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"org_id": "<string>",
"credits": 123,
"amount_cents": 123,
"currency": "<string>",
"recovery_disposition": "retired_before_start"
},
"operation": {
"id": "<string>",
"state": "<string>",
"version": 123,
"next_action": "<string>"
},
"request_id": "<string>"
}{
"error": "Unauthorized"
}{
"error": "Unauthorized"
}{
"error": "Unauthorized"
}{
"error": "Unauthorized"
}{
"error": "Unauthorized"
}Billing
Safely retire a credit purchase that never started
Use the original workspace, credit amount and idempotency key. Atomically retire an absent original intent or return the existing operation unchanged. This endpoint never submits or reconciles a payment. Retry uncertain responses with the same identity; a fresh purchase requires separate explicit approval.
POST
/
api
/
v2
/
billing
/
credit-purchases
/
recover
Safely retire a credit purchase that never started
curl --request POST \
--url https://code.deepline.com/api/v2/billing/credit-purchases/recover \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"credits": 4503599627370496,
"org_id": "<string>"
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({credits: 4503599627370496, org_id: '<string>'})
};
fetch('https://code.deepline.com/api/v2/billing/credit-purchases/recover', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://code.deepline.com/api/v2/billing/credit-purchases/recover"
payload = {
"credits": 4503599627370496,
"org_id": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"org_id": "<string>",
"credits": 123,
"amount_cents": 123,
"currency": "<string>",
"recovery_disposition": "retired_before_start"
},
"operation": {
"id": "<string>",
"state": "<string>",
"version": 123,
"next_action": "<string>"
},
"request_id": "<string>"
}{
"error": "Unauthorized"
}{
"error": "Unauthorized"
}{
"error": "Unauthorized"
}{
"error": "Unauthorized"
}{
"error": "Unauthorized"
}Authentication: workspace API key in
Authorization: Bearer <key>.
Errors
| Status | Meaning |
|---|---|
| 400 | The request conflicts with current state or a retained request identity. |
| 401 | The request conflicts with current state or a retained request identity. |
| 403 | The request conflicts with current state or a retained request identity. |
| 409 | The request conflicts with current state or a retained request identity. |
| 503 | A required service is unavailable. Respect Retry-After when present. |
Authorizations
Headers
Body
application/json
The original purchase identity; org_id must match the authenticated workspace.