Skip to main content
POST
POST /projects/{project}/query
Runs one read-only SQL statement.

Endpoint details

string
required
Bearer pat_... (Project API Token). Keep this token on your backend/server.
string
required
Project slug. This acts as the Project ID in API paths.
boolean
required
true for a successful response and false for an error response.
object | null
Endpoint-specific response data when ok is true; null on errors.
object | null
Error code and message when ok is false; null on success.
string
required
Request identifier you can use when troubleshooting a specific API call.

Authentication

Project API Token.

Parameters

Body: sql or query required; params optional array or object; limit optional integer, clamped 1-1000, default 500.

Notes

Only SELECT, WITH, and EXPLAIN QUERY PLAN are accepted. Multiple statements and write/schema keywords are blocked. A Project API Token can read registered application tables through this endpoint. Queries that try to read project control or credential tables return 403 query_table_denied. Joins and CTEs over registered application tables remain supported. Queries also have execution and result-size budgets. An overly expensive query returns 422 query_budget_exceeded; an oversized result returns 413 query_result_too_large. Add an appropriate index or narrow the query and try again. The limit caps returned rows but does not by itself make an expensive query fast.

Request examples

Basic request:
Full request:

Response examples

Success:
Error or alternate response: