Skip to main content

API Errors

When an API request fails, all LightOn API returns a JSON error response with a consistent structure. Every error includes a machine-readable error code your application can use for programmatic handling, and a human-readable detail message for debugging.

Error Response Format

All /api/v3/ error responses share this envelope:

Validation errors (422)

Requests that fail field-level validation return 422 Unprocessable Entity with an additional fields key mapping each invalid field to its errors:
Each entry in fields is an array of {error, detail} objects. A single field can have multiple errors. The error value is a field error code your application can map to form field states.

Batch error responses

Dedicated batch endpoints (e.g., POST /api/v3/content-types/batch, POST /api/v3/files/{id}/facets/batch) execute multiple actions in one request. When a batch request fails, the error response includes an index field — the 0-based position of the action that caused the failure:
All error types (400, 403, 404, 422) include index when triggered inside a batch. Single-action requests never include this field. Replay safety: actions before the failing index are committed but their results are not returned. All action verbs are idempotent — re-send the entire batch after fixing the failing action to complete it.

HTTP Status Codes


Error Codes

bad_request

Status: 400 The request is structurally valid JSON but violates a domain rule. The detail message explains the specific constraint.
Common causes:
  • Invalid parameter combination
  • Unsupported value for a domain-specific field
  • Operation not applicable to the current resource state

unauthorized

Status: 401 Authentication credentials were not provided or are invalid.
Include a valid API key in the Authorization: Bearer <key> header, or authenticate via session cookie.

email_verification_required

Status: 403 Your email address has not been verified. Some operations require a verified email.
Check your inbox for a verification email, or request a new one from your account settings.

insufficient_permissions

Status: 403 You are authenticated but your role does not grant access to this operation.
Contact your workspace or company administrator to request the required permission.

not_found

Status: 404 The requested resource does not exist, or you do not have access to it. For security, the API does not distinguish between “does not exist” and “not accessible.”
Verify the resource ID or path. If the resource was recently created, ensure you have the appropriate workspace membership.

conflict

Status: 409 A resource with the same unique identifier (name, path, etc.) already exists.
Choose a different name, or retrieve the existing resource.

payload_too_large

Status: 413 The uploaded file exceeds the endpoint’s size limit. The detail field reports the actual size and the applicable limit.
Limits depend on the endpoint and mode: 20 MB for synchronous Parse, Extract, and Preview, 100 MB for asynchronous Parse and Extract. Split the document, or switch to async mode.

content_filtered

Status: 422 The model refused to generate a response, typically because a safety filter was triggered.
Rephrase your query. This is not a rate limit — the model determined the content was not appropriate to answer.

context_length_exceeded

Status: 422 The combined query and retrieved context exceed the model’s maximum context window.
Reduce the number of documents in scope (use workspace_id, tag_id, or file_id filters), or shorten your query.

validation_error

Status: 422 The request body is valid JSON, but one or more fields failed validation. Check the fields key for per-field error details.
See Field Error Codes for the vocabulary of field-level error values.

too_many_requests

Status: 429 You have exceeded the rate limit for this endpoint. Wait before retrying.

internal_server_error

Status: 500 An unexpected error occurred on the server. This is not caused by your request.
If the error persists, contact support with the timestamp and endpoint.

model_unavailable

Status: 502 / 503 The requested AI model is not reachable or not currently deployed.
Retry after a short delay. If using a specific model name, verify it is supported via the models endpoint.

model_timeout

Status: 504 The AI model did not respond within the allowed time.
Consider reducing the complexity of your request (shorter query, fewer documents in scope).

Domain Error Codes

Some endpoints return domain-specific error codes for fine-grained error handling. Each code links directly from the doc_url in the error response.

Extract

extraction_failed

Status: 500 The extraction pipeline failed unexpectedly. Retry the request. If the error persists, contact support.

extraction_timeout

Status: 504 Extraction did not complete within the allowed time. Try extracting fewer pages at a time.

extraction_upstream_error

Status: 502 An upstream service used during extraction returned an error. Retry after a short delay.

invalid_page

Status: 400 The page specification is malformed. Use integer page numbers or valid ranges.

page_out_of_range

Status: 400 The requested page number is outside the document’s actual page range. Check the document’s page count first.

document_file_not_found

Status: 404 The document referenced by file_id exists, but its stored file could not be found. The document may still be ingesting, or its underlying file was removed. Re-upload the document.

Facets

attribute_name_conflict

Status: 400 Attribute name is already defined on another node in the same content type tree. Attribute names must be unique across the entire tree (root to leaves).

