---
title: "Run one bounded read-only Dev or Prod database query"
method: POST
path: "/v1/projects/{project_id}/database/query"
---

# Run one bounded read-only Dev or Prod database query

`POST /v1/projects/{project_id}/database/query`

## Request

- Base URL: `https://app.ohmyho.st`
- URL: `https://app.ohmyho.st/v1/projects/{project_id}/database/query`
- Auth: HTTP bearer

Executes one SELECT through the project's least-privilege read-only role. Application row-level security policies apply and may filter rows; a complete SQL archive uses the separate authorized export workflow. Connection credentials are never returned.

## Path parameters

- `project_id` string, required

## Headers

- `X-Request-Id` string

## Request body

- ProjectDatabaseQueryRequest
  - `environment` 'dev' | 'prod', required
  - `statement` string, required
  - `parameters` union[], required
    - union
      - string
      - number
      - boolean

## Response `200`

At most 100 JSON rows from the selected project database.

- ProjectDatabaseQueryResult
  - `environment` 'dev' | 'prod', required
  - `rows` object[], required
  - `row_count` integer, required
  - `truncated` boolean, required

## Other responses

- `400`: The request failed.
- `401`: The request failed.
- `403`: The request failed.
- `404`: The resource does not exist or is not visible to the authenticated principal.
- `429`: The request failed.
- `503`: The request failed.

---

[API](https://skmtc.dev/ohmyho/apis/ohmyho-st-api.md) · [All operations](https://skmtc.dev/ohmyho/apis/ohmyho-st-api/llms.txt) · [OpenAPI document](https://skmtc.dev/ohmyho/apis/ohmyho-st-api/revisions/d069888c0017?raw)
