Skip to content
Using the API

Errors

Error responses in the Lightfield API.

The Lightfield API uses conventional HTTP status codes and returns a JSON body for errors. Use the response type and, when present, the machine-readable code to handle errors in your integration.

All error responses are wrapped in an error object:

FieldTypeDescription
typestringMachine-readable error type (e.g. bad_request, not_found). Use this to branch on the kind of error.
messagestringHuman-readable description of what went wrong.

Example (404):

HTTP/1.1 404 Not Found
Content-Type: application/json
{
"error": {
"type": "not_found",
"message": "No resource found in 'accounts' with the given ID."
}
}

For 400 Bad Request and 422 Unprocessable Content responses, the body can also include:

FieldTypeDescription
codestringFiner-grained code for programmatic handling (see Error codes below). Present on 400 responses.
paramstringOptional. Request location related to the error (e.g. fields.$name, relationships.$owner, Idempotency-Key). Present on 400 and 422 responses.

Example (400):

HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"error": {
"type": "bad_request",
"message": "Unrecognized field 'bogus' for 'accounts'.",
"code": "unknown_field",
"param": "fields.bogus"
}
}

Example (422):

HTTP/1.1 422 Unprocessable Content
Content-Type: application/json
{
"error": {
"type": "unprocessable_content",
"message": "CrmAccount requires name field",
"param": "fields.name"
}
}
StatusTypeWhen it happens
400bad_requestInvalid request (wrong field, relationship, or parameter). Check code and param.
401unauthorizedMissing or invalid API key. Ensure the request includes Authorization: Bearer YOUR_API_KEY.
403forbiddenAPI key is valid but does not have permission for this operation. Check scopes.
404not_foundThe requested resource or entity type does not exist.
409conflictConflict with current state (e.g. duplicate definition, resource locked, concurrent update).
415unsupported_media_typeRequest body is not JSON. Include Content-Type: application/json on POST, PUT, and PATCH requests.
422unprocessable_contentRequest body is valid JSON but business validation failed (e.g. invalid field value). Check param.
429too_many_requestsRate limit exceeded. See Rate limits.
500internal_server_errorServer error. Retry with backoff; contact support if it persists.
503service_unavailableThe service is temporarily unavailable. Retry with backoff.

For 400 Bad Request responses, the code field provides a stable value you can use to handle specific cases:

CodeMeaning
referenced_resource_missingA field references another resource by ID that does not exist. Use param to see which field (e.g. fields.$company).
relationship_entity_missingOne or more IDs in a relationship (e.g. relationships.$owner) do not exist.
relationship_entity_inactiveOne or more IDs in a relationship refer to an inactive (e.g. deleted) entity.
unknown_fieldThe request included a field that is not defined for this object type. Use param to see the field.
unknown_relationshipThe request included a relationship that is not defined for this object type. Use param to see the relationship.
invalid_configurationInvalid field or relationship configuration.
idempotency_key_too_longThe Idempotency-Key header exceeds the maximum length (255 characters).
invalid_typeA field value has the wrong type (e.g. a string where an object is expected). Use param to see the field.
parameter_missingA required request parameter is missing. Use param to see which one.
version_headerThe Lightfield-Version header is missing or invalid.
  • Authentication (401/403) — Verify the API key and that it has the required scopes for the operation.
  • Validation (400/422) — Use code and param to identify which field or relationship to fix. For unknown_field or unknown_relationship, ensure you are using the correct object type and field definitions.
  • Not found (404) — The resource ID may be wrong, or the resource was deleted. For create/update, ensure any referenced IDs (e.g. in relationships) exist and are active.
  • Content type (415) — Ensure the request includes Content-Type: application/json for any request with a body.
  • Conflict (409) — Retry the request with fresh data, or use idempotency for create/update to safely retry.
  • Rate limit (429) — Honor the Retry-After header and implement exponential backoff. See Rate limits.
  • Service unavailable (503) — The server is temporarily overloaded. Retry with exponential backoff.

The official SDKs expose these errors as typed exceptions (e.g. BadRequestError, NotFoundError) with a type and, where applicable, a code and optional param, so you can branch on them in code.