Standard Error Codes & Envelopes
Error response format, error codes, and HTTP status codes of the smallPict API.
Every error response uses the same JSON structure with a machine-readable error code.
Error response format
{ "error": { "code": "QUOTA_EXCEEDED", "message": "Monthly image processing quota limit reached for your plan.", "details": { "bytes_used": 5368709120, "requested_bytes": 2450000, "bytes_limit": 5368709120, "plan": "wp_pro", "upgrade_url": "https://smallpict.app/dashboard/billing", "reset_at": "2026-12-01T00:00:00Z" } }}Error codes
| HTTP Status | ErrorCode Enum | Exception Type | Description |
|---|---|---|---|
| 400 | VALIDATION_FAILED | ValidationError | The request failed validation: a required field is missing, or a value or file type is not accepted. |
| 400 | file_too_large | ValidationError | The image is larger than your plan's per-file limit. details has limit_mb, file_mb, plan and upgrade_url. |
| 401 | UNAUTHORIZED | AuthenticationError | Missing or invalid API key or HMAC-SHA256 signature, or a timestamp more than 300 seconds away from the server's clock ("timestamp drift too large"). |
| 402 | QUOTA_EXCEEDED | QuotaExceededError | Monthly account processing quota exhausted. |
| 402 | OVERAGE_EXCEEDED | QuotaExceededError | Plan overage buffer limit exceeded. |
| 403 | FORBIDDEN | PermissionDeniedError | The API key is revoked, or the account is scheduled for deletion. |
| 403 | feature_restricted | PermissionDeniedError | The requested output is not in your plan, such as avif (alone or in target_formats) on WordPress Free or Starter. |
| 403 | KEY_SCOPE_MISMATCH | PermissionDeniedError | Using a WordPress scoped key (sp_wp_...) on an SDK endpoint or vice versa. |
| 404 | NOT_FOUND | NotFoundError | The requested resource or conversion job_id does not exist. |
| 429 | RATE_LIMIT_EXCEEDED | RateLimitError | Too many requests in a short duration. Follow the Retry-After header. |
| 500 | INTERNAL_ERROR | ServerError | An unhandled error occurred on the server. Details are logged securely. |
QUOTA_EXCEEDED and OVERAGE_EXCEEDED carry details.reset_at (RFC 3339), the moment the quota resets, and details.in_flight_bytes when images still being processed were counted. Older API versions answered file_too_large and feature_restricted with HTTP 500; read error.code from the body rather than relying on the status alone.
Error handling in the SDKs
The SDKs turn these errors into typed exceptions for each language and retry 429 and 5xx responses with exponential backoff and jitter.
Capacity, mode and folder errors
Codes for storage, the unpaid-account cycle, compression modes and folders. Capacity errors carry details.upgrade_url, a link to the dashboard page where you add what is missing; show it, never follow it automatically.
| Status | Code | SDK error | Meaning |
|---|---|---|---|
| 400 | invalid_mode | ValidationError | Unknown mode. |
| 400 | invalid_folder | ValidationError | The folder value is malformed. |
| 402 | storage_quota_exceeded | QuotaExceededError | Storage is full: new files are refused, stored files keep being served. |
| 402 | account_read_only | QuotaExceededError | The subscription stopped being paid: files are read-only until it is paid (details.delete_after). |
| 403 | mode_not_in_plan | PermissionDeniedError | The mode is not in your plan (details.allowed_modes). |
| 429 | purge_rate_limited | RateLimitError | Too many folder or all-files purges in the last hour. Not retried automatically. |