---
title: "Validate a Flink SQL query"
method: POST
path: "/v1/validation/sql/flink"
tags: ["Validation"]
---

# Validate a Flink SQL query

`POST /v1/validation/sql/flink`

## Request

- Base URL: `https://docs.grepr.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://docs.grepr.ai/v1/validation/sql/flink`
- Auth: one of:
  - API key in header `GREPR-API-KEY`
  - OpenID Connect (`https://grepr-prod.us.auth0.com/.well-known/openid-configuration`)

Validates that the given Flink SQL query is valid.

## Request body

- string

## Response `200`

The query is valid.

- ParseQueryResponse
  - `errorMessage` string: The error message if there is an error
  - `parsedQuery` ParsedQueryTree: The parsed query tree
    - `root` union
      - object
        - `attribute` string, required: The attribute name
        - `term` string, required: The term to match. This is a string that is matched against the attribute.
        - `type` 'attribute-node', required: A node that matches an attribute in a parsed query.
      - object
        - `attribute` string, required: The string that is matched against the attribute key.
        - `type` 'attribute-key-term-node', required: A node that represents an attribute key in a parsed query.
      - object
        - `attribute` string, required: This is the attribute that is matched against the value of the regex field.
        - `regex` string, required: The regex to match. This is a regex string that is matched against the value of the attribute field.
        - `type` 'attribute-re2-node', required: A node that represents an attribute regex in a parsed query.
      - object
        - `attribute` string, required: The attribute name
        - `type` 'attribute-wildcard-node', required: A node that represents an attribute wildcard in a parsed query.
        - `wildcard` string, required: The term to match. This is a wildcard string that contains wildcards
      - object
        - `attribute` string, required: The attribute name
        - `prefix` string, required: The prefix to match in the attribute.
        - `type` 'attribute-prefix-node', required: A node that represents an attribute with a prefix in a parsed query.
      - object
        - `attribute` string, required: The attribute name
        - `comparator` 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL' | 'EQUAL' | 'NOT_EQUAL', required: The comparator to use for the match.
        - `term` string, required: The term to match. This is a string that is matched against the attribute.
        - `type` 'attribute-comparator-node', required: A node that matches an attribute in a parsed query.
      - object
        - `exactValue` string, required: The exact message value to match.
        - `type` 'message-exact-match-node', required: A node that represents an exact message match in a parsed query.
      - object
        - `maxLength` integer: Inclusive maximum message length in characters. Null means no upper bound.
        - `minLength` integer: Inclusive minimum message length in characters. Null means no lower bound.
        - `type` 'message-length-node', required: A node representing a message-length filter in a parsed query.
      - object
        - `term` string, required: The message term to match.
        - `type` 'message-node', required: A node that represents a message term match in a parsed query.
      - object
        - `regex` string, required: The regex to match. This is a regex string that is matched against the message.
        - `type` 'message-re2-node', required: A node that represents a message regex in a parsed query.
      - object
        - `type` 'message-wildcard-node', required: A node that represents a message wildcard in a parsed query.
        - `wildcard` string, required: The message with wildcard to match. This is a string that is matched against the message.
      - object
        - `prefix` string, required: The prefix to match a message.
        - `type` 'message-prefix-node', required: A node that represents a message prefix in a parsed query.
      - object
        - `terms` string[], required: The terms in a phrase to match
        - `type` 'phrase-node', required: A node that represents a phrase match in a parsed query.
      - object
        - `tagKey` string, required: This is a string that is matched against the tag key.
        - `type` 'tag-key-node', required: A node that represents a tag key in a parsed query.
      - object
        - `type` 'tag-key-wildcard-node', required: A node that represents a tag key wildcard in a parsed query.
        - `wildcard` string, required: This is a wildcarded string that is matched against the tag key.
      - object
        - `prefix` string, required: This is a string that is matched against the tag key prefix.
        - `type` 'tag-key-prefix-node', required: A node that represents a tag key prefix in a parsed query.
      - object
        - `tagKey` string, required: The tag key
        - `tagValue` string, required: This is a string that is matched against the tag value.
        - `type` 'tag-node', required: A node that represents a tag key and value in a parsed query.
      - object
        - `tagKey` string, required: The tag key
        - `type` 'tag-wildcard-node', required: A node that represents a tag wildcard in a parsed query.
        - `wildcard` string, required: This is a string including wildcards that is matched against the tag value.
      - object
        - `prefix` string, required: This is a prefix that is matched against the tag value.
        - `tagKey` string, required: This is a string that is matched against the tag key.
        - `type` 'tag-prefix-node', required: A node that represents a tag prefix in a parsed query.
      - object
        - `regex` string, required: The regex to match. This is a regex string that is matched against the tag
        - `tagKey` string, required: This is a string that is matched against the tag key.
        - `type` 'tag-re2-node', required: A node that represents a tag regex in a parsed query.
      - object
        - `comparator` 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL' | 'EQUAL' | 'NOT_EQUAL', required: The comparator to use for the match.
        - `tagKey` string, required: The tag name
        - `term` string, required: The term to match. This is a string that is matched against the tag.
        - `type` 'tag-comparator-node', required: A node that compares a tag in a parsed query.
      - object
        - `comparator` 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL' | 'EQUAL' | 'NOT_EQUAL', required: The comparator to use for the match.
        - `severity` integer, required: The severity level to match. This is an integer that is matched against the severity.
        - `type` 'severity-node', required: A node that represents a severity in a parsed query.
      - object
        - `expression` ParsedQueryNode, required (recursive)
        - `type` 'not-query-node', required: A node that represents a negation in a parsed query.
      - object
        - `expressions` ParsedQueryNode[], required: The and query node. This is a list of expressions that are combined with an AND operator.
        - `type` 'and-query-node', required: A node that represents AND operator in a parsed query.
      - object
        - `expressions` ParsedQueryNode[], required: This is a list of expressions that are combined with an OR operator.
        - `type` 'or-query-node', required: A node that represents a logical OR in a parsed query.
      - object
        - `type` 'all-query-node', required: A node that represents a parsed query that matches all.
  - `valid` boolean: Whether a query is valid.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized

---

[API](https://skmtc.dev/grepr/apis/grepr-api.md) - [All operations](https://skmtc.dev/grepr/apis/grepr-api/llms.txt) - [OpenAPI document](https://skmtc.dev/grepr/apis/grepr-api/revisions/2a5ce03a0bf0?raw)
