Skip to content

Errors

When a request fails, the API returns a JSON error envelope with a machine-readable code and a human-readable message.

Error Format

json
{
  "error": {
    "code": "NOT_FOUND",
    "message": "Entity not found: Customer"
  }
}

Some errors include a details array with per-field information:

json
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Validation failed: 2 error(s)",
    "details": [
      { "field": "email", "message": "must be a valid email address" },
      { "field": "name", "message": "name is required" }
    ]
  }
}

Status Codes

CodeError CodeDescription
400BAD_REQUESTInvalid request body or parameters
400FOREIGN_KEY_VIOLATIONReferenced record does not exist
401UNAUTHORIZEDMissing, invalid, or expired API key
403FORBIDDENAPI key doesn't have permission for this operation
404NOT_FOUNDEntity or record not found
409WORKSPACE_STATUSWorkspace access mode prevents this operation
409UNIQUE_CONSTRAINT_VIOLATIONDuplicate value for a unique column
422VALIDATION_ERRORRequest data fails constraint validation (includes details)
500INTERNAL_ERRORUnexpected server error

Common Errors

Invalid API Key

json
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid API key"
  }
}

The key is missing, incorrect, or has been revoked. Check that you're including the full key in the Authorization: Bearer header.

Expired API Key

json
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "API key has expired"
  }
}

Create a new API key in your workspace settings.

Read-Only Key

json
{
  "error": {
    "code": "FORBIDDEN",
    "message": "This API key has READ_ONLY permissions — data modifications are not allowed"
  }
}

You're using a read-only key for a POST, PUT, or DELETE request. Create a key with Read & Write permissions.

Wrong Workspace

json
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "API key is not valid for this workspace"
  }
}

The API key belongs to a different workspace than the one in the URL.

Workspace in Restricted Mode

json
{
  "error": {
    "code": "WORKSPACE_STATUS",
    "message": "Workspace is in read-only mode"
  }
}

The workspace access mode is preventing write operations. An admin needs to change the workspace back to Active mode.

Entity Not Found

json
{
  "error": {
    "code": "NOT_FOUND",
    "message": "Entity not found: Custoer"
  }
}

The entity name in the URL doesn't match any entity in the workspace. Check for typos — entity names are case-sensitive.

Record Not Found

json
{
  "error": {
    "code": "NOT_FOUND",
    "message": "Record not found: 42"
  }
}

No record exists with the given ID.

Unique Constraint Violation

json
{
  "error": {
    "code": "UNIQUE_CONSTRAINT_VIOLATION",
    "message": "A record with email 'alice@example.com' already exists"
  }
}

You're trying to create or update a record with a value that already exists in a unique column. Use a different value or update the existing record instead.

Foreign Key Violation

json
{
  "error": {
    "code": "FOREIGN_KEY_VIOLATION",
    "message": "Referenced customer_id '999' does not exist in customers"
  }
}

The record references a related record that doesn't exist. Make sure the referenced record exists before creating the relationship.

Validation Error

json
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Validation failed: 2 error(s)",
    "details": [
      { "field": "email", "message": "must be a valid email address" },
      { "field": "age", "message": "must be at least 0" }
    ]
  }
}

The request data doesn't pass the entity's column constraints. Each failed field is listed in the details array. See Validation for the full list of constraint types.

SchemaStack Documentation