Error response body
Error responses carry a JSON body. Parse it rather than the status text. You should also log theX-Trace-ID response header, as it will help our team debug if you need to raise a support ticket.
Example error response
Failures that occur before a request reaches the API, in DeepL’s edge infrastructure, use a nested shape instead, with the message under an
error object:
Example infrastructure error response
body.message ?? body.error?.message covers every error the API can return, and keeps your client from crashing on a gateway error during an incident.
Which errors to retry
Details on the errors you are most likely to hit:
- HTTP 429: too many requests. You may receive this when sending many API requests in a short period of time. Resend the request after a delay, using retries with exponential backoff. This is implemented in all of the official, DeepL-supported client libraries.
- HTTP 456: quota exceeded. If you’re a Free API user, you’ll receive this error when the monthly 500,000 character limit of your subscription has been reached. You can consider upgrading your subscription if you need more character volume. If you’re a Pro API user, you’ll receive this error when your Cost Control limit has been reached, and you can increase or remove your Cost Control limit if you need to continue translating. You can also use the usage endpoint to find out your currently used and available quota.
- HTTP 500: internal server error. You’ll receive this if there are temporary errors in DeepL services. Resend the request after a delay, using retries with exponential backoff. Check the API Status Page for current service availability and incident information.
Throttling your client
The service dynamically adjusts to the load on the system, so there is no fixed request-per-second figure to code against. Design your client to find the limit rather than to assume one:- Retry
429and 5xx responses with exponential backoff and jitter. Honor theRetry-Afterheader when a response includes one, in preference to your own backoff interval - Cap the number of requests you have in flight at once, and lower that cap while you are receiving
429responses - Batch multiple strings into a single translate request instead of sending one request per string, staying inside the request size limit
- Treat
456as a stop condition, not a retry condition, and poll the usage endpoint to see how close an account is to its quota before you get there