When interacting with the Gloo AI API, handle errors by checking the HTTP status code and then parsing theDocumentation Index
Fetch the complete documentation index at: https://docs.gloo.com/llms.txt
Use this file to discover all available pages before exploring further.
code or detail field in the response body for precise identification.
Quick Reference
HTTP Status Codes
Full table of every HTTP status returned by active endpoints.
Error Code Reference
Exact error codes from the API with resolution guidance.
Authentication Errors
401 and 403 errors — missing tokens, expired credentials, permission issues.
Rate Limiting
429 responses and how to implement retry logic with exponential backoff.
Endpoint-Specific Errors
Error details for Completions, Ingestion, Content Controls, and Search.
Best Practices
Patterns for reliable error handling across all endpoints.
HTTP Status Codes
| Status Code | Meaning | When You’ll See It |
|---|---|---|
200 OK | Success | The request completed successfully. |
400 Bad Request | Bad Request | Missing required fields, wrong content type, or structurally invalid JSON. |
401 Unauthorized | Unauthorized | Authorization header missing, token expired, or required JWT claims (sub, scope) absent. |
403 Forbidden | Forbidden | Valid token but caller lacks permission for the resource or publisher. |
404 Not Found | Not Found | Requested resource (item, publisher, collection) does not exist or was deleted. |
408 Request Timeout | Request Timeout | Model provider did not respond within the allowed window. Retry with backoff. |
422 Unprocessable Entity | Validation Error | Well-formed JSON that fails semantic validation — invalid enum, out-of-range value, business rule violation. |
429 Too Many Requests | Rate Limited | Exceeded request rate or spending limit for your plan. Retry after X-RateLimit-Reset. |
500 Internal Server Error | Server Error | Unexpected error on the Gloo platform. Retry with backoff. |
502 Bad Gateway | Upstream Error | Returned when a Content Controls vector-store update fails. |
503 Service Unavailable | Service Unavailable | Gloo service or upstream provider temporarily unavailable. Retry with backoff. |
Error Code Reference
| Code | HTTP Status | Description | Resolution |
|---|---|---|---|
unauthorized_missing_authorization | 401 | Authorization header is absent. | Add Authorization: Bearer <token> to all requests. |
forbidden | 403 | Valid token but caller lacks permission for the resource or publisher. | Verify publisher_id belongs to your org; check API credential scopes. |
publisher_not_found | 400 | Publisher ID does not exist. | Verify the publisher_id value in the request. |
publisher_mismatch | 403 | Item does not belong to the specified publisher. | Check that the publisher_id matches the item’s original publisher. |
item_not_found | 404 | Requested item does not exist or was deleted. | Verify item_id or producer_id. Use list endpoints to confirm existence. |
item_publisher_mismatch | 403 | Item does not belong to the specified publisher. | Verify publisher_id and item_id belong to the same publisher. |
too_many_files | 400 | Producer ID is per-file only; multiple files submitted. | Submit one file per producer_id. |
file_read_error | 400 | Uploaded file could not be decoded or read. | Verify the file is valid and not corrupt before uploading. |
missing_producer_ids | 400 | No producer_id values provided. | Include at least one producer_id in the request. |
duplicate_content | 200 result state | Content already ingested. Public response exposes the duplicates array alongside ingesting. | No action needed if re-ingestion is unintentional. To update, delete or patch the existing item. |
validation_error | 422 | One or more fields failed semantic validation. | Inspect the detail array: loc = field path, msg = reason, input = value you sent. |
INVALID_REQUEST | 400 | Request is structurally invalid — missing user message or invalid routing configuration. | Fix the request body; for Completions V2, specify exactly one routing mode (auto_routing, model, or model_family). |
CONTEXT_LENGTH_EXCEEDED | 400 | Input exceeds model’s maximum context window. | Shorten message history, reduce system prompt, or switch to a model with a larger context window. |
PROVIDER_TIMEOUT | 408 | Model provider did not respond in time. | Retry with exponential backoff; consider a different model or routing mode if persistent. |
PROVIDER_CONTENT_FILTER | 422 | Provider moderated the response. | Adjust the request or user-facing workflow; do not retry unchanged. |
too_many_requests | 429 | Request rate limit exceeded. | Wait for the X-RateLimit-Reset header value; implement exponential backoff. See Rate Limits. |
SPENDING_LIMIT_EXCEEDED | 429 | Spending limit reached for your plan. | Check billing limits; retry only after the limit condition is resolved. |
PROVIDER_INFERENCE_ERROR | 500 | Unexpected model inference failure. | Retry with exponential backoff and log trace_id if present in the response. |
PROVIDER_UNAVAILABLE | 503 | Provider or backing service unavailable. | Retry with exponential backoff. |
Common Error Scenarios
Authentication Errors
These errors occur when there is an issue with your bearer token or the permissions associated with your API credentials.401 Unauthorized — Missing or Invalid Token
Returned when theAuthorization header is missing from the request.
403 Forbidden — Insufficient Permissions
Returned when your token is valid, but the caller does not have permission for the requested resource or publisher.For the Ingestion API, a 403 most commonly means the
publisher_id doesn’t belong to your organization, or the item you are referencing does not belong to the specified publisher.Validation Errors (400 / 422)
These errors indicate a problem with the parameters or body of your request.400 Bad Request signals a structurally invalid request, while 422 Unprocessable Entity signals valid JSON that fails field-level validation.
Missing Required Field
Returned when a required body field is absent. Example:model is required when specifying direct model routing for Completions V2.
Invalid Routing Configuration
Completions V2 returns this as400 when more than one — or no — routing mechanism is specified.
Invalid Data Type
Returned when a field receives a value of the wrong type. Example:certainty expects a float.
Resource Not Found (404)
Returned when the requested item does not exist or has been permanently deleted.Publisher not found and invalid collection cases return
400, not 404. See Ingestion and Search & Recommendations for these examples.Duplicate Upload Results
Duplicate Content (Ingestion)
When files are submitted that were already ingested, the API returns200 OK with a duplicates array in the response body — this is not an HTTP error.
Duplicates are returned in the response body, not as a
409 Conflict error.Rate Limiting (429)
Returned when you exceed the request rate limit for your plan.| Header | Description |
|---|---|
X-RateLimit-Limit | Total requests allowed in the current window |
X-RateLimit-Remaining | Requests remaining in the current window |
X-RateLimit-Reset | Unix timestamp when the window resets |
See Rate Limits for exponential backoff pseudocode examples.
Server Errors (5xx)
500 Internal Server Error
An unexpected error occurred on the Gloo platform or during model inference. Retry with exponential backoff.502 Bad Gateway
Returned by Content Controls endpoints when a vector-store update fails in the underlying data store.503 Service Unavailable
The upstream provider or backing service is temporarily unavailable. Retry with exponential backoff.Endpoint-Specific Errors
Completions V2
Completions V2 Reference
POST /ai/v2/chat/completions
auto_routing, model, or model_family per request.
messages array.
messages field is required. An absent messages array returns a validation error.
Grounded Completions
Grounded Completions Reference
POST /ai/v2/chat/completions/grounded
200 OK with "sources_returned": false. Lower certainty toward 0.5 or verify that content has been ingested.
Ingestion
Ingestion V2 Reference
POST /ingestion/v2/files
sub claim (Client ID) and scope: api/access.
Publisher Not Found — 400
duplicates array of a successful 200 OK response, not as an HTTP error. See Duplicate Upload Results.
Content Controls (Data Engine)
Single Item Patch
PATCH /engine/v2/item
Multi-Item Patch
PATCH /engine/v2/items
Delete Items
DELETE /engine/v2/items
Get Item Metadata
GET /engine/v2/items/
Get Item by Producer ID
POST /engine/v2/publisher//items/by-producer
producer_id:
Search & Recommendations
Search
POST /ai/data/v1/search
Recommendations
POST /ai/v1/data/items/recommendations/base
query, empty collection, and invalid limit values return HTTP 403 rather than 422. Don’t treat these as permission errors — they indicate an invalid request body.
Empty query:
limit:
Zero results is not an error — it means no content exceeded the certainty threshold. Lower
certainty toward 0.5 or verify that content has been ingested.Error Handling Best Practices
Log thecode field, not just the status — Status codes tell you the category; the code field tells you exactly what went wrong. Log it in your error handler for precise alerting and debugging.
Only retry 429 and 5xx responses — 4xx errors (except 429) mean your request has a problem that won’t go away on retry. Retrying them wastes quota and delays surfacing the real issue.
Use exponential backoff for retries — Wait (2^attempt) + jitter between retries, up to 5 attempts. See Rate Limits for pseudocode.
Use detail to pinpoint validation failures — For 422 responses, the detail array tells you exactly which field failed: loc is the field path, msg is the reason, and input is the value you sent.
