---
title: "Execute a DQL query"
method: POST
path: "/store/execute"
---

# Execute a DQL query

`POST /store/execute`

Execute a Ditto Query Language (DQL) statement against your data store. DQL is a powerful query language that supports complex queries, updates, and data manipulation. This endpoint serves as the primary interface for running DQL operations. See the comprehensive DQL guide for detailed syntax and examples.

## Headers

- `X-DITTO-TXN-ID` integer

## Request body

- QueryRequest — Request parameters for executing a DQL statement. DQL is Ditto's powerful query language that supports complex queries and data modifications.
  - `args` unknown
  - `statement` string, required — The DQL statement to execute. See https://docs.ditto.live/dql-guide for comprehensive documentation on DQL syntax and features.

## Response `200`

The DQL statement executed successfully. The response includes the results of the query, any mutated document IDs, the transaction ID, and any warnings that occurred during execution. For SELECT queries, results appear in the items array. For mutations, affected IDs appear in mutatedDocumentIds.

- QueryResponse — Response from executing a DQL statement. Contains query results, affected document IDs, and any warnings or errors that occurred.
  - `error` QueryResponseError — An error occurred that prevented the query from executing or completing successfully
    - `description` string
  - `items` AnyValue[], required
    - unknown
  - `mutatedDocumentIds` AnyValue[], required
    - unknown
  - `queryType` string, required — Indicates the type of query that was executed
  - `totalWarningsCount` integer, required — Total number of warnings generated during query execution
  - `transactionId` integer
  - `warnings` QueryResponseWarning[], required
    - `_id` unknown
    - `description` string, required

## Other responses

- `400` — The DQL statement was invalid or malformed. This could be due to syntax errors, invalid collection names, type mismatches, or other query validation failures. Check the error response for detailed information about what went wrong.
- `401` — Authentication failed. Ensure you're providing a valid API key or JWT token in the Authorization header and that it has sufficient permissions for the requested operation.
- `404` — The requested transaction ID (if specified) is not available on the Big Peer. This typically means the Big Peer has not yet reached that transaction ID or the transaction has been garbage collected.
- `408` — The query execution timed out. This can happen with complex queries over large datasets or when the system is under heavy load. Consider optimizing your query or adding appropriate indexes.
- `500` — An unexpected server error occurred while executing the query. This could be due to resource constraints, internal errors, or temporary service disruptions. The operation may succeed if retried.
- `503` — The service is temporarily unavailable, typically due to maintenance or capacity issues. Clients should implement exponential backoff and retry the request later.

---

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