Using the API

Errors

Every error has one shape, a type and a message, under a status that says which kind of error it is.

#The shape

400 Bad Request400
{
  "error": {
    "type": "invalid_request",
    "message": "Some of the input is not valid."
  },
  "issues": [
    {
      "path": "question",
      "message": "Too small: expected string to have >=3 characters"
    }
  ]
}

#Statuses

400
invalid_request

The input does not fit the endpoint. The issues list says which field and why.

401
missing_key · invalid_key

No key, a malformed one, or one that was revoked.

402
plan_excluded · plan_limit

The API needs a paid plan, or the free plan’s credits are used up. The plan field says which.

403
read_only_key

A read-only key tried to start a run that spends credits.

404
not_found

No such endpoint, app or job of yours.

409
not_cancellable

The run has started; only a waiting run can be cancelled.

422
idempotency_mismatch

An Idempotency-Key was used before for a different request.

429
rate_limited · quota · key_cap · plan_exhausted

Too many requests this minute, a daily cap, or this period’s credits are used up. Retry-After says how long to wait.

503
off · runs_not_open · not_set_up

The API is switched off, or runs are not open yet. Free reads may still work.