Credits
Purchase additional credits
Triggers an immediate credit top-up for the authenticated user
Purchase additional credits
cURL
curl -X POST "https://api.handwritingocr.com/v3/credits/topup" \
-H "Authorization: Bearer your-api-token" \
-H "Accept: application/json" \
-F "amount=500" {
"success": true,
"credits_purchased": 500,
"new_balance": 1250,
"amount_charged": "$4.99"
} Triggers an immediate credit top-up for the authenticated user using their saved payment method. Works independently of auto-topup settings. Rate-limited to one successful purchase per 5-minute window.
Headers
- Authorization string required header
Bearer your-api-token - Accept string required header
application/json - Content-Type string required header
multipart/form-data
Body parameters
- amount integer required body
Number of credits to purchase. Must be a multiple of 100.
Response codes
HTTP status- 200
Purchase succeeded. Returns the number of credits added, the user's updated balance, and the formatted charge amount.
- 402
The payment requires 3DS or bank authentication before it can complete. Follow
authentication_urlto verify, then retry. - 403
Invalid API token, or the user does not have an active subscription. A subscription is required to purchase credits.
- 422
Validation error.
amount_not_multiple_of_100,amount_below_minimum,no_payment_method, orpayment_failed(withdecline_code). - 429
A successful purchase was already made within the last 5 minutes. Check
retry_after(ISO 8601) for when the next purchase is permitted.