Skip to content

HTTP API

Endpoint Auth
GET / no server version, endpoints, authentication and skill install command (unless --serve-skill off)
GET /skill, GET /skill/{file} no agent skill documentation; scripts too with --serve-skill all
GET /v1/capabilities yes the credential, document features and delegation contract
POST /v1/query yes run a statement, or a dry run
GET /v1/schema yes tables, views and columns the caller may query
GET /v1/databases yes databases containing objects the caller may query
POST /mcp yes native MCP when --mcp is enabled; see Native MCP
GET /v1/docs, GET /v1/docs/{id} yes semantic documents (with --docs-dir)
POST /v1/docs/search yes documents that fit a question
POST /v1/docs, PUT/PATCH/DELETE /v1/docs/{id} yes write documents, as the policy allows
GET /healthz no liveness

Prometheus /metrics is served on a separate port; see Metrics. With --flight-listen, the same data is also served over Arrow Flight SQL, for database IDEs and ADBC clients.

One statement per request. Parameters are bound server-side.

{"sql": "SELECT * FROM orders WHERE id = $1", "params": [42], "database": "sales", "format": "csv"}
Field
sql one SQL statement
params values for $1, $2, …
format json (default), csv, ndjson, arrow or parquet; also ?format= or Accept
database catalog for unqualified names; defaults to the catalog file’s default
max_rows lowers the row limit for this response; it can never raise it
dry_run inspect and authorize without executing

JSON:

{"columns":[{"name":"id","type":"BIGINT"}],"data":[{"id":3}],"row_count":1}
  • arrow is an Arrow IPC stream (application/vnd.apache.arrow.stream) and is the fastest format for large results.
  • parquet is an Apache Parquet file (application/vnd.apache.parquet), available in builds with -tags duckdb_arrow, and respects max_rows.
  • Send Accept-Encoding: gzip for compressed JSON, CSV or NDJSON responses.
  • DECIMAL, HUGEINT and UUID are sent as strings, so no precision is lost.
  • Every response carries X-Request-Id, the same id as in the audit log, and authenticated ones X-Curral-Effective-Subject, the identity the request ran as.

The smallest of --max-rows, the role’s max_rows and the request’s max_rows wins. No LIMIT is added to the SQL: the server stops reading when the limit is reached and signals the cut with X-Curral-Max-Rows and the trailer X-Curral-Error: row limit reached. For cheap samples, put a LIMIT in the SQL yourself.

Before the stream starts, errors are {"error": "..."} with a status:

Status
400 invalid SQL or request
401 not authenticated
403 denied by the policy, the engine or row/column protection, or an execution identity refused
404 unknown route or document, out-of-scope document, or /v1/docs without --docs-dir
412 If-Match on /v1/docs no longer matches the document
429 over the user’s concurrency quota, or locked out
499 client disconnected
503 queue full, or the audit log cannot be written
504 query timeout

Once a 200 has been sent, an error goes into the X-Curral-Error trailer (and an "error" field in JSON). X-Curral-Row-Count carries the total.

  • duckdb_tables(), duckdb_columns() and similar functions, information_schema.*, pg_catalog.*, sqlite_master, SHOW TABLES: 403 for every role. Use /v1/schema.
  • DESCRIBE/SHOW of a table is authorized as a read of that table, and returns columns even when row filters or masks apply. SUMMARIZE reads protected rows; EXPLAIN remains refused for protected tables. SHOW of a name DuckDB would read as a setting, or of one quoted identifier with dots or quotes inside, arrives resolved: false; so do SHOW/DESCRIBE inside a WITH clause and a bare SHOW next to a direct pragma_show(...) call. Qualify the table or use DESCRIBE.
  • DuckDB’s hints in errors (“Did you mean…?”) can name objects the caller cannot read, so they are stripped from responses (kept in the logs).

Describes the credential without granting data access. A delegating service calls it with its key alone, before sending identities:

{"execution_context_version":1,"delegation_required":true,"subject":"portal",
"attributes":{"tenant":"tenant-a"},"formats":["json","csv","ndjson","arrow"],
"docs":{"enabled":true,"scope":"schema","ranker":"bm25","delegated_writes":false},"version":"v0.9.0"}

For any other credential delegation_required is false and subject is the caller. docs.enabled says whether /v1/docs is available; docs.scope is all or schema, and docs.ranker is jev with a Jev key, bm25 otherwise. docs.delegated_writes reports whether the key supports delegated document writes. A write still requires an effective identity and policy permission.

In v0.9.0, the capabilities response still lists JSON, CSV, NDJSON and Arrow; Parquet is supported by Arrow-enabled builds even though it is not yet listed in that response.

Header
Authorization Basic, Bearer curral_... or Bearer <JWT>
X-Curral-Execution-Context delegating keys only: the identity the request runs as; see Execution delegation
X-Curral-Caller-Context other API keys: who the key is calling for, recorded in the audit log only

Lists tables, views and columns, showing each user only what they could query: every object goes through the same inspection, policy and protections as SELECT * FROM object.

Terminal window
curl -u analyst https://curral.example.com/v1/schema
curl -u analyst 'https://curral.example.com/v1/schema?database=lake&schema=analytics&table=customers'
{"default_database":"lake",
"databases":[{"name":"lake","type":"iceberg","schema":"analytics","read_only":false}],
"tables":[{"database":"lake","schema":"analytics","name":"customers","kind":"table",
"columns":[{"name":"name","type":"VARCHAR","nullable":true},
{"name":"ssn","type":"VARCHAR","nullable":true,"masked":true}],
"row_filtered":true}]}
  • Filters database, schema and table are case-insensitive.
  • masked and row_filtered show the protections that apply to the caller.
  • comment carries COMMENT ON text when present.
  • docs counts matching semantic documents and is omitted when none match. With --docs-scope schema, only documents visible to the caller count.

The listing is cached (--schema-cache-ttl, 10 minutes) and filtered per user in memory, so it uses no DuckDB slot: about 0.5 ms cached versus ~4 s cold against R2. DDL through curral refreshes it immediately; policy and RLS changes apply at once.

With --docs-dir, curral serves semantic documents: notes on what schemas and tables mean, with sample SQL, for agents to read before writing queries. Without it, every /v1/docs route answers 404.

Terminal window
curl -u analyst 'https://curral.example.com/v1/docs?table=orders&fields=header'
curl -u analyst https://curral.example.com/v1/docs/search -d '{"q": "revenue per customer"}'

The format, filters, writes with If-Match and the policy decision are in Semantic documents; ranking and the response of /v1/docs/search are in Searching documents.

Add "dry_run": true to see what the policy decides, without executing:

{"dry_run":true,"decision":"deny","decided_by":"policy","statement_type":"DELETE",
"database":"sales","tables":["sales.main.orders"],"targets":["sales.main.orders"],
"functions":[],"databases":["sales"],"resolved":true,"policy_sha256":"..."}

The response also shows limits, row filters and masked columns that would apply. If protections cannot be applied (for example, a protected table behind an unverifiable indirect read, EXPLAIN, or a write reading a protected table), the dry run returns decision: deny, decided_by: protection and the reason. Invalid SQL still returns 400.

Terminal window
curl --fail-with-body -u analyst 'https://curral.example.com/v1/query?format=parquet' \
-H 'Content-Type: application/json' \
-d '{"sql":"SELECT * FROM orders","max_rows":10000}' \
-o orders.parquet

The row cap still applies; this may be a partial export. Check the response headers and trailers for limit signals as described under Row limits.