Going Stellar

Home/Atlassian REST API reference

Jira and Confluence Cloud REST API

Find Jira users by name or project with the REST API

Find a person with GET /rest/api/3/user/search?query=, list candidates for one project with /user/assignable/search, or page through everyone with /users/search. Single lookups go through GET /rest/api/3/user?accountId=. Usernames and keys are gone: a request that uses username gets a 400.

Endpoints

MethodPathWhat it does
GET/rest/api/3/user/searchFinds active users by name, email prefix or accountId.
GET/rest/api/3/user/assignable/searchFinds users who can be assigned in a project.
GET/rest/api/3/users/searchLists all users, including inactive and app accounts.
GET/rest/api/3/userReturns one user by accountId.

Examples

Searches for automation. The only match is an app account with an empty email address.

curl

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

Python (requests)

import os
import requests

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

Response: HTTP 200

[
 {
  "accountType": "app",
  "emailAddress": "",
  "displayName": "Automation for Jira",
  "active": true,
  "guest": false
 }
]

Response headers

X-Ratelimit-Limit: 350

Sent to Atlassian Cloud on .

GET /rest/api/3/user/assignable/search

Lists who can be assigned in project WEB.

curl

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

Python (requests)

import os
import requests

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

Response: HTTP 200

[
 {
  "accountType": "atlassian",
  "displayName": "<display name>",
  "active": true,
  "guest": false
 }
]

Sent to Atlassian Cloud on .

GET /rest/api/3/users/search

Lists all users two at a time. The second entry is an app account of appType agent.

curl

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

Python (requests)

import os
import requests

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

Response: HTTP 200

[
 {
  "accountType": "atlassian",
  "displayName": "<display name>",
  "active": true
 },
 {
  "accountType": "app",
  "appType": "agent",
  "displayName": "Blocker Checker",
  "active": true
 }
]

Sent to Atlassian Cloud on .

GET /rest/api/3/user

Reads one user by accountId.

curl

curl -G \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  --data-urlencode 'accountId=<accountId>' \
  'https://your-domain.atlassian.net/rest/api/3/user'

Python (requests)

import os
import requests

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

Response: HTTP 200

{
 "accountType": "atlassian",
 "displayName": "<display name>",
 "active": true,
 "timeZone": "Europe/Bucharest",
 "locale": "en_US"
}

Sent to Atlassian Cloud on .

GET /rest/api/3/user

Asks for username=admin, the old way. It is refused.

curl

curl -G \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  --data-urlencode 'username=admin' \
  'https://your-domain.atlassian.net/rest/api/3/user'

Python (requests)

import os
import requests

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

Response: HTTP 400

{
 "errorMessages": [
  "The 'accountId' query parameter needs to be provided"
 ],
 "errors": {}
}

Sent to Atlassian Cloud on .

How it behaves

  • query=automation matched an account of accountType app with the display name Automation for Jira. Its emailAddress was an empty string.
  • /users/search returned an app account with appType agent and no emailAddress key, next to a normal atlassian account.
  • GET /user with username=admin answered 400 with "The 'accountId' query parameter needs to be provided".
  • The spec says /user/search returns active users and takes startAt and maxResults over a filtered list up to the thousandth user, while /users/search covers active, inactive and deleted accounts.

Pitfalls

  • Pass accountId everywhere. The username and key parameters are listed as no longer available, and the 400 above is what happens.
  • Do not rely on emailAddress to identify people. It can be empty or missing depending on the user's privacy settings.
  • Count app and agent accounts when you list all users. They have accountType app and may lack an email address.
  • The spec notes that user search endpoints share one collective rate limit for the tenant, so avoid calling them in a tight loop.

Questions and answers

How do I find the accountId of a teammate?

Call GET /rest/api/3/user/search with query set to a name or email prefix and read accountId from the match.

Sources

  1. The Jira Cloud platform REST API v3 (Atlassian Developer)
  2. Rate limiting, Jira (Atlassian Developer)
  3. Find users (Jira REST API v3)

Markdown version · All REST API pages