HTTP Response Codes

The departureboard.io API uses the below error codes:

Code Meaning
200 OK: The API Request was successful and returned data.
400 Bad Request: Your request was not valid.

The departureboard.io API performs validation of queries to make sure they make sense and will return a valid response from National Rail. Bad queries made directly to the National Rail API return a generic 500 Internal Server Error response which is difficult to troubleshoot.

By validating requests the departureboard.io API can provide improved error messages to help with troubleshooting, and prevent bad queries from ever reaching National Rail.
401 Unauthorized: Your National Rail API key is wrong or your key has not been whitelisted as detailed in the registration section of the documentation.

You should double check your API Key is valid and has been whitelisted. Newly generated API Keys can take up to 15 minutes to become active.
429 Too Many Requests: You have exceeded the rate limit.

Get in touch to arrange an exception, or slow down your requests.
503 Service Unavailable: The National Rail upstream API is experiencing issues.

This error is returned when the departureboard.io API detects issues with the upstream National Rail API. The departureboard.io API is functioning but cannot return a result as the National Rail API is down.
500 Internal Server Error: There was an unknown error returning the response.

This error is served when an unknown error is encountered returning your response. This is often due to upstream problems with National Rail, for example them returning a bad response or malformed data. In rare circumstances it can be caused by a bad request that was not caught in the departureboard.io validation.