HTTP Response Codes
Qubictron uses conventional HTTP response codes to indicate the success or failure of an API request.
Always read success and status_code from the response body; do not rely on the HTTP status alone.
| code | status_code | success | description |
|---|---|---|---|
200 | OK | true | Emissions calculated for every leg of the request. |
400 | WRONG_PARAMETERS | false | The request body is malformed or a field is missing, invalid or unknown. message names the first problem, errors lists all of them by field path. Also returned when the router did not recognise a place of a leg. |
401 | INVALID_API_KEY | false | The API key is missing or unknown. The header name must be lowercase x-api-key; other spellings are treated as a missing key. Not counted against the limit. |
403 | API_KEY_ACCESS_DENIED | false | The API key is valid but has no access to the Carbon Emissions API (error: API_KEY_ACCESS_DENIED), or its monthly request limit is used up (error: API_KEY_QUOTA_EXCEEDED). Not counted against the limit. |
404 | NO_AVAILABLE_ROUTES | false | No route of the leg's mode was found between its places; message names the leg. Give the leg's distance_km to calculate it without routing. |
500 | UNEXPECTED_ERROR | false | An unexpected internal server error occurred. Please try again or contact support. |
502 | UPSTREAM_UNAVAILABLE | false | The routing service failed or did not answer in time. Please retry later. |