---
title: "Execute a query into a database"
method: POST
path: "/workspace/sql/databases/{database_id}/query"
tags: ["SQL"]
---

# Execute a query into a database

`POST /workspace/sql/databases/{database_id}/query`

Execute a query into a database for your account.

## Path parameters

- `database_id` integer, required

## Request body

- SQLStatementsRequest
  - `statements` string[], required — List of SQL statements to execute

## Response `200`

SQL query executed successfully.

- SQLResultResponse
  - `state` string
  - `data` SQLResult, required
    - `columns` unknown[], required — List of column names
      - unknown
    - `rows` unknown[], required — List of result rows
      - unknown

## Other responses

- `202` — SQL query execution request accepted and is being processed asynchronously.
- `400` — Validation Error
- `401` — Authentication Failed
- `403` — Permission Denied
- `404` — Not Found
- `405` — Method Not Allowed
- `406` — Not Acceptable
- `422` — Unprocessable Entity
- `429` — Throttled
- `500` — Internal Server Error

---

[API](https://skmtc.dev/azion/apis/azion-api.md) · [All operations](https://skmtc.dev/azion/apis/azion-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/azion/azion-api/revisions/bb3250697218/schema)
