datatomcp

CSV or Excel to API: a REST API with filters and totals

To turn a CSV or Excel file into an API, either load it into a database and write the endpoints yourself, or upload it to a service that answers HTTP queries for you. With datatomcp you upload the .csv or .xlsx file, create an API key, and send JSON queries that filter, sort and total the rows on the server.

Sometimes a file is the whole database: a product catalog, a price list, a lead export, a stock sheet someone keeps in Excel. To use it from an app or an automation you usually need a server, a database and an endpoint. This guide gets you a read-only REST API with filters, sorting and aggregates, without running any of that.

1. Upload the CSV or Excel file

Sign in at app.datatomcp.com, then Add data → Upload a file (a .csv or an .xlsx workbook), or Paste a link for a file that lives at a URL and should be re-fetched on refresh. The import report shows each column’s id and type. The column ids are what you use in queries.

From an Excel workbook, one sheet becomes one dataset: by default the first sheet with data. Formulas come in as their last computed value and dates as ISO dates. Older .xls files aren’t read; save them as .xlsx first.

datatomcp dataset page for a 50,000-row orders sheet: all rows imported, no issues, and each column with its detected type

2. Create an API key

Go to Account → API keys, name the key (for example production) and copy it. It starts with dtm_ and is shown once. Keys can be revoked at any time.

You can also create the dataset from code with that key. Send the file as the request body (or as a multipart file field):

# A CSV
curl "https://app.datatomcp.com/v1/datasets?name=products" \
  -H "Authorization: Bearer $DATATOMCP_KEY" \
  -H "Content-Type: text/csv" \
  --data-binary @products.csv

# One sheet of an Excel workbook
curl "https://app.datatomcp.com/v1/datasets?name=stock&sheet=Stock" \
  -H "Authorization: Bearer $DATATOMCP_KEY" \
  -H "Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" \
  --data-binary @inventory.xlsx

The response is the import report, with the new dataset’s id.

3. Query it

Every dataset has an id like ds_abc123, shown on its page and returned by GET /v1/datasets.

Rows with filters and sorting:

curl https://app.datatomcp.com/v1/datasets/ds_abc123/query \
  -H "Authorization: Bearer $DATATOMCP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "where": [{ "column": "country", "op": "eq", "value": "France" }],
    "select": ["order_id", "order_date", "total"],
    "order_by": [{ "column": "total", "dir": "desc" }],
    "limit": 10
  }'

Aggregates:

curl https://app.datatomcp.com/v1/datasets/ds_abc123/query \
  -H "Authorization: Bearer $DATATOMCP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "group_by": ["product"],
    "metrics": [
      { "fn": "count", "as": "orders" },
      { "fn": "sum", "column": "total", "as": "revenue" }
    ],
    "order_by": [{ "column": "revenue", "dir": "desc" }]
  }'

Each response has rows and a meta block: the dataset version, refreshed_at, rows_matched, rows_returned and truncated. Page through results with offset (up to 1,000 rows per request).

All endpoints

Method Path Purpose
GET /v1/datasets List datasets
POST /v1/datasets Upload a CSV or .xlsx file, or add a file link or a Google Sheet
GET /v1/datasets/:id Schema, warnings, freshness
POST /v1/datasets/:id/query Rows or aggregates
GET /v1/datasets/:id/values/:column Distinct values of a column
POST /v1/datasets/:id/refresh Re-fetch a linked source, or upload a new file
GET /v1/datasets/:id/versions Versions still kept
GET /v1/datasets/:id/docs.md Generated docs for this dataset
GET /v1/usage Today’s query count and limit

Errors are JSON with a stable code and a readable message, for example query_limit when the daily quota is reached.

Updating the data

Upload a new file to the same dataset (POST /v1/datasets/:id/refresh with the CSV or .xlsx as the body; a workbook is read from the same sheet as before), click Upload new version in the app, or use a file link and refresh it. Earlier versions are kept (2 on Free, 20 on Pro, up to 30 days), responses always tell you which version answered, and a query can pass "version": 3 to read an older one.

When you don’t need a hosted API

If one app reads the file and it rarely changes, loading it into SQLite or DuckDB next to that app and writing two or three endpoints is fine. A hosted API earns its place when several apps, automations or AI agents read the same file, when it changes every week, or when you’d rather not run and secure a server for a spreadsheet.

Limits

Free: 3 datasets, 100,000 rows each, files up to 20 MB, 1,000 queries a day. Pro ($12 or €12 a month): 25 datasets, 2 million rows each, files up to 200 MB, 50,000 queries a day. The same datasets are also available to AI agents as an MCP server.

FAQ

How do I turn an Excel file into an API? Save it as .xlsx, upload it in the app or POST it to /v1/datasets with ?sheet= naming the sheet, then query /v1/datasets/:id/query with an API key. Each sheet you want becomes its own dataset.

Can I convert a CSV to a JSON API? Yes. Every response is JSON: rows as objects keyed by column id, plus a meta block with the version and row counts.

Is there a free way to turn a CSV into an API? The Free plan covers 3 files of up to 100,000 rows and 1,000 queries a day, with no card. Beyond that, Pro is $12 or €12 a month.

Can I write rows through the API? No, the API is read-only. To change the data, upload a new version of the file.

What happens when I reach the daily limit? Queries return the query_limit error until the quota resets. Pro raises the limit to 50,000 queries a day.

Can AI agents use the same data? Yes. Every dataset is also available over MCP at https://app.datatomcp.com/mcp. See CSV MCP server.