> ## 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.

# Query inline orders

> Use only HTTP to count and summarize inline data. No files, catalog connection, or credentials are needed.

How-to guideApplies to: Unified engine deployments

Use only HTTP to count and summarize inline data. No files, catalog connection, or credentials are needed.

### Query inline orders over HTTP

Expect Books 60, Games 45, and Garden 35. Send each step explicitly. Use the returned session ID in later requests.

| Placeholder | Value |
| - | - |
| `{{operation_id}}` | A new UUID for this request; reuse it when recovering the same submission. |

Replace the placeholders in your client. Keep returned IDs for later requests. Paths below use the native API prefix; adjust it for your deployment.

#### 1. Open a session

```http theme={"theme":{"light":"github-light","dark":"github-dark"}}
POST /api/v1/sessions
Host: <ENGINE_HOST>
```

From the response, keep `session_id` from `/session_id`.

[Endpoint reference](https://docs.e6data.com/transformation/http/reference/open-session.md).

#### 2. Submit SQL

```http theme={"theme":{"light":"github-light","dark":"github-dark"}}
POST /api/v1/sessions/{{session_id}}/operations
Host: <ENGINE_HOST>
Content-Type: application/json

{
  "operation_id": "{{operation_id}}",
  "sql": "WITH orders(id, category, region, amount) AS (VALUES (1, 'Books', 'North', 20), (2, 'Games', 'South', 30), (3, 'Games', 'North', 15), (4, 'Books', 'North', 40), (5, 'Garden', 'South', 25), (6, 'Garden', 'North', 10)) SELECT category, SUM(amount) AS sales FROM orders GROUP BY category ORDER BY category",
  "source": "external"
}
```

[Endpoint reference](https://docs.e6data.com/transformation/http/reference/submit-operation.md).

#### 3. Follow execution

```http theme={"theme":{"light":"github-light","dark":"github-dark"}}
GET /api/v1/sessions/{{session_id}}/operations/{{operation_id}}
Host: <ENGINE_HOST>
```

Repeat this read until `/status` reaches a terminal state: `Succeeded`, `Failed`, `Cancelled`, `OutcomeUnknown`, `Skipped`.

[Endpoint reference](https://docs.e6data.com/transformation/http/reference/operation-status.md).

#### 4. Read result metadata

```http theme={"theme":{"light":"github-light","dark":"github-dark"}}
GET /api/v1/sessions/{{session_id}}/operations/{{operation_id}}/results/metadata
Host: <ENGINE_HOST>
```

[Endpoint reference](https://docs.e6data.com/transformation/http/reference/operation-metadata.md).

#### 5. Fetch rows

```http theme={"theme":{"light":"github-light","dark":"github-dark"}}
GET /api/v1/sessions/{{session_id}}/operations/{{operation_id}}/results?limit=1
Host: <ENGINE_HOST>
```

[Endpoint reference](https://docs.e6data.com/transformation/http/reference/operation-results.md).

#### 6. Close the session

```http theme={"theme":{"light":"github-light","dark":"github-dark"}}
DELETE /api/v1/sessions/{{session_id}}
Host: <ENGINE_HOST>
```

[Endpoint reference](https://docs.e6data.com/transformation/http/reference/close-session.md).

## Follow the steps

Open a session and keep its returned ID. Submit the SQL once. Use a unique operation ID and reuse it when recovering the same submission.

Read operation status using the status request. Repeat until success or another final outcome. After success, read metadata and fetch one result page. Decode the Arrow response in your client to inspect the rows.

| category | sales |
| - | -: |
| Books | 60 |
| Games | 45 |
| Garden | 35 |

Close the session when finished. Closing a session is a server operation; leaving the docs page is not cleanup.

## Change the query

On a new submission, add `WHERE region = 'North'` before GROUP BY. Expect Books 60, Games 15, and Garden 10. Copy the SQL request and use a new operation ID in your own client. Keep the original request unchanged when recovering a lost response.


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