Skip to main content

Stored JQL keys

Jira only

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.

FieldNotes
Description (required)A meaningful, unique name for the key.
Valid UntilDefaults to 30 days from today.
JQLThe query this key is tied to. Leave blank to let requests send their own JQL.
FieldsComma separated, e.g. summary,status.
Expande.g. names,renderedFields.
PropertiesComma separated issue properties (at most 5).
Max resultsPage size, 1 to 5000.
Reconcile issuesComma separated issue ids (at most 50) to reconcile with the search results.
Fields by keystrue, false or Not fixed (set by the request). Reference fields by key instead of id.
Include archived projectstrue, 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: GET and POST.
  • Endpoint: /rest/api/3/search/jql only (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.

StatusWhenExample message
403The request sends a parameter that is fixed on the keyThis 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.
403The request sends an unknown parameterUnknown parameter 'foo'.
403A parameter is sent twice (URL and body)Parameter 'maxResults' was supplied more than once (URL and/or body).
403failFast is sent with POSTParameter 'failFast' is not supported with POST.
400A value has the wrong type or is out of rangeParameter 'maxResults' must not be greater than 5000.
400The request body is not a JSON objectThe 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.