---
title: "Run a batch of DuckDB queries synchronously and return results"
method: POST
path: "/v4/query/jobs/batch/run"
tags: ["v4", "Query Jobs"]
---

# Run a batch of DuckDB queries synchronously and return results

`POST /v4/query/jobs/batch/run`

Run multiple DuckDB queries on a single K8s container and wait for completion.

Returns results directly once the job finishes. Timeout is bounded by Cloud Run's
request limit (3600s). For longer workloads use POST /v4/query/jobs/batch with polling.

## Request body

- SubmitDuckDBBatchJobRequest
  - `queries` BatchQueryItem[], required — Ordered list of queries to run on the container
    - `sql` string, required — SQL query to execute
    - `queryType` 'json' | 'arrow' | 'exec' — Query type for this item: 'arrow', 'json', or 'exec'
  - `mode` 'serial' | 'parallel'
  - `resources` ComputeResourceRequest — Compute resource request shared by the DuckDB cluster and E2B sandbox paths. Defaults are sized for the DuckDB cluster. Non-DuckDB callers must check `model_fields_set` before reading `cpu`/`memory`, otherwise the DuckDB defaults will be used for other engines — see `defapi.config.e2b.select_e2b_sandbox_tier` for an example.
    - `cpu` string — CPU cores in Kubernetes format (e.g., '4', '2.5', '500m')
    - `memory` string — Memory in Kubernetes format (e.g., '16Gi', '512Mi', '1G')
    - `timeoutSeconds` integer — Job timeout in seconds (60-604800, default 3600)
  - `integrationId` union — Optional integration ID. If not provided, uses team's default Ducklake integration.
    - string, uuid
    - string
  - `blockId` union — Optional block ID associated with the job
    - string, uuid
    - string

## Response `200`

Success

- SuccessResponseDuckDBBatchJobResultResponse
  - `success` true, required — Flag for it request was successful
  - `data` DuckDBBatchJobResultResponse, required
    - `jobId` string, required — Job identifier
    - `results` DuckDBBatchQueryResult[], required — Per-query results, index-aligned with the original request's queries list
      - `queryIndex` integer, required — Zero-based index of this query in the original batch
      - `data` object[] — Query result rows (empty for exec queries)
      - `rowCount` integer, required — Number of rows returned
    - `durationMs` integer, nullable — Total job execution duration in milliseconds
  - `meta` ResponseMeta
    - `requestId` string — Unique request identifier for tracing
    - `timestamp` string, date-time — Response timestamp (UTC)
    - `durationMs` integer, nullable — Request processing time in milliseconds

## Other responses

- `401` — Auth Invalid Token
- `403` — Forbidden Insufficient Permissions
- `404` — Resource Not Found
- `422` — Validation Failed
- `426` — Business Quota Exceeded
- `500` — Internal Error

---

[API](https://skmtc.dev/definite/apis/defapi.md) · [All operations](https://skmtc.dev/definite/apis/defapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/definite/defapi/revisions/3943d8deb3be/schema)
