API reference
Error codes
Compresr error envelope, every HTTP status code the API returns, and how to recover from each.
Every error response uses the same envelope. The HTTP status code is the category; the error.code string is the specific failure mode, safe to switch on in client code.
Error envelope
successbooleanAlways false on error responses.
errorobjectcodestringStable machine-readable error code (e.g. invalid_api_key).
messagestringHuman-readable message safe to log or surface to operators.
400 Bad Request
The request body could not be parsed as JSON, or a required field was missing entirely.
code: invalid_request: body is not valid JSON or doesn't match the expected shape.- Recover by: fixing the request before retrying. Retries with the same body will fail identically.
401 Unauthorized
The X-API-Key header is missing, malformed, revoked, or expired.
code: missing_api_key: noX-API-Keyheader.code: invalid_api_key: header present but the key doesn't exist or has been revoked.code: expired_api_key: the key's expiry timestamp is in the past.- Recover by: issuing a fresh key in the dashboard and updating your secret store. See Authentication for rotation guidance.
403 Forbidden
The key authenticates but lacks access to the requested resource (for example, a feature gated to higher tiers).
code: forbidden: key is valid but not permitted to call this endpoint.- Recover by: upgrading your tier or contacting support. Retrying with the same key returns the same error.
422 Unprocessable Entity
The request was well-formed JSON, but one or more fields failed validation.
code: validation_error: typical causes are emptyquery,target_compression_ratiooutside0to200,inputsarray with more than 100 items, missingcompression_model_name.- Recover by: fixing the field flagged in
error.messageand retrying.
429 Too Many Requests
Your tier's per-minute or per-day quota is exhausted.
code: rate_limit_exceeded: you've hit the request or token budget for your tier.- Response includes a
Retry-Afterheader with seconds to wait. - Recover by: backing off and retrying with exponential delay that respects
Retry-After. See Handling 429 for the canonical pattern. If you hit 429 routinely under normal load, move to a higher tier.
500 Internal Server Error
Unexpected server-side failure. The error is not your fault.
code: internal_error: generic server failure.- Recover by: retrying once with a short delay. If the error persists across multiple requests, check the status page and contact support.
503 Service Unavailable
An upstream dependency is unhealthy and the circuit breaker is open. The API is shedding load deliberately to recover.
code: service_unavailable: upstream compression service circuit open.- Response includes a
Retry-Afterheader. - Recover by: honouring
Retry-After. Do not hammer the endpoint; that's what the circuit is preventing.
Best practices
- Validate inputs client-side before making the request. Most
422errors are catchable in your own code. - Retry only on
429,500, and503. Never retry4xxerrors other than429; the response will be identical. - Use exponential backoff that respects
Retry-Afteras a floor, not a ceiling. - Log
error.code(stable) rather thanerror.message(human-readable, may change).