REST API

Error Codes

REST API error response structure and the cause and resolution for each HTTP status code.

When an API request fails, a JSON response containing error information is returned along with an HTTP status code.


Error Response Structure

An error response has three fields: type, title, and message. There is no wrapping object such as error.

{
  "type": "notFound",
  "title": "Not Found",
  "message": "The requested resource could not be found"
}
Field Type Description
type string A code identifying the error. Use this value to branch in your code
title string A short title for the error
message string | string[] A description of the error. Validation failures return an array of per-Column messages

message is returned in English and its wording may change. Tell errors apart by the HTTP status code and type.


Error Types

The type values and HTTP status codes the public REST API returns.

type HTTP When
invalidJsonInput 400 The request body is not a JSON object, or it contains a key that is not a Column name or an accepted key (Unknown keys: …)
invalidRequest 400 Validation failed, an invalid parameter or body value, or an unsupported file type
invalidCategoryValue 400 A CATEGORY Column received a category value ID that does not exist
invalidReferenceValue 400 A REFERENCE Column received a content ID that does not exist in the referenced Table
slugCantBeUUID 400 The slug is in UUID format
contentsLocked 400 Attempted to update or delete locked Contents
insufficientCredit 400 The Workspace does not have enough credits
invalidMultipartRequest 400 A file upload request is not multipart/form-data
fileFieldRequired 400 A file upload request has no file field
unauthorized 401 Missing or incorrect API Key, deleted or disabled Key, a Key of another Project, or a request from a domain / IP outside the Key's allowed hosts
apiKeyExpired 401 The API Key's expiry has passed
forbidden 403 A request that needs a secret key was sent with a publishable key
apiNotEnabled 403 The endpoint is turned off in the Project's API endpoints screen
ipNotAllowed 403 The request is rejected by the IP allow / block lists in the Workspace security settings
notFound 404 The requested resource (Table, Contents, …) does not exist
duplicatedContentsSlug 409 Contents with the same slug already exist in the Table
reservedContentsSlug 409 A system-reserved word (id, slug, created_at, updated_at, published_at) was used as the slug
duplicatedColumnValue 409 A unique Column received a value that already exists
planFileSizeLimitExceeded 413 The uploaded file exceeds the plan's per-file upload limit
planFileStorageLimitExceeded 413 The Workspace has reached the plan's file storage limit
planTableStorageLimitExceeded 413 The Workspace has reached the plan's Table storage limit
rateLimited 429 The API Key exceeded its requests-per-second limit
error 500 Internal server error

HTTP Status Code Reference

400 Bad Request

The request format or a value is invalid. Validation failures are also returned as 400, not 422.

Causes

  • The request body is not a JSON object
  • The body contains a key that is not a Column name of the Table (for example, Column values wrapped in data)
  • Missing value in a required Column, a number Column outside its min/max range, or a text Column violating minText/maxText
  • A category value or referenced content ID that does not exist
  • Updating or deleting locked Contents, or insufficient credits

Error response examples

When a key that is not accepted is sent:

{
  "type": "invalidJsonInput",
  "title": "Invalid JSON Input",
  "message": "Unknown keys: data, status"
}

When validation fails, message is an array of strings in the form "{Column name}: {rule}".

{
  "type": "invalidRequest",
  "title": "Invalid Request",
  "message": ["title: required", "price: min"]
}

The rule name is one of required, minText, maxText, number, min, max, step, invalidEmail, invalidUrl, invalidBoolean, invalidJson. If a value's type does not match the Column type, a type error message appears instead.

Resolution

Verify that the Content-Type: application/json header is included. Send Column values at the top level of the body keyed by Column name (see Request Examples), and correct the values according to the Column and rule shown in message.


401 Unauthorized

Authentication failed.

Causes

  • Missing X-Onttle-Key or Authorization header
  • Key provided in the Authorization header without the Bearer prefix
  • API Key value is incorrect or does not exist
  • API Key has been deleted or disabled
  • The {projectId} in the path is not the Project the Key belongs to
  • Request from a domain (Origin) or IP that is not in the Key's allowed hosts
  • The API Key's expiry has passed (type is apiKeyExpired)

Resolution

Confirm the header format is X-Onttle-Key: {API_KEY} or Authorization: Bearer {API_KEY}. Check that no leading or trailing whitespace was included when copying the Key, and check the Key's allowed hosts and expiry.

# Correct format
curl -H "Authorization: Bearer abc123xyz"

# Incorrect format (missing Bearer)
curl -H "Authorization: abc123xyz"

403 Forbidden

Authentication succeeded but you do not have permission to perform the operation.

Causes

  • Attempting a write request (POST, PUT, DELETE), a file upload, or a chat or embeddings call with a publishable API Key (pk-proj_…) (forbidden)
  • Calling an endpoint that is turned off in the Project's API endpoints screen (apiNotEnabled)
  • A request rejected by the IP allow / block lists in the Workspace security settings (ipNotAllowed)

