Skip to content

Error Codes

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

json
{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable description of the error"
  }
}

The code field is stable and safe to match against in your application logic. The message field may change over time and is intended for logging and debugging.

Error Code Reference

CodeHTTP StatusDescriptionRetryableResolution
UNAUTHORIZED401Missing, invalid, or expired authentication tokenNoCheck your API key is valid and not expired
KEY_EXPIRED401API key has passed its expiration dateNoCreate a new API key in the dashboard or via the API
FORBIDDEN403Authenticated but not authorized for this resourceNoYou can only access your own resources
NOT_FOUND404Requested resource does not existNoVerify the resource ID is correct
VALIDATION_ERROR400Request body failed schema validationNoCheck required fields and data types match the schema
INVALID_MIME_TYPE400Uploaded file has an unsupported MIME typeNoUse a supported file type (PDF or DOCX)
FILE_TOO_LARGE400Uploaded file exceeds the 10 MB size limitNoReduce file size or split into smaller documents
MAX_KEYS_REACHED400Maximum of 10 active API keys reachedNoRevoke unused keys before creating new ones
USAGE_LIMIT_EXCEEDED429Monthly extraction limit reachedNoUpgrade your plan or wait for the next billing period
INTERNAL_ERROR500Unexpected server errorYesRetry with exponential backoff. If persistent, contact support
NOT_CONFIGURED501Required server-side service is not configuredNoContact support -- this indicates a server configuration issue
EXTRACTION_FAILED502AI extraction processing failedYesRetry -- may be a transient issue. Check that the PDF is valid and readable
EXTRACTION_PARSE_ERROR502AI returned a response that could not be parsed as JSONYesRetry -- the AI may produce valid output on a subsequent attempt

Retryable Errors

Only the following error codes should be retried:

  • INTERNAL_ERROR -- An unexpected failure on the server side.
  • EXTRACTION_FAILED -- The AI extraction process failed, often due to transient issues.
  • EXTRACTION_PARSE_ERROR -- The AI returned malformed output that could not be parsed.

When retrying, use exponential backoff starting at 1 second, with a maximum of 3 retries:

AttemptDelay
1st retry1 second
2nd retry2 seconds
3rd retry4 seconds

If the request still fails after 3 retries, log the error and surface it to the user or your monitoring system.

For a complete guide on implementing retry logic, see Error Handling.

HTTP Status Code Summary

StatusMeaning
200Success -- the request completed successfully
400Bad Request -- validation error, invalid file type, file too large, or key limit reached
401Unauthorized -- authentication failed (missing, invalid, or expired token)
403Forbidden -- authenticated but not authorized for the requested resource
404Not Found -- the requested resource does not exist
429Too Many Requests -- monthly extraction usage limit exceeded
500Internal Server Error -- unexpected failure on the server side
501Not Implemented -- a required server-side service is not configured
502Bad Gateway -- AI extraction or parsing failed

DocMap API Documentation