---
title: "SQL query"
method: POST
path: "/sql/{owner}/{id}"
tags: ["queries"]
---

# SQL query

`POST /sql/{owner}/{id}`

Execute a SQL query against a dataset or data project.

SQL results are available in a variety of formats. By default, `application/json` will be returned. Set
the `Accept` header to one of the following values in accordance with your preference:

* `text/csv`
* `application/json`
* `application/json-l`
* `application/x-ndjson`

New to SQL? Check out data.world's [SQL manual](https://docs.data.world/tutorials/dwsql/) .

## Path parameters

- `owner` string, required
- `id` string, required

## Query parameters

- `dialect` 'DW_SQL' | 'POSTGRESQL'
- `diagnose` boolean

## Request body

- SqlQueryRequest
  - `datasetVersions` string
  - `includeTableSchema` boolean
  - `query` string, required
  - `queryRunToken` string

## Response `200`

default response

---

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