Docs
Billing

Buy inference credits

POST
/v1/billing/inference-credits/purchases

Charges your org's saved card for amount of inference credits, $5.00 to $999,999.99, on an invoice of its own, and returns the purchase. It is paid, and its amount is in the balance, once Stripe confirms the charge, usually before this call returns; it is failed, with failure saying why, if the card is declined, and nothing is charged. One still pending settles within a minute. An org without a payment method answers 402 payment_required. One with a purchase still pending, or whose inference is invoiced or not billed, answers 409 invalid_state. A retry with the same Idempotency-Key returns the same purchase. Only owners signed in to the console can call it.

Authorization

oauth2 org:write
headerAuthorizationBearer <token>

A person's access token, sent as Authorization: Bearer <token>, from the authorization code flow with PKCE (S256). A CLI on a machine without a browser can use the device flow (RFC 8628) at https://auth.confidential.ai/oauth2/device_authorization instead. Ask for the resource https://api.cloud.confidential.ai (RFC 8707): a token issued for any other resource, the MCP server's included, is refused. A token acts for one person in one org, with the scopes of the person's role there whatever the client asks for, so ask the authorization server for none of the scopes below; they are listed so that each operation can name the ones it needs. Access tokens last minutes, and a refresh token is replaced at every use.

Scope: org:write

Header Parameters

Idempotency-Key*string

A unique key for this intent, such as a UUID. Reuse it for every retry of the same request. A missing key returns 400 idempotency_key_required. See Idempotency above.

Match^[!-~]+$
Length1 <= length <= 255
Api-Version*string

The API version the request is written against. This document describes 2026-10-15. A missing header returns 400 api_version_required, and a version the API does not serve returns 400 unsupported_api_version.

X-Correlation-ID?string

An id of your own for this request, or for a group of requests, to find them in our logs and yours. Logged with the request and returned unchanged in X-Correlation-ID. The request id itself is always the API's own, in X-Request-ID.

Match^[A-Za-z0-9._:-]+$
Length1 <= length <= 128
Org-Context?string

Admin keys only: the id of the org to act in. Required with an admin key, together with Access-Reason; with any other credential it returns 400 invalid_request. Every request that carries it is recorded in that org's operator-access log.

Match^org-[a-z0-9]([-a-z0-9]*[a-z0-9])?$
Length5 <= length <= 63
Access-Reason?string

Admin keys only: why the operator is acting in the org, such as a support ticket. Required with Org-Context. Recorded, verbatim, in the org's operator-access log.

Match^[^\x00-\x1F\x7F]+$
Length10 <= length <= 500

Request Body

application/json
  1. body
amount*DollarAmount

What to buy, $5.00 to $999,999.99.

Match^[0-9]{1,6}(\.[0-9]{2})?$

Response Body

The purchase.

application/json
  1. response

A purchase of inference credits, charged to the saved card.

id*string
currency*string
amount*string
status*string

pending while Stripe charges the card, then paid, in the balance, or failed, charging nothing. Open set; accept values not listed.

failure?string

Why a failed purchase was not charged.

automatic*boolean

Whether auto-reload bought it.

createdBy?string

The owner who bought it. Absent for a reload.

createdAt*string
Formatdate-time
settledAt?string
Formatdate-time
Example Request
curl -X POST 'https://api.cloud.confidential.ai/v1/billing/inference-credits/purchases' \  -H 'Idempotency-Key: 0b9d6c1e-5f8a-4c2e-9a51-2f7e0c3d4b18' \  -H 'Api-Version: 2026-10-15' \  -H 'X-Correlation-ID: rollout-2026-10-22' \  -H 'Access-Reason: Support ticket 4821: customer asked why i-6d3f9h2k8mzr failed' \  -H 'Content-Type: application/json' \  -d '{  "amount": "25.00"}'
Example Response
{  "id": "icp-2n7c4v9z1hdq",  "currency": "USD",  "amount": "25.00",  "status": "paid",  "automatic": false,  "createdBy": "user_alice",  "createdAt": "2026-11-16T09:00:00Z",  "settledAt": "2026-11-16T09:00:02Z"}