Guide

Error codes

Every error the API returns, what it means, and how to recover.

Errors return a non-2xx status and a JSON body with a stable machine-readable code. Branch on the code, never on the message - messages are written for humans and may be reworded.

json
{
  "success": false,
  "error": {
    "code": "insufficient_credits",
    "message": "This call costs 10 credits and your balance is 3. Top up to continue.",
    "details": null
  },
  "creditsCharged": 0,
  "creditsRemaining": 3
}

Reference

StatusCodeMeaning and fix
400invalid_argumentsAn argument is missing or the wrong type. details lists each problem by field. Not charged.
400invalid_urlA URL argument is not an absolute http/https URL.
400invalid_hashThe supplied hash is not in the expected format for that algorithm.
401unauthorizedThe key is missing, malformed or revoked. Check the Authorization header.
402insufficient_creditsBalance is below the call price. Top up. Nothing was charged.
403account_suspendedThe account is blocked. Contact support.
404unknown_toolNo endpoint with that key. Check the reference for the exact spelling.
502upstream_unreachableThe host you targeted did not respond. Charged - the attempt was made on your behalf.
502upstream_timeoutThe target took too long. Refunded.
502internal_errorA fault on our side. Refunded. Retry; if it persists, contact support.
503tool_disabledThat endpoint is temporarily switched off. Not charged.

Retrying safely

  • Retry 502 and 503 with exponential backoff - these are transient and the refunded ones cost nothing.
  • Never retry 400, 401 or 403 without changing the request; the outcome will be identical.
  • Treat 402 as a stop condition, not a retry. Looping on it will not succeed until the balance changes.
  • Every endpoint is read-only or side-effect free, so a retry can never duplicate work you have already paid for.