Data Export

Export datasets in multiple formats for use in your applications, analysis tools, or other systems.

Available Formats

FormatBest ForContent-Type
JSONWeb applications, APIsapplication/json
CSVSpreadsheets, data analysistext/csv
TSVTab-separated, easy pastingtext/tab-separated-values
XLSXExcel spreadsheetsapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet

JSON Export (Default)

JSON is the default format for all dataset queries:

Query dataset with JSON response

curl "https://api.tryopendata.ai/v1/datasets/census/state-populations?limit=5" | jq

CSV Export

Request CSV format using the Accept header or format parameter:

Request
# Using Accept header
curl -H "Accept: text/csv" \
"https://api.tryopendata.ai/v1/datasets/census/state-populations?limit=100"
# Using format parameter
GET /v1/datasets/census/state-populations?format=csv&limit=100
Response
state,year,population
California,2023,39029342
Texas,2023,30029572
...

Python Example

import pandas as pd
# Fetch CSV directly into pandas
url = "https://api.tryopendata.ai/v1/datasets/census/state-populations?format=csv"
df = pd.read_csv(url)
print(df.head())

TSV Export

Tab-separated values work the same way as CSV:

Request
# Using Accept header
curl -H "Accept: text/tab-separated-values" \
"https://api.tryopendata.ai/v1/datasets/census/state-populations?limit=100"
# Using format parameter
GET /v1/datasets/census/state-populations?format=tsv&limit=100

XLSX Export

Download data as an Excel spreadsheet:

Request
curl -H "Accept: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" \
"https://api.tryopendata.ai/v1/datasets/census/state-populations" \
-o state-populations.xlsx
# Using format parameter
GET /v1/datasets/census/state-populations?format=xlsx

Selecting Fields

Export only specific fields to reduce data size:

Request
# JSON with selected fields
GET /v1/datasets/census/state-populations?fields=state,population&limit=100
# CSV with selected fields
GET /v1/datasets/census/state-populations?fields=state,population&format=csv

Pagination for Large Exports

For datasets larger than the limit allows, paginate through the data:

# Python: Export all data with pagination
import requests
def export_all(provider, dataset, page_size=1000):
all_data = []
offset = 0
while True:
response = requests.get(
f"https://api.tryopendata.ai/v1/datasets/{provider}/{dataset}",
params={"limit": page_size, "offset": offset}
)
data = response.json()
all_data.extend(data["data"])
if len(data["data"]) < page_size:
break
offset += page_size
return all_data
data = export_all("census", "state-populations")

Downloading Large Results

The API returns a maximum of 1000 rows per request. If a dataset has more rows than that, use the pagination approach shown above to walk through the full result set. CSV format works well for bulk downloads since it keeps the response size compact.

Rate Limits for Exports

Export operations count against your rate limits. For large exports:

  • Use pagination with reasonable page sizes (1000-5000 rows)
  • Add delays between requests to stay under limits
  • Create a free account for higher rate limits

Related

Search datasets

Search for datasets or run quick actions