Stored JQL keys
Stored JQL keys are available in API Key Manager for Jira.
A Stored JQL key can only search Jira, and the search is fixed on the key. The JQL query and any other search parameter you set are baked in: a request that tries to send them is rejected, not merged or overwritten.
That makes it a safe way to hand a dashboard, report or partner a live view of one saved search without giving them any way to look at anything else.
Creating one
Click Create Stored JQL Key.
| Field | Notes |
|---|---|
| Description (required) | A meaningful, unique name for the key. |
| Valid Until | Defaults to 30 days from today. |
| JQL | The query this key is tied to. Leave blank to let requests send their own JQL. |
| Fields | Comma separated, e.g. summary,status. |
| Expand | e.g. names,renderedFields. |
| Properties | Comma separated issue properties (at most 5). |
| Max results | Page size, 1 to 5000. |
| Reconcile issues | Comma separated issue ids (at most 50) to reconcile with the search results. |
| Fields by keys | true, false or Not fixed (set by the request). Reference fields by key instead of id. |
| Include archived projects | true, false or Not fixed (set by the request). |
Every field except the description is optional. Anything you fill in is fixed. Anything you leave empty stays free for the request to choose.
Live JQL validation
While you type in the JQL field, the app checks the query with Jira's own parser and tells you whether it is valid. An invalid query cannot be saved, and saving waits while a check is still running. If Jira cannot be reached for the check, you see The JQL could not be checked right now. The query is checked again when you click Add; if Jira still cannot be reached, the key is not created and you are asked to try again.
What the key is allowed to do
- Methods:
GETandPOST. - Endpoint:
/rest/api/3/search/jqlonly (Jira's "search for issues using JQL (enhanced search)"). The path must match exactly. - Searches run as the app, so they return only issues the app can see.
In the key list, the key shows as Stored JQL, and the Allowed Endpoints / Configuration column lists everything that is fixed on it.
Making requests
With JQL set to project = DEV AND statusCategory != Done and Fields set to summary,status on the key:
GET
curl -X POST <YOUR ENDPOINT URL> --header "apikey: <YOUR API KEY>" --data '
{
"options": {
"method": "GET",
"headers": { "Accept": "application/json" }
},
"url": "/rest/api/3/search/jql"
}'
POST
curl -X POST <YOUR ENDPOINT URL> --header "apikey: <YOUR API KEY>" --data '
{
"options": {
"method": "POST",
"headers": { "Accept": "application/json", "Content-Type": "application/json" }
},
"url": "/rest/api/3/search/jql"
}'
Neither request sends jql or fields, because both are fixed.
Paging through results
The pagination cursor is never fixed. Jira returns a nextPageToken when there are more results; send it back to get the next page.
{
"options": { "method": "GET", "headers": { "Accept": "application/json" } },
"url": "/rest/api/3/search/jql?nextPageToken=<TOKEN FROM THE PREVIOUS RESPONSE>"
}
With POST, put nextPageToken in the request body instead:
{
"options": {
"method": "POST",
"headers": { "Accept": "application/json", "Content-Type": "application/json" },
"body": { "nextPageToken": "<TOKEN FROM THE PREVIOUS RESPONSE>" }
},
"url": "/rest/api/3/search/jql"
}
Parameters the request may send
Whatever is not fixed on the key can be sent by the request, either in the URL or in the JSON body, but not both at once. The parameters are jql, nextPageToken, maxResults, fields, expand, properties, fieldsByKeys, reconcileIssues and includeArchivedProjects. failFast is also accepted, but only with GET, and it can not be fixed on a key.
In a URL, lists are comma separated (fields=summary,status). In a body, they are JSON arrays.
Errors
Problems with a Stored JQL request come back with a JSON body of the form {"errorMessages": ["..."]} that says what is wrong.
| Status | When | Example message |
|---|---|---|
403 | The request sends a parameter that is fixed on the key | This API key is tied to a stored JQL query. The 'jql' parameter is fixed and must not be sent in the request. Remove it from the URL and the request body. |
403 | The request sends an unknown parameter | Unknown parameter 'foo'. |
403 | A parameter is sent twice (URL and body) | Parameter 'maxResults' was supplied more than once (URL and/or body). |
403 | failFast is sent with POST | Parameter 'failFast' is not supported with POST. |
400 | A value has the wrong type or is out of range | Parameter 'maxResults' must not be greater than 5000. |
400 | The request body is not a JSON object | The request body must be a JSON object. |
All problems of one request are reported together. Nothing of the original request is passed on to Jira other than the validated parameters: the forwarded request is built from the key's configuration and the accepted values.
Stored JQL key or pinned endpoint?
You can also lock a generic key to one search with a pinned endpoint. Prefer a Stored JQL key: it validates the JQL, supports POST, handles paging, and shows its configuration in the key list.