---
title: "Execute a batch of SQL queries."
method: POST
path: "/api/v1/sql/batch"
tags: ["Database"]
---

# Execute a batch of SQL queries.

`POST /api/v1/sql/batch`

## Request

- Base URL: `https://api.scalix.world`
- URL: `https://api.scalix.world/api/v1/sql/batch`
- Auth: HTTP bearer

Runs multiple SQL statements in one request; each query executes independently and returns its own result set.

## Request body

- BatchSqlRequest: A batch of SQL queries executed in one request (each runs independently).
  - `queries` SqlRequest[], required
    - `query` string, required: The SQL statement, with `$1`, `$2`, … placeholders for params.
    - `params` object, nullable: Positional bind parameters for the placeholders, in order.
    - `timeline_id` string, nullable: Branch timeline to run the query against, as returned by `scalix_db_branch_create` (optionally in its `db_<timeline>` connection-string form). Omit for the project's primary. A timeline that is not a branch of this project is rejected — it never falls back to the primary (F17).

## Response `200`

Array of query results

## Other responses

- `401`: Missing or invalid API key
- `500`: Internal error

---

[API](https://skmtc.dev/scalix/apis/scalix-cloud-api.md) · [All operations](https://skmtc.dev/scalix/apis/scalix-cloud-api/llms.txt) · [OpenAPI document](https://skmtc.dev/scalix/apis/scalix-cloud-api/revisions/2c04ca0a90bb?raw)
