statement_id, poll for completion, then fetch result chunks.
The endpoint requires HTTP/2. Use an HTTP/2-capable client and don’t force curl’s
--http2 flag - ALPN negotiates HTTP/2 automatically.Authenticate
Exchange your email and a personal access token for a session token. Tokens are opaque strings starting withe6pat_ (PATs) or e6sa_ (service account keys) - treat them like passwords.
Authorization: Bearer <token>, or use an SSO/OIDC JWT as a bearer token.
Submit a statement
Required headers:cluster-name: <CLUSTER>, Content-Type: application/json, and Authorization: Bearer <session>.
Poll and fetch results
Reusesession_id via the X-Session-Id header to skip re-authentication while polling and paging:
Endpoints
Statement states:
PENDING → RUNNING → SUCCEEDED (or FAILED / CANCELLED).
Python example
Usehttpx (not requests) since the endpoint requires HTTP/2 - pip install "httpx[http2]":
Operational notes
- Reuse sessions via
X-Session-Idwhile polling and paging to avoid re-authenticating. - Page large results with
result/chunks/{n}, and callclearOrCancelwhen finished to free cluster resources promptly. - Suspended clusters auto-resume on the first statement; the request waits (~30–90 s).
- Use
POST /api/v2/sql/statements(v2) - not the older/api/v1/querypath.
See also
- Connecting to the engine - all protocols and the connection-string cheat sheet.
- PostgreSQL protocol
- Access tokens