attribute_name_reserved

Status: 400 Attribute name collides with a system-reserved name (e.g. id, path, type). Choose a different name.

attribute_type_immutable

Status: 400 Cannot change an attribute’s type after creation. To change the type, delete the attribute with undefine_attribute and recreate it with the new type.

attribute_value_invalid

Status: 400 The value does not match the attribute’s type or allowed choices. For select attributes, the value must be one of the defined choices. For multi-select, it must be an array of valid choices.

content_type_depth_exceeded

Status: 400 Tree nesting exceeds the maximum allowed depth of 4 levels (e.g. legal:contract:nda:mutual is depth 4). Restructure your taxonomy to stay within this limit.

content_type_not_assigned

Status: 404 The content type is not assigned to this document. Classify the document first with the classify action.

content_type_not_found

Status: 404 Content type path does not exist for your company. Verify available paths with GET /api/v3/content-types. If you need to create it, use the adopt or define_content_type action.

content_type_sibling_conflict

Status: 400 The document already has a content type from the same tree root. A document can hold at most one classification per tree. Unclassify the existing one first, then classify with the new path.

content_type_unknown

Status: 400 Content type code is not recognized. Verify available content types with GET /api/v3/content-types/seed/templates.

Files

upload_session_expired

Status: 400 The upload session has expired. Create a new upload session and retry.

upload_session_not_found

Status: 404 The upload session ID does not exist. Verify the session ID or create a new one.

STORAGE_LIMIT_REACHED

Status: 400 The upload would exceed your company’s custom workspace storage quota. The detail field reports the limit and your current usage. Delete stale documents, or ask your company admin to request a quota increase.

UPLOADS_DISABLED

Status: 400 Uploads are disabled for the custom workspace because its storage limit is set to 0 MB. Ask your company admin to request a quota increase.

Parse

ambiguous_input

Status: 400 Both a file upload and a document URL were provided in the same request. Provide one or the other, not both.

file_rendering_failed

Status: 500 The file could not be rendered to images before OCR processing. The file may be corrupted or in an unsupported variant.

invalid_model

Status: 400 The requested vision-language model is not available. Check supported models via the models endpoint.

invalid_page_range

Status: 400 Page range is malformed or out of bounds. Ensure start page is less than end page and both are within the document’s page count.

max_pages_exceeded

Status: 400 | Also: /extract The document exceeds the maximum page count allowed for this operation. Process the document in smaller page ranges.

max_pages_per_request_exceeded

Status: 400 Too many pages requested in a single OCR call. Split into smaller page ranges.

missing_input

Status: 400 Neither a file upload nor a document URL was provided. Provide one of them.

no_file

Status: 400 The file upload field is empty or missing. Attach a file to the request.

ocr_concurrent_limit

Status: 429 Too many concurrent OCR requests are running. Wait and retry after a short delay.

unsupported_file_format

Status: 400 The file type is not supported for parsing. Check supported file types in the API documentation.

vlm_error

Status: 502 The vision-language model returned an error while processing the document. Retry after a short delay.

vlm_unavailable

Status: 503 The vision-language model is not reachable or not currently deployed. Retry after a short delay.

Preview

unsupported_format

Status: 400 The document’s format cannot be rendered as a PDF preview. Supported types are .pdf, .png, .jpg, .jpeg, .pptx, .ppt, .odp, .docx, .odt, .doc, .html, and .xhtml.

search_backend_unavailable

Status: 500 The search backend is temporarily unreachable. Retry after a short delay; if the error persists, contact support.

Workspaces

datasource_connection_failed

Status: 400 Could not connect to the external data source with the provided credentials. Verify your credentials and network access, then retry.

googledrive_folder_inaccessible

Status: 400 The Google Drive folder cannot be accessed with the provided service account. Verify that the service account has read access to the folder.

sharepoint_site_not_found

Status: 400 The SharePoint site does not exist or is not accessible with the provided credentials. Verify the site_id or site_name and tenant configuration.

unknown_provider

Status: 400 The datasource type is not recognized. Supported types: googledrive, sharepoint, servicenow, webscrapper.

workspace_already_synced

Status: 400 The workspace is already connected to a datasource. A workspace can only have one datasource.

workspace_has_datasource

Status: 409 The workspace already has an active datasource import running.

workspace_has_documents

Status: 400 Cannot convert to a synced workspace because it already contains manually uploaded documents. Remove existing documents first or create a new workspace.

Field Error Codes

When you receive a 422 response, each entry in the fields dict contains an error code from this vocabulary:

Handling field errors in your application