> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# REST v2 endpoints

> Reference for the e6data HTTP REST v2 SQL endpoints, headers, and statement states.

The HTTP REST v2 API runs SQL over HTTPS (HTTP/2). Authenticate once for a session token, then submit statements and read results asynchronously. For the full walkthrough, see [REST API for SQL queries](/query/connect/rest-api-for-sql).

## Endpoints

| Method & path | Purpose |
| - | - |
| `POST /api/v1/authenticate` | Exchange credentials for a session token |
| `POST /api/v2/sql/statements` | Submit a SQL statement |
| `GET /api/v2/sql/statements/{id}` | Poll status / get the first result chunk |
| `GET /api/v2/sql/statements/{id}/result/chunks/{n}` | Page through large results |
| `POST /api/v2/sql/statements/{id}/cancel` | Cancel a running statement |
| `POST /api/v2/sql/statements/{id}/clearOrCancel` | Free planner resources when finished |
| `GET /api/v2/sql/statements/{id}/explain-analyze` | Query plan and timings |

## Headers

| Header | When | Value |
| - | - | - |
| `cluster-name` | All requests | The target cluster |
| `Content-Type` | POST requests | `application/json` |
| `Authorization` | After authenticating | `Bearer <session>` |
| `X-Session-Id` | Polling/paging | Reuse `session_id` to skip re-authentication |

## Statement states

```
PENDING → RUNNING → SUCCEEDED   (or FAILED / CANCELLED)
```

## Notes

* **HTTP/2 is required.** Use an HTTP/2-capable client and don't force curl's `--http2` flag.
* Use the v2 path (`/api/v2/sql/statements`), not the older `/api/v1/query`.
* Suspended clusters auto-resume on the first statement (\~30–90 s).

## See also

* [REST API for SQL queries](/query/connect/rest-api-for-sql)
* [Connecting to the engine](/query/connect)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.