Skip to content
AINSOFAPI Get API key

GuidesError handling

Error handling

A failed call returns ok: false, an error code and usually a message you can show. Read the HTTP status together with error.

  • 202 still_running is not a failure. Send the identical request again and it continues the same job.
  • 401: unauthorized means the key is not recognised. sign_in_required on a video action is a step for the person, not a failure: show sign_in_url, then repeat the request with sign_in_code.
  • 429: rate_limited means the daily allowance is used up; wait, or use a key. slow_down, busy and queue_full are short-term; try again shortly.
  • 503 means the engine could not do the job right now. Nothing was done; try again. It never means that nothing matched. Where an action's notes say a retry will not help, follow them.
  • 400 means a parameter is missing or out of range; the message says which.
  • In code, branch on the HTTP status first and then on error. Some validation errors carry a sentence in error rather than a code, so show message (or error) to people rather than matching its exact words.

Every action lists its own errors in the API Reference.