Credits
Charge agent credits
Deducts an amount in USD from the balance of the credit account that owns token. The paywall middleware calls this once per paid request. Returns 409 with type insufficient_credit when the balance is too low.
Rate limit: 600 per minute per API key.
bearerAuthAuthorizationBearer <token>A live API key, sk_live_ followed by 32 base58 characters.
Idempotency-Key?stringA unique string of 1 to 255 characters for this operation. A key belongs to the business across every endpoint for 24 hours, so give each operation its own key, for example invoice-order-1042 and refund-order-1042, not the order id alone. A retry with the same key on the same endpoint and with the same body returns the stored response with the header Idempotent-Replayed: true. The same key with a different body or on another endpoint returns 409 idempotency_conflict. Errors are not stored, so a request that failed can be retried with the same key, even with a corrected body. While the first request with a key is still running, a retry gets 409 idempotency_conflict with Retry-After: 1.
1 <= length <= 255application/json- body
token*stringThe agent's credit token.
^solverr_credit_[1-9A-HJ-NP-Za-km-z]{32}$amount*stringDecimal string with up to 6 decimals, greater than 0.
^\d{1,9}(\.\d{1,6})?$currency?stringOptional. Any other value is refused, because balances are in USD.
description?stringlength <= 200The charge, with the balance after it.
application/json- response
id*stringCharge id, starting with cru_; pass it to the refund endpoint to give the charge back.
object*stringamount*stringAmount charged in USD with 6 decimals.
refunded?booleanPresent and true on the refund endpoint's answer.
balance*stringBalance in USD with 6 decimals after this charge or refund.
currency*stringcurl -X POST 'https://example.com/api/v1/credits/charge' \ -H 'Content-Type: application/json' \ -d '{ "token": "string", "amount": "string"}'{ "id": "string", "object": "credit_charge", "amount": "string", "refunded": true, "balance": "string", "currency": "USD"}