Response envelope
The keys every answer has, success or error.
Success
Every successful answer has three keys next to the route's own data:
{
"success": true,
"credits_charged": 1,
"credits_remaining": 999
}| key | meaning |
|---|---|
success | true |
credits_charged | what this request cost |
credits_remaining | what your key can still spend after this request |
Credit amounts are exact decimals in the JSON, never rounded floats. Parse them as decimals if you do money math.
Error
Every error has the same shape, and errorStatus always equals the HTTP status:
{
"success": false,
"error": "timeout",
"errorStatus": 504,
"message": "no answer within the time limit; not charged",
"credits_charged": 0
}| key | meaning |
|---|---|
error | a stable code. Branch on this. |
errorStatus | the HTTP status, repeated |
message | for people. It may be reworded at any time. |
credits_charged | always 0 on an error |
retry_after_s | optional: the same number as the Retry-After header |
credits_remaining | optional: on 402, and on free answers that report it |
needed_credits | optional: on 402, what the request costs |
Every code is listed on Errors.