Skip to main content

Error Handling

The API returns 2xx codes for all successful responses, and 4xx and 5xx codes for all errors.

We always try to return the most specific HTTP status code for an error. When a relevant status code is not available, we will return 400 Bad Request or 500 Internal Server Error.

info

In most cases, the API payload contains all the information you need to fix the error, so make sure to read it carefully!

The API payload for errors is in a consistent format (note, however, that doc_url and errors are not always present):

{
"code": "malformed_request",
"message": "The request is malformed. Please check the request parameters.",
"doc_url": "https://docs.relaywireless.com/api/relay-api",
"errors": [
{
"param": "hotspot_key",
"error": "cannot be blank"
}
]
}

Error Codes

Here are all the possible error codes the API can return:

Error CodeHTTP StatusDescriptionHow to ResolveNotes
authentication_required401 UnauthorizedThis API endpoint requires authenticationProvide a valid API key in the Authorization header
malformed_request400 Bad RequestThe request is malformed or has invalid parametersCheck the request parameters and fix any validation errorsIncludes errors array with specific parameter validation failures
rate_limit_exceeded429 Too Many RequestsYou have been rate limitedWait before making additional requests, implement exponential backoff
usage_limit_exceeded402 Payment RequiredYou have exhausted your monthly API usage limitWait until your usage resets or upgrade your plan