CSV to API
A CSV can already be put online as a file to download. But code that uses it usually wants more: rows as JSON, only the rows it asks for, sorted, a page at a time. Building that means a database, a small service and somewhere to run it, which is a lot of work for a list of products or a price sheet.
rho gives a table a hosted, read-only API: upload the file, and its URL answers JSON with filters, sorting and paging. There’s no backend to write or keep running.
From a file to JSON
One example throughout: a small product catalogue, products.csv (made up):
sku,name,category,price,country00412,Desk lamp,Lighting,49.50,SE00413,Office chair,Furniture,189.00,SE01007,Notebook,Stationery,8.90,DK00415,Floor lamp,Lighting,79.00,DE- Upload it. Sign up, then drop the file anywhere in the app. rho reads CSV, TSV, Excel, JSON, NDJSON and Parquet: see Upload a file.
- Check the types. Before anything is saved, rho shows the type it read for each column and the first rows. Here
priceis a number (DOUBLE), andsku,name,categoryandcountryare text. Save it, say asshop/products. - Copy the URL. The table’s API panel has its URL,
https://api.rho.store/v/<key>. The key is random and names nothing. - Call it, with an API token of your workspace:
curl -H "Authorization: Bearer $RHO_API_KEY" \ "https://api.rho.store/v/<key>?price__lt=100&sort=-price&select=name,price"- Get the rows that match, as JSON:
{ "table": "shop/products", "version": 1, "columns": [ { "name": "name", "type": "VARCHAR" }, { "name": "price", "type": "DOUBLE" } ], "rows": [ { "name": "Floor lamp", "price": 79.0 }, { "name": "Desk lamp", "price": 49.5 }, { "name": "Notebook", "price": 8.9 } ], "offset": 0, "total": 3, "next": null}total is how many rows match, all pages together, and next is the URL of the next page, null on the last.
Filtering, sorting and paging
Each is a query parameter, named after a column where it’s about one:
| Parameter | What it does |
|---|---|
?country=SE | Only rows whose country is exactly SE |
?price__lt=100 | Compare: __gt, __lt, __gte, __lte on a column of numbers or dates; also __eq, __ne, __contains, __empty, __not_empty |
?sort=-price | Order by a column; - for descending |
?select=name,price | Only these columns, in this order |
?q=lamp | Rows with this text in any column |
?limit=20&offset=40 | The page’s size and where it starts; follow next rather than counting |
.csv, .ndjson, .parquet | Every row of the version as a file, as in /v/<key>.csv, without filters or paging |
Filters combine: every one has to match. The table API guide has the details and limits.
Private or public
- Private, as every table starts: the URL answers only an API token of your workspace, sent as
Authorization: Bearer. Without one it answers401. - Public, once you make the table public (its Share panel in the app): the same URL answers anyone, with no token, for the latest version. The table also gets a page people can open. See Public tables.
CORS is open on table APIs, so a page in a browser can call one. Only do that with a public table: an API token is a secret that reads and writes every table in your workspace, so it belongs on a server or in a script, never in a web page’s JavaScript.
Latest and pinned versions
Every upload to the table makes a new version, and both kinds of URL are useful:
/v/<key>is the latest version. The URL stays the same while the data changes: upload a new catalogue, and the same URL answers the new rows./v/<key>@3is version 3, and answers the same rows for good. Use it when a result must be reproducible: a report, a test, a published figure. It needs a token, also on a public table.
A stable URL isn’t a stable schema: if a new upload drops or renames a column, the latest version answers without it, so code that reads price should still check it’s there. Every answer has an ETag and an X-Rho-Version header; send the ETag back as If-None-Match, and you get 304 Not Modified until there’s a new version.
To update the data, upload a new file to the table (to replace its rows, add to them, or update them by a key), and a wrong one is undone by restoring the version before. The API only reads.
Check the types
rho reads each column’s type from its values: numbers, dates, true/false, or text. That’s convenient, and still worth a look before you save:
- Leading zeros. A column like
skuabove (00412) stays text, so the zeros are kept, and rho says so. Postal codes, phone numbers and IDs work the same way. - Mixed values. If one value in a column of numbers isn’t a number, the whole column stays text, exactly as written, with a warning naming the values that didn’t fit. Fix the file, or let it be text.
- Number formats.
1,234and1.234,56are read by the decimal separator the rest of the file uses.
The same table elsewhere
The table behind the API is an ordinary rho table. An AI agent can query it with SQL and keep it up to date over MCP, and the Python SDK reads and writes it as a DataFrame.
When something else fits better
- People edit the rows, and code writes to them: a no-code database such as Airtable or Baserow, which has an API for writes too.
- You’d rather host it yourself: Datasette serves a SQLite database as a read-only JSON API.
- An application with writes, transactions or logic of its own: a database behind your own backend, such as Postgres.