Documentation
Search every public dataset on Subsets and query it with SQL. Available via REST API, MCP server, or Claude Code skill.
Quickstart
From API key to first query in 2 minutes.
- Create an account or sign in
- Copy your API key from Settings
- Search for a dataset:
curl -s "https://api.subsets.io/api/public/search?q=inflation&type=dataset"- Query it with SQL:
curl -s -X POST "https://api.subsets.io/api/datasets/bis-ws-long-cpi/query" \
-H "Authorization: Bearer sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"sql": "SELECT time_period, obs_value FROM \"bis-ws-long-cpi\" WHERE series_key = '\''A.CZ.771'\'' ORDER BY time_period DESC LIMIT 10"}'Returns { columns, rows, row_count }. Uses 1 of your monthly queries.
Authentication
Search, list, and preview are public — no auth needed. SQL queries require authentication.
REST API — Header
Authorization: Bearer sk_YOUR_KEYMCP Server — Environment variable
{
"env": { "SUBSETS_API_KEY": "sk_YOUR_KEY" }
}Claude Code Skill — Environment variable
export SUBSETS_API_KEY=sk_YOUR_KEYAPI keys start with sk_ and are available on your Settings page.
Queries & Rate Limits
| Action | Cost |
|---|---|
| SQL query | 1 query |
| Search, list, preview | Free |
Free tier: 500 queries/month. Pro: 5,000 queries/month. Your quota resets on the 1st of each month.
Rate limits: Public endpoints are limited to 60 requests per minute per IP. The X-Credits-Remaining header on API responses reports how many queries you have left this month.
Search
Search across datasets by keyword.
GET /api/public/search
curl -s "https://api.subsets.io/api/public/search?q=carbon&type=dataset&limit=20"Parameters: q (query), type (dataset), limit (1-50). No auth required.
MCP search(query, type?, limit?)
Datasets
Get metadata, schema, and preview rows for any published dataset.
Get dataset details
GET /api/public/datasets/:id
curl -s "https://api.subsets.io/api/public/datasets/bis-ws-long-cpi"Returns schema (column names and types), row count, description, tags, and license.
Preview rows
GET /api/public/datasets/:id/preview
curl -s "https://api.subsets.io/api/public/datasets/bis-ws-long-cpi/preview?limit=10"Returns { columns, rows, row_count }. Max 100 rows.
MCP get_dataset(id)
MCP preview_data(id, limit?)
SQL Queries
Execute SQL queries against datasets. Use dataset IDs as table names in your SQL. Results are returned directly — nothing is saved.
Wrap hyphenated dataset IDs in double quotes so the SQL parser doesn't read them as subtraction.
Query a single dataset
POST /api/datasets/:id/query
curl -s -X POST "https://api.subsets.io/api/datasets/bis-ws-long-cpi/query" \
-H "Authorization: Bearer sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"sql": "SELECT time_period, obs_value FROM \"bis-ws-long-cpi\" ORDER BY time_period DESC LIMIT 10"}'Returns { columns, rows, row_count }. Each execution uses 1 of your monthly queries.
MCP execute_sql(dataset_id, sql)
Client Setup
All capabilities above are shown as REST API examples. Here's how to set up the MCP server or Claude Code skill for tool-based access.
The Subsets MCP server is hosted at https://mcp.subsets.io. It exposes 4 tools: search, get_dataset, preview_data, execute_sql.
Claude Code
One-line install:
claude mcp add --transport http subsets https://mcp.subsets.io --header "Authorization: Bearer sk_YOUR_KEY"Claude.ai
Open Settings → Connectors → Add custom connector. Paste the URL https://mcp.subsets.io and authenticate via OAuth or with your sk_ API key.
Claude Desktop, Cursor, and other MCP clients
Add to your MCP config (e.g. claude_desktop_config.json, .mcp.json, or the client's equivalent):
{
"mcpServers": {
"subsets": {
"url": "https://mcp.subsets.io",
"headers": {
"Authorization": "Bearer sk_YOUR_KEY"
}
}
}
}Public tools (search, get_dataset, preview_data) work without an API key. SQL queries and content creation require a Bearer token.
Error Reference
| Code | Meaning |
|---|---|
| 400 | SQL query error or invalid request |
| 402 | Monthly query quota exhausted — resets on the 1st of next month |
| 403 | Not the owner of this entity |
| 404 | Entity not found |
| 409 | ID already exists — choose a different slug |
| 422 | Invalid slug format or missing required fields |
| 429 | Rate limit exceeded — wait and retry |