# Parse and validate JQL with the Jira REST API

URL: https://goingstellar.ro/reference/atlassian-rest-api/jql-parse/

POST /rest/api/3/jql/parse takes an array of queries and a validation mode and returns one result per query. A valid query comes back as a structure of clauses. An invalid one comes back inside the 200 response with an errors array, so the HTTP status does not tell you whether the JQL was good.

## Endpoints

| Method | Path | What it does |
|---|---|---|
| POST | `/rest/api/3/jql/parse` | Parses and validates JQL queries. |
| GET | `/rest/api/3/jql/autocompletedata` | Lists the field names, functions and reserved words the parser knows. |

## Examples

### POST /rest/api/3/jql/parse

Parses a valid and an invalid query in one call with validation=strict.

```bash
curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "queries": [
    "project = WEB AND status = Done",
    "project = "
  ]
}' \
  'https://your-domain.atlassian.net/rest/api/3/jql/parse?validation=strict'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.post(
    'https://your-domain.atlassian.net/rest/api/3/jql/parse?validation=strict',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    params={'validation': 'strict'},
    json={'queries': ['project = WEB AND status = Done', 'project = ']},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "queries": [
  {
   "query": "project = WEB AND status = Done",
   "structure": {
    "where": {
     "clauses": [
      {
       "field": {
        "name": "project",
        "encodedName": "project"
       },
       "operator": "=",
       "operand": {
        "value": "WEB",
        "encodedValue": "WEB"
       }
      },
      {
       "field": {
        "name": "status",
        "encodedName": "status"
       },
       "operator": "=",
       "operand": {
        "value": "Done",
        "encodedValue": "Done"
       }
      }
     ],
     "operator": "and"
    }
   }
  },
  {
   "query": "project = ",
   "errors": [
    "Error in JQL Query: Expecting either a value, list or function before the end of the query."
   ],
   "warnings": []
  }
 ]
}
```

Response headers:

```
X-Ratelimit-Limit: 200
```

Sent to Atlassian Cloud on 29 Nov 2026.

### POST /rest/api/3/search/jql

The same broken JQL sent to the search endpoint is a 400 with the same message text.

```bash
curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "jql": "project = WEB AND status = ",
  "maxResults": 1
}' \
  'https://your-domain.atlassian.net/rest/api/3/search/jql'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.post(
    'https://your-domain.atlassian.net/rest/api/3/search/jql',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    json={'jql': 'project = WEB AND status = ', 'maxResults': 1},
)
print(r.status_code, r.text)
```

Response: HTTP 400

```
{
 "errorMessages": [
  "Error in JQL Query: Expecting either a value, list or function before the end of the query."
 ],
 "errors": {}
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### GET /rest/api/3/jql/autocompletedata

The reference data behind the parser, with the field names and operators it accepts.

```bash
curl \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  'https://your-domain.atlassian.net/rest/api/3/jql/autocompletedata'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.get(
    'https://your-domain.atlassian.net/rest/api/3/jql/autocompletedata',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "visibleFieldNames": [
  {
   "value": "\"[CHART] Date of First Response\"",
   "displayName": "[CHART] Date of First Response - cf[10026]",
   "orderable": "true",
   "searchable": "true",
   "operators": [
    "=",
    "!=",
    "in",
    "not in",
    "is",
    "is not",
    "<",
    "<=",
    ">",
    ">="
   ],
   "types": [
    "java.util.Date"
   ]
  },
  {
   "value": "\"[CHART] Time in Status\"",
   "displayName": "[CHART] Time in Status - cf[10027]",
   "orderable": "true",
   "searchable": "true",
   "operators": [
    "~",
    "!~",
    "is",
    "is not"
   ],
   "types": [
    "java.lang.String"
   ]
  }
 ]
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

## How it behaves

- A valid query returned structure.where with a clauses array. Each clause has field, operator and operand, and the combining operator is and.
- The invalid query "project = " returned an object with query, an errors array and an empty warnings array, and no structure key.
- The HTTP status was 200 although one of the two queries was invalid.
- The error text matches what the search endpoint returns for the same mistake, only as a 400 there.

## Pitfalls

- Check each result for errors instead of checking the status. A 200 can contain failed queries.
- The validation parameter is required. The spec lists strict, warn and none. With strict a failed query returns no structure, and with warn a correctly formed one keeps it.
- Validation runs in the context of the current user, as the spec states, so run it with the account that will run the search.

## Questions and answers

### Does parse return 400 for bad JQL?

Not in the run above. The invalid query came back inside a 200 response with an errors array.

## Related

- [Search with JQL](https://goingstellar.ro/reference/atlassian-rest-api/search-jql/)
- [JQL autocomplete](https://goingstellar.ro/reference/atlassian-rest-api/jql-autocomplete/)
- [Approximate count](https://goingstellar.ro/reference/atlassian-rest-api/approximate-count/)
- [Error response formats](https://goingstellar.ro/reference/atlassian-rest-api/error-responses/)

## Sources

- [The Jira Cloud platform REST API v3 (Atlassian Developer)](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/)
- [Parse JQL query (Jira REST API v3)](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-jql/#api-rest-api-3-jql-parse-post)

