SQL API

Get SQL grammar

Changed on

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.

get/v2/data/query/grammar

Request

  • Base URL
    https://api.cdp.coinbase.com/platform
  • Auth
    HTTP bearer

Response

SQL grammar retrieved successfully.

string required

The ANTLR4 grammar for the SQL API.

Example response

"grammar SqlQuery; query: cteClause? unionStatement SEMICOLON? EOF;"

Changes

    • warning

      added the new policy_not_applicable enum value to the errorType response property for the response status

    • warning

      added the new policy_not_applicable enum value to the errorType response property for the response status

    • warning

      added the new policy_not_applicable enum value to the errorType response property for the response status

    1 more change in this revision