All APIs on this portal are served through one API gateway at https://api.apilayer.net. An error can come from the gateway, before your request reaches the API, or from the API itself. This page explains both and links to the full error list for each API.
Gateway errors
The gateway checks your access key and the request path first. Its errors have a short body with a message and a request_id.
| HTTP status | When it happens | Message |
|---|---|---|
| 401 | The request has no access_key | No API key found in request |
| 401 | The access_key is not valid | Unauthorized |
| 404 | The API or path is not available | no Route matched with those values |
Example response:
{
"message": "No API key found in request",
"request_id": "b94864679ba1d8011c5de31e3e12f938"
}Include the request_id when you contact support about a failed request.
API error formats
Once a request passes the gateway, each API returns errors in one of two formats.
Classic format
Used by Coinlayer, Exchange Rate API, IPstack, Mailboxlayer, Numverify, PDFLayer, Scrapestack, Screenshotlayer, Serpstack, Userstack, VATLayer and Weatherstack. The code is a number, type is a short name and info describes the problem.
Example response:
{
"success": false,
"error": {
"code": 210,
"type": "no_phone_number_provided",
"info": "Please specify a phone number. [Example: 14158586273]"
}
}Always check the success field. Depending on the API, these errors are returned with HTTP 200 or with a 4xx status code.
Validation format
Used by Aviationstack, Countrylayer, Marketstack, Mediastack and Positionstack. The code is a short text value. For invalid parameters, context lists each parameter that failed.
Example response:
{
"error": {
"code": "validation_error",
"message": "Request failed with validation error",
"context": {
"iataCode": [
{
"key": "iataCode",
"message": "The iataCode parameter is required"
}
]
}
}
}These errors are returned with a 4xx status code, for example 400, 403 or 422.
Full error lists by API
Each API lists its own error codes in its Getting Started guide.
| API | Error format | Full list |
|---|---|---|
| Aviationstack | Validation | Aviationstack Getting Started |
| Coinlayer | Classic | Coinlayer Getting Started |
| Countrylayer | Validation | Countrylayer Getting Started |
| Exchange Rate API | Classic | Exchange Rate API Getting Started |
| IPstack | Classic | IPstack Getting Started |
| Mailboxlayer | Classic | Mailboxlayer Getting Started |
| Marketstack | Validation | Marketstack Getting Started |
| Mediastack | Validation | Mediastack Getting Started |
| Numverify | Classic | Numverify Getting Started |
| PDFLayer | Classic | PDFLayer Getting Started |
| Positionstack | Validation | Positionstack Getting Started |
| Scrapestack | Classic | Scrapestack Getting Started |
| Screenshotlayer | Classic | Screenshotlayer Getting Started |
| Serpstack | Classic | Serpstack Getting Started |
| Userstack | Classic | Userstack Getting Started |
| VATLayer | Classic | VATLayer Getting Started |
| Weatherstack | Classic | Weatherstack Getting Started |