# Search Jira work items with JQL using the REST API

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

JQL search is /rest/api/3/search/jql, as POST with a JSON body or GET with query parameters. It pages with nextPageToken instead of startAt, has no total, and returns only the work item id unless fields lists more. The old /rest/api/3/search is gone and answers 410.

## Endpoints

| Method | Path | What it does |
|---|---|---|
| POST | `/rest/api/3/search/jql` | Searches with a JSON body. |
| GET | `/rest/api/3/search/jql` | Searches with query parameters. |

## Examples

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

Asks for one work item per page with summary and status. The response carries nextPageToken and isLast false.

```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 summary ~ \"REST API reference test\" ORDER BY created ASC",
  "fields": [
    "summary",
    "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 summary ~ "REST API reference test" ORDER BY created ASC',
          'fields': ['summary', 'status'],
          'maxResults': 1},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "issues": [
  {
   "key": "WEB-55",
   "fields": {
    "summary": "REST API reference test issue",
    "status": {
     "name": "In Progress"
    }
   }
  }
 ],
 "nextPageToken": "CkhjcmVhdGVkJmNyZWF0ZWQmT1JERVJfQVNDI0xvbmcmTVRjNU5UazNNek0xTlRZNU9BPT0lU3RyaW5nJlYwVkMlSW50Jk5UVT0QARiRle_CojQiSnByb2plY3QgPSBXRUIgQU5EIHN1bW1hcnkgfiAiUkVTVCBBUEkgcmVmZXJlbmNlIHRlc3QiIE9SREVSIEJZIGNyZWF0ZWQgQVNDKgJbXQ==",
 "isLast": false
}
```

Response headers:

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

Sent to Atlassian Cloud on 29 Nov 2026.

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

Sends the same query again with the token. The last page has isLast true and no token.

```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 summary ~ \"REST API reference test\" ORDER BY created ASC",
  "fields": [
    "summary",
    "status"
  ],
  "maxResults": 1,
  "nextPageToken": "{nextPageToken}"
}' \
  '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 summary ~ "REST API reference test" ORDER BY created ASC',
          'fields': ['summary', 'status'],
          'maxResults': 1,
          'nextPageToken': '{nextPageToken}'},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "issues": [
  {
   "key": "WEB-56",
   "fields": {
    "summary": "REST API reference test issue2 - delete"
   }
  }
 ],
 "isLast": true
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### GET /rest/api/3/search/jql

The GET form, with fields and maxResults as query parameters.

```bash
curl -G \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  --data-urlencode 'jql=project = WEB AND summary ~ "REST API reference test" ORDER BY created ASC' \
  --data-urlencode 'fields=summary' \
  --data-urlencode 'maxResults=2' \
  'https://your-domain.atlassian.net/rest/api/3/search/jql'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.get(
    'https://your-domain.atlassian.net/rest/api/3/search/jql',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    params={'jql': 'project = WEB AND summary ~ "REST API reference test" ORDER BY created ASC',
 'fields': 'summary',
 'maxResults': '2'},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "issues": [
  {
   "key": "WEB-55",
   "fields": {
    "summary": "REST API reference test issue"
   }
  },
  {
   "key": "WEB-56",
   "fields": {
    "summary": "REST API reference test issue2 - delete"
   }
  }
 ],
 "isLast": true
}
```

Response headers:

```
X-Ratelimit-Limit: 350
```

Sent to Atlassian Cloud on 29 Nov 2026.

### GET /rest/api/3/search/jql

Leaves fields out. Each work item comes back with its id only.

```bash
curl -G \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  --data-urlencode 'jql=project = WEB AND summary ~ "REST API reference test" ORDER BY created ASC' \
  --data-urlencode 'maxResults=1' \
  'https://your-domain.atlassian.net/rest/api/3/search/jql'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.get(
    'https://your-domain.atlassian.net/rest/api/3/search/jql',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    params={'jql': 'project = WEB AND summary ~ "REST API reference test" ORDER BY created ASC',
 'maxResults': '1'},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "issues": [
  {
   "id": "10766"
  }
 ],
 "isLast": false
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

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

A query that ends after the operator. The message names the position problem.

```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.

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

A query with only an ORDER BY. It has no search restriction and is refused.

```bash
curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "jql": "order by created DESC",
  "maxResults": 1,
  "fields": [
    "summary"
  ]
}' \
  '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': 'order by created DESC', 'maxResults': 1, 'fields': ['summary']},
)
print(r.status_code, r.text)
```

Response: HTTP 400

```
{
 "errorMessages": [
  "Unbounded JQL queries are not allowed here. Please add a search restriction to your query."
 ],
 "errors": {}
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### GET /rest/api/3/search

The previous GET /rest/api/3/search. It answers 410 and names the replacement.

```bash
curl -G \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  --data-urlencode 'jql=project = WEB' \
  --data-urlencode 'maxResults=1' \
  'https://your-domain.atlassian.net/rest/api/3/search'
```

```python
import os
import requests

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

Response: HTTP 410

```
{
 "errorMessages": [
  "The requested API has been removed. Please migrate to the /rest/api/3/search/jql API. A full migration guideline is available at https://developer.atlassian.com/changelog/#CHANGE-2046"
 ],
 "errors": {}
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

## How it behaves

- The response has no total. Paging is done with nextPageToken, and the last page leaves that key out and sets isLast to true.
- Without fields, each issue object held only id. The spec states the default is id.
- fields=*all returned 51 fields for one work item, including customfield_ entries, while fields=summary returned only summary.
- POST /rest/api/2/search/jql worked as well and gave the same shape, with self links under /rest/api/2/.
- A JQL syntax error and an unbounded query both gave 400 with the reason in errorMessages. The old GET /rest/api/3/search and /rest/api/2/search gave 410.

## Pitfalls

- Loop until isLast is true. A short page does not mean the end, because maxResults can be lowered when many fields are requested.
- Send the same jql, fields and maxResults with every nextPageToken. The follow-up run repeated all three.
- Add a restriction such as project = KEY before ORDER BY. A bare order by is a 400.
- Name the fields you need. Asking for *all makes pages heavy, and the spec says the page size is largest when only id or key is requested.

## Questions and answers

### Why is there no total in the search response?

The enhanced search pages with nextPageToken and does not count. POST /rest/api/3/search/approximate-count gives an estimate.

### Why do I only get ids back?

fields defaults to id. List the fields you want, or use *navigable or *all.

## Related

- [Approximate count](https://goingstellar.ro/reference/atlassian-rest-api/approximate-count/)
- [The removed /search endpoint](https://goingstellar.ro/reference/atlassian-rest-api/removed-search-endpoint/)
- [nextPageToken in Jira search](https://goingstellar.ro/reference/atlassian-rest-api/pagination-nextpagetoken/)
- [Parse and validate JQL](https://goingstellar.ro/reference/atlassian-rest-api/jql-parse/)
- [expand, fields and properties parameters](https://goingstellar.ro/reference/atlassian-rest-api/expand-fields-properties/)

## Sources

- [The Jira Cloud platform REST API v3 (Atlassian Developer)](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/)
- [Search for issues using JQL enhanced search (POST) (Jira REST API v3)](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-jql-post)

