> For the complete documentation index, see [llms.txt](https://v2.dataos.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://v2.dataos.info/references/interfaces/apis/api-reference/graphql.md).

# GraphQL

Semantic GraphQL. Unlike the other [Query](/references/interfaces/apis/api-reference/query.md) endpoints, this one responds synchronously.

***

## POST /api/v1/query/semantic/graphql

**Summary:** Execute GraphQL query

**Description:** Standard GraphQL request against the semantic layer. Response is **synchronous** — submit a query and receive the full JSON response in a single HTTP request. No statement is created; do not poll `/query/statement`.

**cURL:**

```bash
curl -s -X POST https://$BASE_URL/api/v1/query/semantic/graphql \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query": "{ users { country total_users } }"}'
```

**Returns:** Standard GraphQL response: `{"data": {...}}` on success, or `{"errors": [...]}` on failure. GraphQL-level errors (invalid fields, resolver failures) surface as an `errors` array in the body, not as HTTP 4xx.

**Errors:**

* **503** — The GraphQL service is unreachable (connection error or DNS failure).
* **504 Gateway Timeout** — The upstream GraphQL service did not respond within the configured timeout (default 30s). Body: `{"errors": [{"message": "GraphQL service request timed out", "extensions": {"code": "GATEWAY_TIMEOUT"}}]}`.

***

## 504 Timeout and Resubmit

A `504` does not abort the underlying warehouse query — it continues running in the background regardless of the timeout. Resubmitting the same GraphQL query after a back-off is safe:

* If the original warehouse query is still running — it is deduplicated (`AWAIT_PRIMARY`). The resubmit waits for the original result; the warehouse query does not execute twice.
* If it already completed — the prior result is served immediately (`REUSE_RESULT`).

No statement ID is needed to resubmit. If timeouts recur despite retries, simplify the query (fewer fields, narrower time ranges) or contact the data product owner.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://v2.dataos.info/references/interfaces/apis/api-reference/graphql.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
