---
title: "Run a SQL query against a Postgres connection"
method: POST
path: "/internal/query"
tags: ["Internal"]
---

# Run a SQL query against a Postgres connection

`POST /internal/query`

## Request body

- object
  - `connection_string` string
  - `url` string
  - `sql` string, required

## Response `200`

Query results

- object
  - `rows` object[], required
  - `rowCount` integer, required

## Other responses

- `400` — Invalid params

## Changes

- **2026-04-21** `d8cd1a3f22bd` — 1 info
  - response property `rowCount` list-of-types was narrowed by removing types `null` from media type `application/json` of response `200`
- **2026-04-21** `694b2a25cbc8` — 1 info
  - api operation id `internalQuery` was added
- **2026-04-21** `1c7cee73fe41` — 1 info
  - endpoint added
- **2026-04-05** `42d2d829b545` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/stripe/apis/stripe-sync-engine/changes/internal/query/post.md)

---

[API](https://skmtc.dev/stripe/apis/stripe-sync-engine.md) · [All operations](https://skmtc.dev/stripe/apis/stripe-sync-engine/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/stripe/stripe-sync-engine/revisions/7f4c6ed52875/schema)
