Skip to main content
POST
Query Database

Authorizations

Authorization
string
header
required

A Fly API token with access to the requested organization or resource. Send it as Authorization: Bearer <Fly API token>.

Path Parameters

postgres_cluster_id
string
required

Managed Postgres Cluster ID

database_name
string
required

Database Name

Body

application/json

Query

sql
string
required

SQL to run, up to 102400 bytes. Multiple statements are allowed; only the last result set is returned.

Example:

"SELECT id, email FROM users LIMIT 10"

Response

OK

columns
object[]

Columns of the final result set, in order.

row_count
integer

Number of rows returned.

rows
object[][]

Rows of the final result set; each row holds one JSON value per column, with NULL as null and json/jsonb as decoded JSON.