---
title: "POST /v1/sqlite/batch"
method: POST
path: "/v1/sqlite/batch"
tags: ["sqlite"]
---

# POST /v1/sqlite/batch

`POST /v1/sqlite/batch`

Execute a batch of SQLite statements and return results for all of them

## Request body

- object — A set of statements to be run in a single batch
  - `statements` union[], required
    - union
      - string — Simple SQL statement to run in SQLite
      - object — A parameterized SQL query. See https://docs.turso.tech/sdk/ts/reference#batch-transactions for reference
        - `sql` string, required — SQL statement, with ? placeholders for arguments
        - `args` union, required — List of arguments to be used in the given statement
          - unknown[]
            - unknown
          - object
  - `mode` 'write' | 'read' | 'deferred'

## Response `200`

Array of results from the statements executed

- ResultSet[] — Array of results from the statements executed
  - `columns` string[], required — Names of columns. Names of columns can be defined using the `AS` keyword in SQL: ```sql SELECT author AS author, COUNT(*) AS count FROM books GROUP BY author ```
  - `columnTypes` string[], required — Types of columns. The types are currently shown for types declared in a SQL table. For column types of function calls, for example, an empty string is returned.
  - `rows` array[], required — Rows produced by the statement.
    - unknown[]
      - unknown
  - `rowsAffected` number, required — Number of rows that were affected by an UPDATE, INSERT or DELETE operation. This value is not specified for other SQL statements.
  - `lastInsertRowid` union — ROWID of the last inserted row. This value is not specified if the SQL statement was not an INSERT or if the table was not a ROWID table.
    - string
    - number

---

[API](https://skmtc.net/val-town/apis/val-town-api.md) · [All operations](https://skmtc.net/val-town/apis/val-town-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/val-town/val-town-api/revisions/4d8b6d2e6db3/schema)
