• Start
Sign In

Connect

Via HTTP

Query an instance with cURL or any HTTP client, and the request size limits that apply per endpoint.

Instances serve the HTTP API, so anything that speaks HTTP can query them.

That includes cURL, Postman, a serverless function, and a language without an SDK.

To get the URL, open the instance in SurrealDB Studio, select Connect, then select HTTP cURL.

The Connect menu in SurrealDB Studio with HTTP cURL selected, showing a generated cURL command containing the instance endpoint and its namespace and database headers.

Note

The generated command is cURL, but the URL and headers work in any HTTP client. Paste them into Postman or your own code unchanged.

Post SurrealQL to /sql. Name the namespace and database in headers, and authenticate with a bearer token:

Run a query over HTTP
curl -X POST "https://<endpoint>/sql" \
  -H "Surreal-NS: main" \
  -H "Surreal-DB: main" \
  -H "Authorization: Bearer <token>" \
  -H "Accept: application/json" \
  -d "SELECT * FROM person LIMIT 10;"

The response is a JSON array with one result object per statement in the request.

Instances run the SurrealDB defaults for request size, and those defaults differ per endpoint.

EndpointLimit
/sql1 MiB
/rpc4 MiB
/import4 GiB
WebSocket message128 MiB

A request over the cap is rejected with 413 Payload Too Large. The 1 MiB cap on /sql is the one large queries tend to reach first.

If a payload does not fit, you have three options:

  • Use an SDK. Most, including Rust and JavaScript, default to the WebSocket engine and its 128 MiB per message.

  • Stay on HTTP but change endpoint. Send the query through POST /rpc, which accepts 4 MiB.

  • Load bulk data through import. POST /import accepts up to 4 GiB per request. See Import and export.

The full table is in request size limits. A self-hosted server sets these caps with environment variables. Instances run the defaults.

Was this page helpful?