Modaltrans uses conventional HTTP response codes to indicate the success or failure of an API request. In general:Codes in the 2xx range indicate success.
4xx errors indicate client-side issues where the request made by the client is incorrect or cannot be fulfilled by the server. These errors suggest that the problem lies with the client’s request, such as incorrect syntax, invalid authentication, or lack of necessary permissions.
Codes in the 5xx range indicate an error with Modaltrans’ servers.
Error Responses
When a request fails, the API returns an error response in JSON format. Depending on the type of error, the response has one of two structures.Validation errors (422) return an errors object that lists the error messages for each field that failed validation:{
"errors": {
"field_name": [
"error_message"
]
}
}
Other errors, such as 400, 403, and 404, return a single error message. Some of them, such as 404, also return a request_id, which you can quote when you contact support:{
"error": "error_message",
"request_id": "6f1c3e2a-8b4d-4f0e-9a7c-2d5b1e9f3a10"
}
Some endpoints return a more detailed error structure. The error responses of each endpoint are documented on its own page. Where a translation is available, error messages are returned in the language set for your API user; 404 messages are always in English.Rate limits#
To keep the API fast and reliable for everyone, the number of requests you can send is limited:| Requests | Limit | Counted per |
|---|
| All endpoints except login, sent with a valid token | 30 requests per 10 seconds and 300 requests per 3 minutes | API user |
Both per-user limits apply at the same time: a request is rejected if either of them has been reached. All requests made with the same API user count towards the same limits, whichever endpoint they call and whichever of your systems sends them.When a limit is reached, the API returns 429 Too Many Requests. The response tells you which limit was reached and how long to wait before sending the next request; see the 429 tab below.Error codes#
This section provides an overview of common error codes you might encounter when using the API. For each error code listed, you'll find its probable cause and suggested solutions.422 - Unprocessable Entity
500 - Internal Server Error
503 - Service Unavailable
Cause: The request contains a missing or invalid parameter, or its body is not valid JSON. For example, a required query parameter is not sent, or a parameter has a value that the endpoint does not accept.
Check the error message in the response; it tells you which parameter is missing or invalid.
Ensure that all parameters and fields in the request are of the correct data types and values as specified in the API documentation.
Modified at 2026-11-30 10:38:24