Data API
Every dataset is available at a single URL. Pick a format, then sort, page, randomize, or download with query parameters.
Basics
GET /api/data/{dataset} JSON by default
GET /api/data/{dataset}?format=xml XML
GET /api/data/{dataset}?format=csv CSV
Dataset names come from the catalog. Every example below is a live link, open one to see the real response:
- /api/data/presidents
- /api/data/presidents?format=csv
- /api/data/presidents?rows=5
- /api/data/presidents?sort=President%20desc
- /api/data/bestsellingbooks?pagesize=25&pagenumber=2
- /api/data/bestsellingbooks?random=true&rows=5
Parameters
| Parameter | Purpose | Example |
|---|---|---|
format | json (default), xml, or csv | format=csv |
formatting | indented (default) or none | formatting=none |
rows | limit rows returned | rows=25 |
sort | sort by a column name, optional desc | sort=Party desc |
random | randomize row order | random=true |
pagesize / pagenumber | page through results | pagesize=25&pagenumber=2 |
download | return as a downloadable file | download=true |
For sort, use a column name exactly as it appears in the
results (they vary by dataset). Open a dataset to see its columns.
API keys
Anonymous use is free within daily limits. A pass raises your limits; send the key in the Authorization header on every request:
Authorization: Bearer YOUR_KEY
Responses include an X-Key-Expires header so your integration
can warn you before renewal time. Query-string tokens are not supported.
Free tier and limits
Without a key you can call the API 50 times a day, and responses return up to 50 rows. That is plenty for trying things out, small lookups, and most teaching or prototyping. A pass removes the row cap and raises the daily limit.
Exceeding your limit returns HTTP 429 with a Retry-After
header. Errors return meaningful HTTP status codes with a JSON body:
{"message": "The requested list was not found."}