---
title: "Run one SQL statement and get the rows; the SQL console's mode decides whether it may write"
method: POST
path: "/instances/{instance_id}/engines/postgres/query"
tags: ["engines"]
---

# Run one SQL statement and get the rows; the SQL console's mode decides whether it may write

`POST /instances/{instance_id}/engines/postgres/query`

## Request

- Base URL: `https://app.lathe.live/api/v1`
- URL: `https://app.lathe.live/api/v1/instances/{instance_id}/engines/postgres/query`
- Auth: none declared

## Path parameters

- `instance_id` string, required

## Request body

- SqlIn
  - `sql` string, required: One SQL statement. The SQL console's mode decides what it may do: `ro` runs it on the box's read-only role, so a write is refused by Postgres itself; `rw` runs it as the owner.
  - `database` string, nullable: Which database to run it on; the console's database when omitted.

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/lathe/apis/lathe-customer-api.md) · [All operations](https://skmtc.dev/lathe/apis/lathe-customer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/lathe/apis/lathe-customer-api/revisions/68cfd9bb71c1?raw)
