Error Codes
Complete error code reference for the Jonga OCR API. All errors follow a consistent response format with machine-readable error codes and human-readable messages.
Error Response Format
All error responses use the same envelope structure. The success field is always false, and the error object contains a machine-readable code and a human-readable message.
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "A human-readable description of what went wrong"
}
}Error Codes Reference
UNAUTHORIZED401Missing or invalid API tokenNo or invalid Bearer token in Authorization headerTOKEN_DISABLED403This API token has been revokedToken isActive is set to falseTOKEN_SCOPE_DENIED403Token not authorized for this endpointToken scopes don't include the requested document typeTOKEN_EXPIRED403This API token has expiredToken is past its expiresAt dateIMAGE_MISSING400No image providedNo image field in multipart or JSON bodyIMAGE_TOO_LARGE400Image exceeds 4MB limitUploaded file is larger than 4MBIMAGE_INVALID_TYPE400Invalid image typeFile is not JPEG, PNG, or WebPIMAGE_UNREADABLE422Document could not be readImage is too blurry, dark, or unclear to extract dataWRONG_DOCUMENT_TYPE422Image doesn't match expected document typeImage sent to wrong endpoint (e.g. passport to ID endpoint)EXTRACTION_FAILED500Failed to extract document dataAI model response could not be parsedRATE_LIMITED429Too many requestsRate limit exceeded for this tokenVALIDATION_ERROR400Invalid request dataRequest body fails schema validationINTERNAL_ERROR500An unexpected error occurredUnhandled server errorUNAUTHORIZED401Missing or invalid API token
No or invalid Bearer token in Authorization header
TOKEN_DISABLED403This API token has been revoked
Token isActive is set to false
TOKEN_SCOPE_DENIED403Token not authorized for this endpoint
Token scopes don't include the requested document type
TOKEN_EXPIRED403This API token has expired
Token is past its expiresAt date
IMAGE_MISSING400No image provided
No image field in multipart or JSON body
IMAGE_TOO_LARGE400Image exceeds 4MB limit
Uploaded file is larger than 4MB
IMAGE_INVALID_TYPE400Invalid image type
File is not JPEG, PNG, or WebP
IMAGE_UNREADABLE422Document could not be read
Image is too blurry, dark, or unclear to extract data
WRONG_DOCUMENT_TYPE422Image doesn't match expected document type
Image sent to wrong endpoint (e.g. passport to ID endpoint)
EXTRACTION_FAILED500Failed to extract document data
AI model response could not be parsed
RATE_LIMITED429Too many requests
Rate limit exceeded for this token
VALIDATION_ERROR400Invalid request data
Request body fails schema validation
INTERNAL_ERROR500An unexpected error occurred
Unhandled server error
Troubleshooting
UNAUTHORIZEDMake sure you include the Authorization header with the Bearer scheme.
curl -X POST https://your-domain.vercel.app/api/v1/ocr/sa-id-smart-front \
-H "Authorization: Bearer jonga_YOUR_TOKEN" \
-F "image=@./id-front.jpg"IMAGE_MISSINGEnsure the image is sent either as a multipart form field named image or as a base64 string in the JSON body.
# The field name must be "image"
curl -X POST https://your-domain.vercel.app/api/v1/ocr/sa-id-smart-front \
-H "Authorization: Bearer jonga_YOUR_TOKEN" \
-F "image=@./document.jpg"IMAGE_TOO_LARGEImages must be under 4MB. Resize or compress the image before uploading. JPEG at 80% quality typically produces good results.
# Resize and compress before uploading
convert input.jpg -resize 1500x1500 -quality 80 output.jpgWRONG_DOCUMENT_TYPEMake sure the image matches the endpoint you are calling. For example, do not send a passport image to the /ocr/sa-id-smart-front endpoint.
# Passport image → use the passport endpoint
curl -X POST https://your-domain.vercel.app/api/v1/ocr/passport \
-H "Authorization: Bearer jonga_YOUR_TOKEN" \
-F "image=@./passport.jpg"
# Smart ID front → use the smart ID front endpoint
curl -X POST https://your-domain.vercel.app/api/v1/ocr/sa-id-smart-front \
-H "Authorization: Bearer jonga_YOUR_TOKEN" \
-F "image=@./id-front.jpg"RATE_LIMITEDYou have exceeded the rate limit for your token. Check the X-RateLimit-Reset header to know when you can retry.
# Check remaining requests from response headers
# X-RateLimit-Limit: 100
# X-RateLimit-Remaining: 0
# X-RateLimit-Reset: 1712345678
# Wait until the reset timestamp before retrying