Error Response
Copy link

Error Structure
Copy link

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 is populated for many error codes — see the examples below for the JSON shapes you'll receive.

Examples
Copy link

Error on Invalid JSON Content
Copy link

{
  "http_status": 422,
  "error_code": 2,
  "description": "Invalid request json",
  "documentation_link": "/api/reference/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
Copy link

{
  "http_status": 400,
  "error_code": 3,
  "description": "Failed to parse json - syntax error",
  "documentation_link": "/api/reference/error-codes",
  "additional_info": {
    "syntax_errors": [
      "Unexpected character ('f' (code 102)): was expecting comma to separate OBJECT entries"
    ]
  }
}

Error when fare data is unavailable
Copy link

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 Great Britain",
  "documentation_link": "/api/reference/error-codes",
  "additional_info": {
    "search_id": [
      "my search id"
    ]
  }
}

Error when public transport data is not available.
Copy link

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 the time you have specified, try a more recent date",
  "documentation_link": "/api/reference/error-codes",
  "additional_info": {
    "search_id": [
      "my search id"
    ]
  }
}

Error when attempting a search in an unsupported area
Copy link

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": "/api/reference/error-codes",
  "additional_info": {
    "search_id": [
      "my search id"
    ],
    "locations": [
      "52.524_13.41",
      "51.507_-0.127"
    ]
  }
}

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

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 the start of the search is near a road or a path e.g. you are not attempting to start a search from a lake, river or a desolate area",
  "documentation_link": "/api/reference/error-codes",
  "additional_info": {
    "search_id": [
      "my search id"
    ]
  }
}

Error on invalid Accepts header
Copy link

{
  "http_status": 406,
  "error_code": 19,
  "description": "Unsupported content type was specified in the Accept header",
  "documentation_link": "/api/reference/error-codes",
  "additional_info": {
    "supported_content_types": [
      "application/json",
      "application/vnd.wkt+json",
      "application/vnd.wkt-no-holes+json",
      "application/vnd.bounding-boxes+json"
    ]
  }
}

Error when fast data is unavailable for the requested region and transportation mode
Copy link

Returned for the time-filter/fast endpoints when the requested transportation mode is not supported in the region. additional_info.search_id contains a single search id that caused the error. The same JSON shape applies to error codes 22, 23, 24, 27-30, 32, and 34-63; only the description text varies by mode and capability.

{
  "http_status": 422,
  "error_code": 23,
  "description": "We do not have fast data for this region and mode.",
  "documentation_link": "/api/reference/error-codes",
  "additional_info": {
    "search_id": [
      "my search id"
    ]
  }
}

Error on bad GET request
Copy link

Returned when GET-style query parameters fail validation. additional_info is keyed by query parameter name and contains an array of validation messages.

{
  "http_status": 400,
  "error_code": 25,
  "description": "Bad request",
  "documentation_link": "/api/reference/error-codes",
  "additional_info": {
    "travel_time": [
      "Bad request: travel_time must be specified and it should be greater than or equal to 60 and less than or equal to 86400"
    ],
    "locations": [
      "Bad request: locations must be specified. If specifying multiple locations - they should be separated with commas: locations=51.4234_-0.1234,54.6532_-0.1345"
    ]
  }
}

Error on authorization failure
Copy link

Returned when the request exceeds plan limits (e.g., travel time, distance, snapping threshold, buffer distance, max points, resolution settings) or otherwise is not permitted for the account. The description is multi-line and lists each specific cause; one or more sub-errors may be present.

{
  "http_status": 401,
  "error_code": 26,
  "description": "Unauthorized. Errors:\n- Your plan is limited to 2h travel time. Please upgrade your plan at https://account.traveltime.com or contact us if you require a higher limit.",
  "documentation_link": "/api/reference/error-codes",
  "additional_info": {}
}