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.

  1. Create an account or sign in
  2. Copy your API key from Settings
  3. Search for a dataset:
Bash
curl -s "https://api.subsets.io/api/public/search?q=inflation&type=dataset"
  1. Query it with SQL:
Bash
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

Bash
Authorization: Bearer sk_YOUR_KEY

MCP Server — Environment variable

JSON
{
  "env": { "SUBSETS_API_KEY": "sk_YOUR_KEY" }
}

Claude Code Skill — Environment variable

Bash
export SUBSETS_API_KEY=sk_YOUR_KEY

API keys start with sk_ and are available on your Settings page.

Queries & Rate Limits

ActionCost
SQL query1 query
Search, list, previewFree

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.

Datasets

Get metadata, schema, and preview rows for any published dataset.

Get dataset details

GET /api/public/datasets/:id

Bash
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

Bash
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

Bash
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:

Bash
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):

JSON
{
  "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

CodeMeaning
400SQL query error or invalid request
402Monthly query quota exhausted — resets on the 1st of next month
403Not the owner of this entity
404Entity not found
409ID already exists — choose a different slug
422Invalid slug format or missing required fields
429Rate limit exceeded — wait and retry