Describe a table
One table's columns (name, type, meaning), source, license and file URLs.
https://api.transitlab.nyc/v1/tables/{name} Key optionalPartitioned tables also list the year and month columns to filter on. A key is optional.
Request
Section titled “Request”curl https://api.transitlab.nyc/v1/tables/taxi_yellow_tripsimport requests
r = requests.get( "https://api.transitlab.nyc/v1/tables/taxi_yellow_trips", timeout=60,)r.raise_for_status()print(r.json())const res = await fetch("https://api.transitlab.nyc/v1/tables/taxi_yellow_trips")if (!res.ok) throw new Error(`HTTP ${res.status}`)console.log(await res.json())Authorization
Section titled “Authorization”A key is optional. Without one, requests count against your IP address’s limits. With one, they count against the key’s.
Parameters
Section titled “Parameters”-
namestring requiredA table name from GET /v1/tables.
Responses
Section titled “Responses”200 OK
Section titled “200 OK”The table.
-
namestring requiredTable name, as written in SQL.
-
descriptionstringWhat a row is.
-
rowsintegerRow count.
-
bytesintegerTotal size of the table’s Parquet files.
-
filesintegerNumber of Parquet files.
-
partitioned_by_year_monthbooleanTrue if the table is one file a month or a day, with year and month columns to filter on.
-
first_daystring (date)First day covered (partitioned tables only).
-
last_daystring (date)Last day covered (partitioned tables only).
-
sourcestringWhere the data comes from.
-
licensestringLicense of the table.
-
columnsobject[] requiredColumns with types and meanings, plus year and month on partitioned tables.
-
columns[].namestring required -
columns[].typestring requiredDuckDB type, e.g. VARCHAR, DATE, BIGINT, DOUBLE.
-
columns[].descriptionstring required -
file_urlsstring (uri)[] requiredThe table’s Parquet files on data.transitlab.nyc.
{ "name": "bus_lanes", "description": "Stretches of bus route between two timepoint stops: speed, time lost to traffic, and how much has a bus lane.", "rows": 4219, "bytes": 152710, "files": 1, "partitioned_by_year_month": false, "source": "MTA bus speeds between timepoints (data.ny.gov) and NYC DOT bus lanes, computed by TransitLab (notes/bus-lanes.md).", "license": "CC BY 4.0", "columns": [ { "name": "route_id", "type": "VARCHAR", "description": "Bus route." }, { "name": "direction", "type": "VARCHAR", "description": "Direction letter (N, S, E, W)." }, { "name": "a_name", "type": "VARCHAR", "description": "Timepoint stop where the stretch starts." } ], "file_urls": ["https://data.transitlab.nyc/v1/bus_lanes.parquet"]}Errors
Section titled “Errors”| Status | When |
|---|---|
404 | Not found. No such table. |
429 | Too many requests. Too many requests. |
Error responses carry this body:
-
errorstring requiredA short code: unauthorized, rate_limited, daily_queries, daily_compute, concurrency, busy, budget_exhausted, engine_unavailable, bad_sql, not_read_only, sql_error, not_allowed, timeout, out_of_memory, bad_format, bad_limit, bad_date, no_such_table, not_found.
-
messagestring requiredWhat went wrong and what to do, in plain words.
-
get_a_keystring (uri)On 401: where to get a key.
-
docsstring (uri)On 401: the API guide.
{ "error": "no_such_table", "message": "No table named \"no_such\". GET /v1/tables lists them."}