---
title: "Run one read-only query on a SQL script connection"
method: POST
path: "/api/script-connections/{id}/sql-query"
tags: ["Script Connections"]
---

# Run one read-only query on a SQL script connection

`POST /api/script-connections/{id}/sql-query`

## Request

- Base URL: `http://localhost:3013`
- URL: `http://localhost:3013/api/script-connections/{id}/sql-query`
- Auth: HTTP bearer

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `sql` string, required
  - `params` unknown[]
    - unknown

## Response `200`

Query rows or a scrubbed error

- union
  - object
    - `ok` true, required
    - `rows` object[], required
    - `rowCount` number, required
    - `truncated` boolean, required
  - object
    - `ok` false, required
    - `error` string, required

## Other responses

- `400`: Invalid SQL connection or request
- `403`: Not allowed to invoke this SQL connection
- `404`: Script connection or agent not found

## Changes

- **2026-10-14** `e480954b929f`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/desplega-ai/apis/agent-swarm-api/changes/api/script-connections/:id/sql-query/post.md)

---

[API](https://skmtc.dev/desplega-ai/apis/agent-swarm-api.md) - [All operations](https://skmtc.dev/desplega-ai/apis/agent-swarm-api/llms.txt) - [OpenAPI document](https://skmtc.dev/desplega-ai/apis/agent-swarm-api/revisions/7e4c7198192a?raw)
