Run JQL search query using Jira Cloud REST API

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

   

Summary

You can use Jira Cloud's REST API to return work items based on a JQL search query.

In turn, we can use additional methods to return Jira work items using the API, including:

  • Performing a cURL request
  • Creating an automation rule to Send a web request

In all cases, we'll use the Search for issues using JQL (GET) API endpoint. As the JQL query is a request parameter for this resource, it must be URL-encoded in order to work correctly.

Encode the JQL query

There are two ways to encode a JQL query to make it URL-compatible.

Option 1: Run JQL in Jira and copy from address bar

  1. In Jira, select Search > View all issues
  2. Write a JQL query and select the magnifying glass tilted left Search icon
    1. In your browser's address bar, the JQL query will be encoded following jql=
  3. Copy the text following the "=" character for use in the API
    The address bar of Jira search pages includes the JQL query syntax 

Option 2: Use URL encoding smart value in Jira Automation

Jira Automation supports the URL Encoding Smart Value in automation rules that you create. You can input your JQL query as you would in Jira search to get the proper encoded value returned. 

For example:

{{#urlEncode}}project = SUP and created > -5d{{/}}

For more details, please refer to our documentation on Smart Values in Jira Automation.

JQL API search with cURL


This operation requires an API token. Please refer to Manage API tokens for your Atlassian account.

This cURL command returns work items created in the last 7 days for the "OP" project.

curl --request GET \
  --url 'https://<yoursitename>.atlassian.net/rest/api/3/search/jql?maxResults=10000&jql%3Dproject%3DOP%20and%20created%20%3E%3D%20-7d' \
  --user 'youremail@mail.com:yourapitoken' \
  --header 'Accept: application/json'

JQL API search from Jira automation

The following examples show automation rules that use the Send web request action. For more details on how to build this type of rule please check Automation for Jira - Send web request using Jira REST API.

Automation rule using a manually encoded JQL query:

  1. Trigger: Scheduled
  2. Action: Send web request
    1. Web request URL: https://<yoursitename>.atlassian.net/rest/api/3/search/jql?fields=key&maxResults=500&jql=project%3DOG%20and%20created%3E%3D%20-5d
    2. Headers:
      1. Content-type: application/json
      2. Authorization: Basic <your_api_key>
    3. HTTP Method: GET
    4. Web request body: Empty
  3. Action: Audit log action
  4. Smart values to log: 
    1. Work item URLs: {{webResponse.body.issues.self}}
    2. Work item keys: {{webResponse.body.issues.key}}

 

Automation rule using a JQL query encoded by the URL encoding smart value

  1. Trigger: Scheduled
  2. Action: Send web request
    1. Web request URL: https://<yoursitename>.atlassian.net/rest/api/3/search/jql?fields=key&maxResults=500&jql={{#urlEncode}}project=OG and created>= -5d{{/}}
    2. Headers:
      1. Content-type: application/json
      2. Authorization: Basic <your_api_key>
    3. HTTP Method: GET
    4. Web request body: Empty
  3. Action: Audit log action
  4. Smart values to log: 
    1. Work item URLs: {{webResponse.body.issues.self}}
    2. Work item keys: {{webResponse.body.issues.key}}



Additional Resources

Last modified on May 28, 2025

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.