Skip to content
StatusSupportDashboard
Using the Data API

Errors

HTTP error codes, request failure states, and per-object failures in the Data API.

The Data API reports errors in three places:

Where When How you see it
HTTP response The request was rejected before it was accepted A 4xx or 5xx status code with a JSON error body
Request status An accepted request could not be processed status: "failed" on the request, with an optional error_summary
Per-object result One object in an accepted request could not be reviewed A workflow.failed webhook, and output: null for that object in the request results

Ingestion is asynchronous, so a 200 from POST /v1/data/{namespace} means the data was accepted, not that it was processed. Watch the request status or your webhooks for the outcome.

Error responses are JSON objects with a message. Validation errors also list the fields that failed:

{
"message": "invalid request body",
"details": "data[1].id: Invalid input: expected string, received undefined",
"issues": [
{
"path": "data[1].id",
"message": "Invalid input: expected string, received undefined"
}
]
}
  • message: A short description of the error.
  • issues: Present on validation errors. One entry per invalid field, with the path of the field in the request body and a message saying what is wrong with it. In the example above, the second object in data has no id.
  • details: Present on validation errors. The same issues as a single line of text, for logging.

Branch on the HTTP status code. Messages are written for people and can change.

Status Meaning Retry?
400 The request is invalid. See the messages below. No. Fix the request.
401 The Authorization header is missing. No. Send your API key.
403 The API key or access token is invalid, expired, or not formatted as Bearer <api_key>. No. Check the key.
404 The request ID or namespace was not found. No. See Not found.
409 A namespace settings update conflicts with the stored configuration. Only after re-reading the settings.
413 The request body is too large, or a request result is too large to return inline. No. See Too large.
429 You sent requests faster than your rate limit allows. Yes, with exponential backoff.
500 SafetyKit failed to handle the request. Yes, with exponential backoff.
502, 503, 504 SafetyKit was temporarily unavailable or the request timed out. Yes, with exponential backoff.

A 5xx or 429 on an ingest call means the data was not accepted. Send it again; reusing the same object id makes the retry safe because it updates the same object.

message Returned by Cause
request body is required Add data, upload URL, settings The request has no body. The upload URL endpoint needs at least {}.
request body must be valid JSON Add data, upload URL, settings The body could not be parsed as JSON.
invalid request body Add data, upload URL, settings The body does not match the expected shape. issues lists the failing fields. The most common cause is an object without a non-empty string id, or a missing data field.
namespace is required All The namespace is missing from the path.
namespace and requestId are required Request status, download URL The namespace or request ID is missing from the path.

Both are returned before your request reaches the Data API, so the body carries only a generic message.

  • 401: No Authorization header was sent.
  • 403: A header was sent, but the key was rejected. Check that the value is Bearer <api_key>, that the key belongs to the right environment, and that a short-lived access token has not expired.
message Returned by Cause
Request not found Request status, download URL The request ID does not exist in this namespace for your team. Check that the namespace in the path matches the one you ingested into. Requests are retained for 30 days.
namespace not found Get namespace settings The namespace has not been created yet. A namespace is created the first time you send data to it.

Returned only by PUT /v1/data/{namespace}/settings.

message Cause
previous_version does not match the stored configuration version; GET the namespace settings and retry with the current version The settings changed since you read them. Fetch them again and reapply your change.
namespace configuration is managed by SafetyKit; contact SafetyKit to change its schema or settings SafetyKit manages this namespace’s configuration, so it cannot be changed by the API.

Your team has a requests-per-second limit shared across SafetyKit API endpoints. When you exceed it, requests are rejected with 429 and are not processed. Retry with exponential backoff and jitter. For large backfills, use an upload URL rather than many individual requests. Contact support@safetykit.com if you need a higher limit.

message Returned by Cause
failed to store request Add data SafetyKit could not accept the data. Nothing was queued. Retry.
failed to generate upload url Upload URL SafetyKit could not create the upload URL. Retry.
A message ending in Please contact us if this error persists. Request status, download URL The stored request record or its output could not be read. Retry, and contact support with the request ID if it continues.

Other 5xx responses carry a generic message. All of them are safe to retry.

After a request is accepted, GET /v1/data/{namespace}/requests/{requestId} reports its status:

status Meaning Terminal?
queued Accepted and waiting to be processed. No
uploading An upload URL was issued and SafetyKit is waiting for the file. Upload URLs expire after 12 hours. No
ingesting Being processed, or paused while SafetyKit recovers from an internal failure. No
succeeded Processing finished. Individual objects may still have failed. Yes
failed The request could not be processed. Yes

