API Reference (beta)

The parsers.dev API is organized around REST with JSON request and responses and uses standard HTTP response codes.

Authentication

The parsers.dev API uses API key to authenticate requests. You can view and manage your API key in the parsers.dev Account Settings.

The parsers.dev APIs is a REST-based service. Subsequently, all requests to the APIs require this HTTP header:

x-api-key: Your parsers.dev API key

Content type

The parsers.dev APIs is also a JSON-based service. You have to add Content-Type HTTP header to all your requests:

Content-Type: application/json

URL and API versioning

Only one API version is operating at this time. Use this base URL for your requests:

https://api.parsers.dev/api/v1

Responses

All responses are JSON-based and follow one of these formats:

// successful response
{
  "status": "OK",
  "data": {...}
  }
}

Http codes and error message you can find at Errors section

Parse SQL (SQL → AST)

POST https://api.parsers.dev/api/v1/parse/:dialect

This endpoint allows you to get Abstract Syntax Tree represented in your SQL-queries. You can parse any supported syntax (DDL, DML, DCL, TCL, and another specific syntax). :dialect is SQL dialect type (postgresql, snowflake and cypher are supported)

Headers

Name
Type
Description

x-api-key

string

Authentication token (your api key from parsers.dev or holistic.dev account settings)

Request Body

Name
Type
Description

sql

string

SQL source code, separated using semicolon

Example:

Compile SQL (SQL → Special Object)

POST https://api.parsers.dev/api/v1/compile/:dialect

This endpoint allows you to get a special object compiled based on your DDL or DML query. Because DML strictly depends on database schema (DDL), DML can be compiled to a special object, based on DDL only. :dialect is SQL dialect type (postgresql and snowflake only).

Query Parameters

Name
Type
Description

ast

string

any value for AST in result

Headers

Name
Type
Description

x-api-key

string

Authentication token (your api key from parsers.dev or holistic.dev account settings)

Request Body

Name
Type
Description

ddl

string

Database schema (DDL statements) source code, separated using semicolon

dmls

array

An array of DML queries. Each query can consist of many statements, separated using a semicolon

Example:

Snowflake GET_DDL function result reorder

POST https://api.parsers.dev/api/v1/tools/snowflake/getddl-reorder

Fix DDL statements ordering in GET_DDL function result

Headers

Name
Type
Description

x-api-key

string

Authentication token (your api key from parsers.dev or holistic.dev account settings)

Request Body

Name
Type
Description

sql

string

DDL need to reorder

Example:

Last updated

Was this helpful?