Going Stellar

Home/Atlassian REST API reference

Jira and Confluence Cloud REST API

Get and search Jira projects with the REST API

GET /rest/api/3/project/{projectIdOrKey} returns one project with its work types, lead and role links. GET /rest/api/3/project/search pages through the visible projects and returns a lighter record that leaves lead and description out unless expand asks for them.

Endpoints

MethodPathWhat it does
GET/rest/api/3/project/{projectIdOrKey}Returns one project.
GET/rest/api/3/project/searchReturns projects visible to the user, paged.
GET/rest/api/3/project/{projectIdOrKey}/roleLists the roles of a project with their links.

Examples

GET /rest/api/3/project/WEB

Reads project WEB by key. The record includes the first work types and the role links.

curl

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

Python (requests)

import os
import requests

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

Response: HTTP 200

{
 "expand": "description,lead,issueTypes,url,projectKeys,permissions,insight",
 "id": "10066",
 "key": "WEB",
 "issueTypes": [
  {
   "id": "10079",
   "name": "Epic",
   "subtask": false,
   "hierarchyLevel": 1
  },
  {
   "id": "10080",
   "name": "Subtask",
   "subtask": true,
   "hierarchyLevel": -1
  }
 ],
 "assigneeType": "PROJECT_LEAD",
 "name": "Website Relaunch",
 "roles": {
  "atlassian-addons-project-access": "https://your-domain.atlassian.net/rest/api/3/project/10066/role/10083",
  "Administrator": "https://your-domain.atlassian.net/rest/api/3/project/10066/role/10079",
  "jira-guest-member": "https://your-domain.atlassian.net/rest/api/3/project/10066/role/10082",
  "Viewer": "https://your-domain.atlassian.net/rest/api/3/project/10066/role/10081",
  "Member": "https://your-domain.atlassian.net/rest/api/3/project/10066/role/10080"
 },
 "projectTypeKey": "software",
 "simplified": true,
 "style": "next-gen"
}

Response headers

X-Ratelimit-Limit: 350

Sent to Atlassian Cloud on .

Pages two projects at a time ordered by key. nextPage and isLast say whether more follow.

curl

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

Python (requests)

import os
import requests

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

Response: HTTP 200

{
 "maxResults": 2,
 "startAt": 0,
 "total": 4,
 "isLast": false,
 "values": [
  {
   "expand": "description,lead,issueTypes,url,projectKeys,permissions,insight",
   "id": "10099",
   "key": "MOB",
   "name": "Mobile App 3.0",
   "projectTypeKey": "software",
   "simplified": false,
   "style": "classic"
  },
  {
   "expand": "description,lead,issueTypes,url,projectKeys,permissions,insight",
   "id": "10000",
   "key": "SCRUM",
   "name": "Test 1",
   "projectTypeKey": "software",
   "simplified": true,
   "style": "next-gen"
  }
 ]
}

Sent to Atlassian Cloud on .

GET /rest/api/3/project/WEB/role

Lists the roles of the project as a map from role name to role URL.

curl

curl \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  'https://your-domain.atlassian.net/rest/api/3/project/WEB/role'

Python (requests)

import os
import requests

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

Response: HTTP 200

{
 "atlassian-addons-project-access": "https://your-domain.atlassian.net/rest/api/3/project/10066/role/10083",
 "Administrator": "https://your-domain.atlassian.net/rest/api/3/project/10066/role/10079",
 "jira-guest-member": "https://your-domain.atlassian.net/rest/api/3/project/10066/role/10082",
 "Viewer": "https://your-domain.atlassian.net/rest/api/3/project/10066/role/10081",
 "Member": "https://your-domain.atlassian.net/rest/api/3/project/10066/role/10080"
}

Sent to Atlassian Cloud on .

How it behaves

  • style was next-gen with simplified true for WEB, which is a team-managed project, and classic with simplified false for the project MOB.
  • project/search with orderBy=key returned MOB before SCRUM, total 4, and gave nextPage and isLast false because maxResults was 2.
  • Entries from project/search have an expand string but no lead, description or issueTypes. The single-project call included lead, issueTypes and roles.
  • The role listing is a plain object whose keys are role names and whose values are URLs ending in the role id.

Pitfalls

  • Use project/search for listings. Walking a list of keys with one call per project spends rate limit for nothing.
  • Ask for expand=description,lead when the search view needs them. The default listing is lean.
  • Role names differ by project and by project style. Read them before you use one in a visibility restriction.

Questions and answers

Does project/search accept a key or an id?

It filters by keys or id parameters, up to 50 values each, according to the spec. The single-project call accepts either a key or an id in the path.

Sources

  1. The Jira Cloud platform REST API v3 (Atlassian Developer)
  2. Get projects paginated (Jira REST API v3)

Markdown version · All REST API pages