---
title: "Get SQL grammar"
method: GET
path: "/v2/data/query/grammar"
tags: ["SQL API"]
---

# Get SQL grammar

`GET /v2/data/query/grammar`

## Request

- Base URL: `https://api.cdp.coinbase.com/platform`
- URL: `https://api.cdp.coinbase.com/platform/v2/data/query/grammar`
- Auth: HTTP bearer

Retrieve the SQL grammar for the SQL API.

The SQL queries that are supported by the SQL API are defined in ANTLR4 grammar which is evaluated by server before executing the query. This ensures the safety and soundness of the SQL query before execution.

This endpoint returns the ANTLR4 grammar that is used to evaluate the SQL queries so that developers can understand the SQL API and build SQL queries with high confidence and correctness.

LLMs interact well with ANTLR4 grammar. You can feed the grammar directly into the LLMs to help generate SQL queries.

## Response `200`

SQL grammar retrieved successfully.

- string: The ANTLR4 grammar for the SQL API.

## Other responses

- `401`: Unauthorized.
- `429`: Rate limit exceeded.
- `500`: Internal server error.
- `504`: The request timed out.

## Changes

- **2026-12-01** `06cb41a4fb57`: 4 warning
  - added the new `policy_not_applicable` enum value to the `errorType` response property for the response status `401`
  - added the new `policy_not_applicable` enum value to the `errorType` response property for the response status `429`
  - added the new `policy_not_applicable` enum value to the `errorType` response property for the response status `500`
  - added the new `policy_not_applicable` enum value to the `errorType` response property for the response status `504`
- **2026-10-16** `ff3c1fdef902`: 4 warning
  - added the new `entity_not_configured_for_top_up` enum value to the `errorType` response property for the response status `401`
  - added the new `entity_not_configured_for_top_up` enum value to the `errorType` response property for the response status `429`
  - added the new `entity_not_configured_for_top_up` enum value to the `errorType` response property for the response status `500`
  - added the new `entity_not_configured_for_top_up` enum value to the `errorType` response property for the response status `504`
- …earlier changes not shown

[Operation history](https://skmtc.dev/coinbase/apis/coinbase-developer-platform-apis/changes/v2/data/query/grammar/get.md)

---

[API](https://skmtc.dev/coinbase/apis/coinbase-developer-platform-apis.md) - [All operations](https://skmtc.dev/coinbase/apis/coinbase-developer-platform-apis/llms.txt) - [OpenAPI document](https://skmtc.dev/coinbase/apis/coinbase-developer-platform-apis/revisions/06cb41a4fb57?raw)
