Error Response

Error Structure

The json body returned upon error contains the following attributes:

  • http_status - The http status returned with the error.
  • error_code - API error code, they are documented in the page Error Codes.
  • description - Summary of the error.
  • documentation_link - Link to this documentation.
  • additional_info - Additional information about the error. This only has data for error codes 2, 3, 13, 15, 16, 17 and 19, examples for such errors are provided bellow.

Examples

Error on Invalid JSON Content

{
  "http_status": 422,
  "error_code": 2,
  "description": "Invalid request json",
  "documentation_link": "https://api.traveltimeapp.com/#Travel-Time-API-documentation-Error-codes",
  "additional_info": {
    "obj.searches[0].transportation.type": [
      "Invalid value, possible values - [cycling, driving, driving+train, public_transport, walking, coach, bus, train]"
    ]
  }
}

Error on Invalid JSON Syntax

{
  "http_status": 400,
  "error_code": 3,
  "description": "Failed to parse json - syntax error",
  "documentation_link": "https://api.traveltimeapp.com/#Travel-Time-API-documentation-Error-codes",
  "additional_info": {
    "syntax_errors": [
      "Unexpected character ('f' (code 102)): was expecting comma to separate OBJECT entries"
    ]
  }
}

Error when fare data is unavailable

additional_info.search_id contains a single search id that caused the error.

{
  "http_status": 422,
  "error_code": 13,
  "description": "We do not have the fare data for this region. Fares are only supported in the UK.",
  "documentation_link": "https://api.traveltimeapp.com/#Travel-Time-API-documentation-Error-codes",
  "additional_info": {
    "search_id": [
      "my search id"
    ]
  }
}

Error when public transport data is not available.

additional_info.search_id contains a single search id that caused the error.

{
  "http_status": 422,
  "error_code": 15,
  "description": "We do not have public transport data for the region at given time.",
  "documentation_link": "https://api.traveltimeapp.com/#Travel-Time-API-documentation-Error-codes",
  "additional_info": {
    "search_id": [
      "my search id"
    ]
  }
}

Error when attempting a search in an unsupported area

additional_info.search_id contains a single search id that caused the error.

{
  "http_status": 422,
  "error_code": 16,
  "description": "We do not support searches in the given area. Make sure that all points for a search are in the same country.",
  "documentation_link": "https://api.traveltimeapp.com/#Travel-Time-API-documentation-Error-codes",
  "additional_info": {
    "search_id": [
      "my search id"
    ]
  }
}

Error when we couldn’t start the search at the given point.

additional_info.search_id contains a single search id that caused the error.

{
  "http_status": 422,
  "error_code": 17,
  "description": "We couldn't start the search at the given point. Please make sure you are not attempting to start a search from a lake, river, etc.",
  "documentation_link": "https://api.traveltimeapp.com/#Travel-Time-API-documentation-Error-codes",
  "additional_info": {
    "search_id": [
      "my search id"
    ]
  }
}

Error on invalid Accepts header

{
  "http_status": 406,
  "error_code": 19,
  "description": "We are only capable of generating a response which have content characteristics not acceptable according to the accept headers sent in the request",
  "documentation_link": "https://api.traveltimeapp.com/#Travel-Time-API-documentation-Error-codes",
  "additional_info": {
    "supported_content_types": [
      "application/json",
      "application/vnd.wkt+json",
      "application/vnd.wkt-no-holes+json",
      "application/vnd.bounding-boxes+json"
    ]
  }
}