Resolution

Check the API Key's type and whether the endpoint is enabled. Publishable keys are read-only; if write access is needed, use a secret key (sk-proj_…) from your server. The response message says when a secret key is required:

{
  "type": "forbidden",
  "title": "Forbidden",
  "message": "This endpoint requires a secret API key (sk-proj_…). Publishable keys (pk-proj_…) are read-only."
}

404 Not Found

The requested resource does not exist.

Causes

  • An identifier such as {table} or {id} is incorrect
  • The Contents are not published or have already been deleted (read APIs return published Contents only)
  • Typo in the path

Resolution

Copy the Table's slug (or ID) and the content ID from the dashboard and compare against the request path. Check that the Contents you are reading are published.


409 Conflict

A resource conflict occurred.

Causes

  • Duplicate value entered in a unique Column (duplicatedColumnValue)
  • A slug that already exists in the same Table (duplicatedContentsSlug)
  • A system-reserved word used as the slug (reservedContentsSlug)

Resolution

Check for existing duplicate values and use a different value.


413 Payload Too Large

A storage limit of the plan was exceeded.

Causes

  • The uploaded file exceeds the per-file upload limit (planFileSizeLimitExceeded)
  • The Workspace's file or Table storage has reached its limit (planFileStorageLimitExceeded, planTableStorageLimitExceeded)

Resolution

Remove data or files you no longer use, or change the plan. See Plans and Limits for the limits.


429 Too Many Requests

The API Key exceeded its requests-per-second limit. The limit depends on the Workspace's plan.

Resolution

Wait briefly before retrying. Wait for the number of seconds in the Retry-After response header, then send the request again. The response also includes the X-RateLimit-Limit and X-RateLimit-Remaining headers.


500 Internal Server Error

An internal server error occurred.

Resolution

Retry the same request after a short wait. If the problem persists, contact the support channel with the request time and path.


Member API Error Codes

The member API (/auth/*, /me), Table permission rule and member file upload errors return only code and message instead of the structure above (type, title, message).

{ "code": "AUTH_EMAIL_WITHDRAWN", "message": "This e-mail address was withdrawn and cannot sign up again for 90 days after withdrawal." }
Code HTTP When
AUTH_INVALID_REQUEST 400 Invalid request body
AUTH_INVALID_CREDENTIALS 401 Wrong email or password (it does not say which)
AUTH_TOKEN_EXPIRED 401 Token expired
AUTH_TOKEN_INVALID 401 Token missing, forged or reused
AUTH_SIGNUP_PAUSED 402 The monthly sign-up cap was reached
AUTH_EMAIL_NOT_VERIFIED 403 Login before email verification
AUTH_MEMBER_SUSPENDED 403 The member is suspended
AUTH_FORBIDDEN 403 Permission rule violation, failed CSRF check
AUTH_NOT_ENABLED 403 The member feature is off for the Project
AUTH_EMAIL_EXISTS 409 The email is already registered
AUTH_EMAIL_WITHDRAWN 409 Re-sign-up within 90 days of withdrawal
AUTH_RATE_LIMITED 429 Too many requests

Resolution

  • AUTH_TOKEN_EXPIRED: refresh the tokens with POST /auth/token/refresh, then retry.
  • AUTH_TOKEN_INVALID: log in again. Refresh tokens are single use, so store the new one after every refresh.
  • AUTH_SIGNUP_PAUSED: check the Project's monthly sign-up cap. Logins of existing members are not affected.
  • AUTH_EMAIL_WITHDRAWN: the same email can sign up again 90 days after the withdrawal. An admin can lift the block in the dashboard.

TypeScript Error Handling Example

const res = await fetch(
  `https://api.onttle.com/v1/{projectId}/tables/posts`,
  {
    headers: {
      Authorization: `Bearer ${process.env.ONTTLE_API_KEY}`,
    },
  },
)

if (!res.ok) {
  // { type, title, message }
  const error = await res.json()
  const message = Array.isArray(error.message)
    ? error.message.join(', ')
    : error.message

  switch (res.status) {
    case 400:
      // message is an array of strings when validation fails
      console.error('Request error:', error.type, message)
      throw new Error('Check your request data.')
    case 401:
      throw new Error('Authentication failed: check your API Key.')
    case 403:
      throw new Error('Forbidden: check your API Key permissions.')
    case 404:
      throw new Error('Resource not found.')
    case 429:
      throw new Error(`Rate limited: retry in ${res.headers.get('Retry-After')}s`)
    default:
      throw new Error(`API error: ${res.status} ${error.type}`)
  }
}

const data = await res.json()

Next Steps

  • Authentication — Learn the correct authentication method to prevent 401 and 403 errors.
  • REST API Usage — See complete request examples including error handling.