Two behaviors are worth planning for:

  • A succeeded request can contain failed objects. A failed object has "output": null in the request results. Check each object rather than relying on the request status alone.
  • SafetyKit retries internal failures for you. If processing fails because of a problem on our side, the request stays in ingesting while we recover it, rather than moving to failed. You do not need to resubmit.

Requests recovering from an internal failure

Section titled “Requests recovering from an internal failure”

A request in recovery looks the same as one still being processed: status is ingesting, data is empty, and there is no error_summary. A failure in one object holds the whole request in ingesting, including objects that already finished.

  • Objects that finished before the failure may already have sent their workflow.succeeded webhooks.
  • When the request is recovered, only the unfinished objects are processed again. You will not receive a second webhook for objects that already completed.
  • The request then finishes as succeeded with results for every object.

Nothing in the response tells you a request is in recovery, so alert on requests that stay in ingesting well past your normal processing time and contact support@safetykit.com with the request_id. Sending smaller requests limits how many results one failure can delay.

A failed request has no output: data is empty, and the download URL endpoint returns null for data_url, data_count, and data_expires_at. Send the objects again in a new request.

Because internal failures are recovered by default, failed is rare. If you would rather have internal failures move the request to failed immediately, with a workflow.failed webhook for each affected object, so that your system can resubmit on its own schedule, contact support@safetykit.com to change this for a namespace.

Requests created with an upload URL can also fail before processing starts:

  • The PUT to upload_url is rejected. Object storage returns 403 if the URL has expired or the Content-Type header is not application/json. Request a new upload URL and upload again.
  • The file cannot be parsed. The file is validated as a whole before any object is processed. One line that is not valid JSON, has no non-empty string id, or has a value that does not match a number or datetime schema field stops the entire file. Nothing is ingested and the request does not move past uploading.

If a request is still uploading several minutes after your PUT returned 200, treat the file as rejected. Check that it has one JSON object per line (not a JSON array or pretty-printed JSON), fix it, and upload it to a new upload URL.

When error details are enabled for your namespace, terminal responses from the request status and download URL endpoints include an error_summary string describing what failed:

{
"namespace": "products",
"request_id": "req_01h2m7qdmdjckc30e1mnq6xqfd",
"status": "succeeded",
"error_summary": "Some requests failed: 2 of 100 (2.0%). Sample failing ids: product_123, product_456. Failure categories: image_mirroring_error (2). Image mirroring error: The workflow could not fetch or mirror one or more image URLs. Please check that the image URLs are valid, public, and reachable, then retry the request.",
"data": []
}

The summary reports how many objects failed, up to five sample IDs, and one or more failure categories:

Category Meaning What to do
image_mirroring_error SafetyKit could not fetch one or more media URLs. Check that the URLs are valid, public, and reachable, then resubmit.
input_error The submitted data failed validation or could not be prepared for review. Fix the payload and resubmit.
llm_error Model processing failed. Resubmit.
request_timeout Processing timed out or was throttled. Resubmit.
output_error The result could not be saved or indexed. Resubmit.
processing_error Processing failed for another reason, often an invalid value in the payload. Check the payload, then resubmit.

error_summary is written for people. Log it and show it to an operator, but do not parse it. It is off by default; contact support@safetykit.com to enable it for a namespace.

When an object cannot be reviewed, SafetyKit sends a workflow.failed webhook for it instead of workflow.succeeded. The error field says why. See that page for the list of messages.

In the request results, a failed object has "output": null. This is different from an object with an empty labels array, which was reviewed and had no labels applied. The request results do not include the reason for a failure; that is only in the workflow.failed webhook.

Most per-object failures come from media that could not be downloaded. To avoid them, keep media URLs publicly retrievable at processing time, and make sure signed URLs do not expire before SafetyKit fetches them.

Not every media failure fails the object:

  • If an object has several images and at least one downloads, the object is reviewed with the images that worked.
  • If a video cannot be downloaded or decoded, the object fails.
  • If a required media field has no usable media, the object fails.

To retry a failed object, send it again with the same id.

  • Retry 429 and 5xx responses with exponential backoff. Do not retry other 4xx responses without changing the request.
  • Store the requestId from every ingest call. It identifies the request in status calls, webhooks, and support conversations.
  • Treat succeeded and failed as the only terminal request statuses, and alert on requests that stay in ingesting or uploading longer than you expect.
  • Handle workflow.failed alongside workflow.succeeded, and check for "output": null when reading request results.
  • Include the request_id and object id when contacting support@safetykit.com.