Going Stellar

Home/Atlassian REST API reference

Jira and Confluence Cloud REST API

What Jira REST returns without credentials

Jira applies the same permission rules to REST calls as to the web UI, so an unauthenticated call is an anonymous user. Endpoints that need a signed-in user answer 401, but an endpoint that looks up a work item answers 404 with the same message used for a work item that does not exist. A 404 on a key you know exists is therefore often a credential or permission problem.

Endpoints

MethodPathWhat it does
GET/rest/api/3/myselfNeeds a signed-in user, so it answers 401 without credentials.
GET/rest/api/3/issue/{issueIdOrKey}Answers 404 when the work item is missing or the caller cannot see it, anonymous or not.

Examples

GET /rest/api/3/myself

Calls an endpoint that always needs a user, with no Authorization header.

curl

curl \
  -H 'Accept: application/json' \
  'https://your-domain.atlassian.net/rest/api/3/myself'

Python (requests)

import requests

r = requests.get(
    'https://your-domain.atlassian.net/rest/api/3/myself',
    headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)

Response: HTTP 401

Client must be authenticated to access this resource.

Response headers

Www-Authenticate: OAuth realm="https%3A%2F%2Fyour-domain.atlassian.net"

Sent to Atlassian Cloud on .

GET /rest/api/3/issue/{issueIdOrKey}

Calls a work item endpoint without credentials and gets a not-found style answer instead of 401.

curl

curl \
  -H 'Accept: application/json' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}'

Python (requests)

import requests

r = requests.get(
    'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}',
    headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)

Response: HTTP 404

{
 "errorMessages": [
  "Issue does not exist or you do not have permission to see it."
 ],
 "errors": {}
}

Sent to Atlassian Cloud on .

GET /rest/api/3/issue/WEB-999999

Calls with valid credentials for a key that does not exist and gets the identical message, so the two cases cannot be told apart from the body.

curl

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

Python (requests)

import os
import requests

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

Response: HTTP 404

{
 "errorMessages": [
  "Issue does not exist or you do not have permission to see it."
 ],
 "errors": {}
}

Sent to Atlassian Cloud on .

How it behaves

  • GET /rest/api/3/myself without credentials answers 401 with the plain text body Client must be authenticated to access this resource.
  • That 401 response carries a Www-Authenticate header with an OAuth realm for the site.
  • GET /rest/api/3/issue/{issueIdOrKey} without credentials answers 404 with errorMessages saying the work item does not exist or the caller lacks permission to see it.
  • A missing key with valid credentials returns the same 404 body, so the API does not reveal whether a hidden work item exists.

Where the documentation differs

  • GET /rest/api/3/issue/{issueIdOrKey}

    Sent to Atlassian Cloud, . The documentation: The OpenAPI description of GET /rest/api/3/issue/{issueIdOrKey} lists 401: "Returned if the authentication credentials are incorrect or missing."

    What happened: A request with no credentials got 404 with "Issue does not exist or you do not have permission to see it." and no 401.

Pitfalls

  • Do not treat 404 on a work item as proof the key is wrong. With no or insufficient access the answer is the same 404.
  • HTTP clients that wait for a Basic challenge before sending credentials will not get one for Basic. Send the Authorization header on the first request.
  • The guides say anonymous access exists only where a permission is granted to Anyone, and that the REST API does not turn anonymous access on by default, even for actions the web UI allows.

Questions and answers

Why do I get 404 for a work item that exists?

Jira answers 404 both when the key does not exist and when the caller cannot see it. Missing credentials, a token for another site, or a missing Browse projects permission all give that body.

Can I call Jira REST anonymously?

Only for operations marked as accessible anonymously, and only where the needed permission is granted to the Public group. Most operations answer 401 or 404 instead.

Sources

  1. Basic auth for REST APIs, Jira (Atlassian Developer)
  2. The Jira Cloud platform REST API v3 (Atlassian Developer)
  3. Get issue (Jira REST API v3)
  4. Get current user (Jira REST API v3)

Markdown version · All REST API pages