Database

Execute batch SQL statements in a transaction

Execute multiple SQL statements atomically in a single transaction: all succeed or all roll back, no partial writes on a mid-batch failure. Each statement accepts its own positional parameters via args. mode selects the transaction variant — "write" (default), "read" for read-only batches, or "deferred".

post/api/db/{project_id}/batch

Request

  • Base URL
    https://core.blink.new
  • URL
    https://core.blink.new/api/db/{project_id}/batch
  • Auth
    HTTP bearer

Path parameters

project_idstring required
Example:my-project-123

Unique identifier for the project

Request body

mode'read' | 'write' | 'deferred'

Transaction mode: write for data modifications, read for read-only queries, deferred to start as read and upgrade to write on the first mutation

Example request

{
  "statements": [
    {
      "sql": "INSERT INTO users (name, email) VALUES ($1, $2)",
      "args": [
        "John Doe",
        "john@example.com"
      ]
    }
  ]
}

Response

Batch executed successfully

executionTimenumber

Total execution time in milliseconds

successboolean

Whether the batch operation succeeded

Changes

No recorded changes to this operation across all 1 revision of this API.