API · Credits
Add credits to your account, paid over MPP or x402, with no human.
POST /v1/credits/topup
| Request | POST /v1/credits/topup |
| Operation id | credits.topup |
| Cost | Free |
| Auth | API key: Authorization: Bearer <key> or x-api-key. |
Send {"pack": "starter"} or {"credits": 25000}. The first call answers 402 with challenges for the exact amount; pay one and retry the same request with the credential. With the key in Authorization, send the MPP credential in Payment-Authorization. Applied once per payment.
Responses
| Status | Meaning | Schema |
|---|---|---|
200 | Credits added. | TopupResult |
400 | Not a pack, or credits outside the allowed range. | Error |
401 | Missing or invalid API key. | Error |
402 | Payment required (with challenges), or the payment was refused. | Error |
404 | Top-ups are not enabled on this server. | Error |
503 | Payments are temporarily unavailable. Nothing was charged. | Error |
TopupResult fields
| Field | Type | Description |
|---|---|---|
credits_added | integer | |
balance | integer | |
payment | object |
Errors use one shape everywhere; see Errors for every code and what to do.