Catalog and categories
Copy link

These endpoints tell you what data the API has in each country, and return the category tree for building pickers. The catalog is read from the data build itself, so it only changes when a country is rebuilt, and it says when that was. The category tree counts the places in the same build, including places that come from a single source. This means its counts are higher than the catalog's records, which count what the places endpoints return by default.

This page answers questions such as:

Request headers
Copy link

Required authentication header. Use the same application id as for the TravelTime API.

string

Required authentication header.

Data catalog
Copy link

GET /v1/catalog

Returns every country the API serves in one response. The response is read from the live data and rebuilt within five minutes of a data deploy. This endpoint is older than the response format that the other endpoints share, so it differs from them in the following ways:

  • Country codes are upper case (GB)
  • Layers are keyed by name
  • There is no results or next_cursor

This endpoint takes no parameters.

The response has a countries list, with one entry per country, sorted by name: {code, name, tier, bbox, last_refreshed, verified, layers}. In each entry:

  • tier is A for places and an environment layer, B for places only, and C for no places
  • bbox is [min_lng, min_lat, max_lng, max_lat]
  • last_refreshed is when the places index was built, where that can be read
  • layers holds places, gov_registers, land_cover, divisions, population, census, transport and environment, each as {available, sources, records, not_deployed}, where records counts the records that carry each live source
  • verified is false when the live read of the country failed. In that case, its tier and layers are what the country is registered for, which may include data that is not deployed

At the top level, generated_at is when the response was built, and sources is keyed by id, with each source as {name, publisher, licence, vintage, homepage, match_accuracy}. For a register, match_accuracy is {correct, lo, hi, sample, checked}: the share of a random sample of its matches that were judged to be the same place, with a 95% interval.

Examples

This example shows the entry for one country, at tier A and read from the live data. Its places come from Foursquare, OpenStreetMap and Overture. The response lists every source, including the government registers with their checked match accuracy.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/catalog"
200 · 1 country
NamenameCodecodeTiertierBboxbbox
United KingdomGBA-8.65, 49.84, 1.77 +1

All 1 shown

Catalog for one country
Copy link

GET /v1/catalog/{country}

Lists what the API has in one country, so that front ends can build their pickers from it.

Parameters
Copy link

ParameterType · defaultWhat it doesExample
countrypath · —A country id. GET /v1/boundaries?type=country lists the countries./catalog/gb

This endpoint takes no other parameters. The response is a single object, and next_cursor is always null.

The response has the following fields:

  • country {id, name, boundary_types, modes, operators [{id, name, line_count}]}. boundary_types lists the values that type takes (and group_by, except the National Parks and National Landscapes). modes and operators list the values that mode and operator take, both biggest first
  • results, one per dataset, as {id, routes, resolutions, fields [{name, unit, rollup, meaning}], countries}. roads and road-access have no resolutions. countries.<country> is {available, source_ids, not_deployed, updated_at, records}, where records counts what the dataset's endpoints return and not_deployed lists the sources with no live records. On places, it also has verified_by_count. Some datasets have extra fields: neighbourhood adds layers [{id, fields, countries}], open-spaces adds definitions (what counts as green cover, open space and a designation), and proximity adds targets, the values that within, beyond and covered_by take, each as an id or {id, meaning}
  • custom_scores.fields, every field that a custom-score check can read
  • downloads [{name, size_bytes, rows, url}], country-wide files for data that is too big to page through. None are published yet, so the list is empty
CodeHTTPWhen
not_found404There is no country with that id.
Examples

The catalog for a country lists its datasets, its transport operators and the fields that a custom-score check can read. For each dataset it gives the number of records and the date the data was updated, and for places, the government registers verifying them.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/catalog/gb"
200 · 10 results
RoutesroutesResolutionsresolutionsFieldsfieldsCountries gb availablecountries.gb.available
/places, /places/{id}, /places/cells6, 7, 8 +2id, name, category +21available
/transport/transit/stations, /transport/transit/stations/{id}, /transport/transit/stations/cells6, 7, 8 +2id, name, modes +11available
/transport/transit/lines, /transport/transit/lines/{id}, /transport/transit/lines/cells6, 7, 8 +2id, name, operator.id +9available
/transport/roads, /transport/roads/{id}—id, name, ref +3available
/transport/roads/access, /transport/roads/access/{id}—id, type, road.id +7available

5 of 10 shown · the other 5 are in the response

Category taxonomy
Copy link

GET /v1/categories

Returns the category tree with counts, for building pickers. The tree has three levels: group, category and detail. Counts are the places at the lowest level, added up through the levels above it, so a place with three details adds 3 to its group.

You can use an id from any level in category on the places endpoints. If an id exists at two levels (for example, cafe is a category and also one of its own details), it means the broader one. Use detail:cafe to select only the detail.

This endpoint is older than the response format that the other endpoints share, so it differs from them in the following ways:

  • The tree is in groups rather than results
  • Names are in display_name
  • Errors have no param or doc_url

Parameters
Copy link

ParameterType · defaultWhat it doesExample
countrycountry id · —The country to return counts for.country=gb

This endpoint takes no other parameters. Responses are cached, with a Cache-Control header that keeps them fresh for an hour and allows stale-while-revalidate for 24 hours.

The response has groups, each as {id, display_name, count, categories}. Each category is {id, display_name, count, detail}, and each detail is {id, display_name, count}. At the top level, total_pois is the number of places in the country.

CodeHTTPWhen
country_required422The request has no country.
—400There is no country with that id. The response is {"detail": "Unknown country code: XX"}.
Examples

The full category tree, with its 16 groups.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/categories?country=gb"
200 · 16 groups
Display namedisplay_nameCountcountCategoriescategoriesIdid
Automotive247,6655 itemsautomotive
Business & Services1,172,03810 itemsbusiness_and_services
Culture141,2188 itemsculture
Education115,2864 itemseducation
Entertainment65,53710 itemsentertainment_and_recreation

5 of 16 shown · the other 11 are in the response

One category group
Copy link

GET /v1/categories/{group}

Returns one branch of the tree, for pickers that drill down. The response is the group and everything under it, as the object itself rather than wrapped in an envelope.

Parameters
Copy link

ParameterType · defaultWhat it doesExample
grouppath · —A group id from the tree./food_and_drink
countrycountry id · —The country to return counts for.country=gb

This endpoint takes no other parameters. Responses are cached in the same way as the full tree.

The response is the group, {id, display_name, count, categories}, as described above.

CodeHTTPWhen
—404There is no group with that id. The response is {"detail": "Category group 'nope' not found"}.
country_required422The request has no country.
—400There is no country with that id. The response is {"detail": "Unknown country code: XX"}.
Examples

The food and drink group, with its 11 categories.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/categories/food_and_drink?country=gb"
200 · 11 categories
Display namedisplay_nameCountcountDetaildetailIdid
Bakery32,6654 itemsbakery
Bar105,3206 itemsbar
Brewery & Winery7,3003 itemsbrewery_winery
Cafe & Coffee135,6918 itemscafe
Desserts & Sweets21,9555 itemsdessert

5 of 11 shown · the other 6 are in the response