Skip to Content
coaadedocs

Errors

The Coaade Cloud API's error format, HTTP status codes and error codes.

Errors return a non-2xx status and a JSON body with a machine-readable error code and a human-readable message:

{
  "error": "INVALID_CREDENTIALS",
  "message": "Invalid email or password"
}

Some errors add fields. For example, KEY_LIMIT_REACHED includes limit and used.

Branch on error, not on message; messages may change.

The model API uses a different error shape. See Model API errors.

Status codes

StatusMeaning
400The request was understood but can't be done, such as a wrong verification code
401Missing, invalid or expired credentials
402Payment is needed, for example checkout before a plan change
403You're signed in but not allowed, such as a plan limit
404The resource doesn't exist
409It conflicts with existing data, such as an email that's already registered
422The body failed validation
429Rate limit exceeded
502The payment provider failed; try again
503A dependency, such as billing, isn't available

Error codes

CodeStatusWhen
UNAUTHORIZED401No Authorization: Bearer header
TOKEN_EXPIRED401The access or refresh token is invalid or expired
TOKEN_REVOKED401The refresh token was revoked, for example after a password reset
INVALID_CREDENTIALS401Wrong email or password
EMAIL_NOT_VERIFIED403The email isn't verified. A new code is sent automatically on sign-in.
EMAIL_EXISTS409An account already uses this email
ALREADY_VERIFIED400The email is already verified
INVALID_CODE400A verification or reset code is wrong or expired
WEAK_PASSWORD422The password fails the password rules
VALIDATION_ERROR422A field is missing or invalid
USER_NOT_FOUND404The account doesn't exist
PLAN_NOT_FOUND404The plan ID doesn't exist
PLAN_NOT_PURCHASABLE422The plan is free or custom (Enterprise)
CHECKOUT_REQUIRED402The plan change needs checkout first
NO_SUBSCRIPTION404There's no paid plan to cancel or reactivate
BILLING_UNAVAILABLE503Billing isn't configured
BILLING_ERROR502The payment provider failed
KEY_LIMIT_REACHED403The plan's API key limit is reached
KEY_NOT_FOUND404The API key doesn't exist or is already revoked
UPGRADE_REQUIRED403Team seats need a Team or Enterprise plan
SEAT_LIMIT_REACHED403No seats left
ALREADY_INVITED409This email already has a seat or invitation
OWNER_SEAT422The owner already has a seat
SEAT_NOT_FOUND404The seat doesn't exist
NOT_A_MEMBER404You aren't on a team

Model API errors

The model API (POST /v1/chat/completions and GET /v1/models) uses a different shape. The body is an error object with a human-readable message, the error's type and a machine-readable code:

{
  "error": {
    "message": "The model \"my-model\" does not exist. Available models: coaade-code-2, coaade-mind-1.",
    "type": "not_found_error",
    "code": "model_not_found"
  }
}

type is one of authentication_error, permission_error, not_found_error, invalid_request_error, rate_limit_error or server_error. An error about one field of the request also has param, naming it. Branch on code. The Call models page lists every code with its status.

Tool calling

A request with tools that fails one of these checks gets 400 invalid_tools, with param naming the field:

{
  "error": {
    "message": "messages[2].tool_call_id is \"call_x\", which is not one of the tool calls in messages[1].",
    "type": "invalid_request_error",
    "param": "messages[2].tool_call_id",
    "code": "invalid_tools"
  }
}
Checkparam
tools is an array of at most 128 tools, at most 200,000 characters as JSONtools
Each tool is { "type": "function", "function": { ... } }tools[i], tools[i].type, tools[i].function
A name is 1 to 64 letters, digits, underscores or dashes, different for each tooltools[i].function.name
description is a stringtools[i].function.description
parameters is a JSON Schema object with "type": "object", or has no typetools[i].function.parameters
tool_choice is "auto", "none", "required" or a function in tools; "required" needs toolstool_choice
parallel_tool_calls is true or falseparallel_tool_calls
An assistant message's tool_calls is an array of calls, each with an id of its own, type "function", a valid name and arguments that are a JSON object, as a stringmessages[i].tool_calls[j] and its fields
A tool message has a tool_call_idmessages[i].tool_call_id
A tool message follows the assistant message whose call it answers, with only other tool messages betweenmessages[i]
Its tool_call_id is one of that message's calls, answered oncemessages[i].tool_call_id
Every call has its tool message before the next user or assistant messagemessages[i].tool_calls

functions, function_call and function messages, the older form of tools, get 400 unsupported_parameter: send tools and tool messages instead.

Handling expired tokens

When a call returns 401 with TOKEN_EXPIRED, refresh and retry once. If the refresh also fails, sign the user in again.

async function call(path: string, init: RequestInit = {}) {
  let res = await fetch(`https://api.coaade.com${path}`, withAuth(init, tokens.access));
  if (res.status === 401) {
    tokens = await refresh(tokens.refresh); // POST /v1/auth/refresh
    res = await fetch(`https://api.coaade.com${path}`, withAuth(init, tokens.access));
  }
  return res;
}

On this page