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

# [Beta] Execute a batch of SQL statements against an axon's database.

> [Beta] Execute multiple SQL statements atomically within a single transaction against an axon's SQLite database.



## OpenAPI

````yaml /openapi-specs/stainless-processed-openapi.json post /v1/axons/{id}/sql/batch
openapi: 3.1.0
info:
  title: RunLoop API
  version: '0.1'
  description: >-
    The RunLoop API spec that allows you to host lambda functions and Devboxes
    to enable scaled long running ai workflows.
  contact:
    name: Runloop AI Support
    url: https://runloop.ai
    email: support@runloop.ai
servers:
  - url: https://api.runloop.ai
    description: Runloop API
    variables: {}
security:
  - bearerAuth: []
tags:
  - name: Benchmark
  - name: Blueprint
  - name: Blueprint-Lifecycle
  - name: Blueprint-ObservabilityTools
  - name: Devbox
  - name: Devbox-FileTools
  - name: Devbox-Lifecycle
  - name: Devbox-NetworkTools
  - name: Devbox-ObservabilityTools
  - name: Devbox-PersistenceTools
  - name: Devbox-ShellTools
  - name: Scenario
  - name: ScenarioScorer
  - name: accounts
  - name: agents
  - name: apikeys
  - name: axons
  - name: executions
  - name: gateway-configs
  - name: mcp-configs
  - name: network-policies
  - name: objects
  - name: restricted_keys
  - name: secrets
  - name: streaming
paths:
  /v1/axons/{id}/sql/batch:
    post:
      tags:
        - axons
      summary: '[Beta] Execute a batch of SQL statements against an axon''s database.'
      description: >-
        [Beta] Execute multiple SQL statements atomically within a single
        transaction against an axon's SQLite database.
      operationId: axonSqlBatch
      parameters:
        - name: id
          in: path
          description: The axon identifier.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SqlBatchParams'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SqlBatchResultView'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Runloop from '@runloop/api-client';


            const client = new Runloop({
              bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
            });


            const sqlBatchResultView = await client.axons.sql.batch('id', {
            statements: [{ sql: 'sql' }] });


            console.log(sqlBatchResultView.results);
        - lang: Python
          source: |-
            import os
            from runloop_api_client import Runloop

            client = Runloop(
                bearer_token=os.environ.get("RUNLOOP_API_KEY"),  # This is the default and can be omitted
            )
            sql_batch_result_view = client.axons.sql.batch(
                id="id",
                statements=[{
                    "sql": "sql"
                }],
            )
            print(sql_batch_result_view.results)
components:
  schemas:
    SqlBatchParams:
      type: object
      properties:
        statements:
          type: array
          items:
            $ref: '#/components/schemas/SqlStatementParams'
          description: The SQL statements to execute atomically within a transaction.
      required:
        - statements
    SqlBatchResultView:
      type: object
      properties:
        results:
          type: array
          items:
            $ref: '#/components/schemas/SqlStepResultView'
          description: One result per statement, in order.
      required:
        - results
    SqlStatementParams:
      type: object
      properties:
        sql:
          type: string
          description: SQL query with ?-style positional placeholders.
        params:
          type: array
          items:
            type: object
          description: Positional parameter bindings for ? placeholders.
      required:
        - sql
    SqlStepResultView:
      type: object
      properties:
        success:
          description: Result on success.
          anyOf:
            - $ref: '#/components/schemas/SqlQueryResultView'
            - type: 'null'
        error:
          description: Error on failure.
          anyOf:
            - $ref: '#/components/schemas/SqlStepErrorView'
            - type: 'null'
    SqlQueryResultView:
      type: object
      properties:
        columns:
          type: array
          items:
            $ref: '#/components/schemas/SqlColumnMetaView'
          description: Column metadata.
        rows:
          type: array
          items:
            type: object
          description: Result rows (empty for non-SELECT statements).
        meta:
          $ref: '#/components/schemas/SqlResultMetaView'
          description: Execution metadata.
      required:
        - columns
        - rows
        - meta
    SqlStepErrorView:
      type: object
      properties:
        message:
          type: string
          description: Error message.
      required:
        - message
    SqlColumnMetaView:
      type: object
      properties:
        name:
          type: string
          description: Column name or alias.
        type:
          type: string
          description: Declared type (TEXT, INTEGER, REAL, BLOB, or empty).
      required:
        - name
        - type
    SqlResultMetaView:
      type: object
      properties:
        duration_ms:
          type: number
          format: double
          description: Execution time in milliseconds.
        changes:
          type: integer
          format: int64
          description: Rows modified by INSERT/UPDATE/DELETE.
        rows_read_limit_reached:
          type: boolean
          description: True when result was truncated at the row limit.
      required:
        - duration_ms
        - changes
        - rows_read_limit_reached
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````