Going Stellar

Home/Atlassian REST API reference

Jira and Confluence Cloud REST API

Call Jira through api.atlassian.com with a cloud id

OAuth 2.0 (3LO) integrations call Jira at https://api.atlassian.com/ex/jira/{cloudId}/rest/api/3/..., not on the site host. The path after the cloud id is the normal REST path. The run below sent Basic credentials through the same gateway URL and got a normal 200, with the self links rewritten to the gateway form.

Endpoints

MethodPathWhat it does
GET/rest/api/3/myselfSame operation on both hosts: the gateway URL just prefixes /ex/jira/{cloudId}.
GET/rest/api/3/serverInfoReports the site's base URL and deployment type.

Examples

GET https://api.atlassian.com/ex/jira/{cloudId}/rest/api/3/myself

Calls myself through the gateway URL with the cloud id in the path.

curl

curl \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  'https://api.atlassian.com/ex/jira/{cloudId}/rest/api/3/myself'

Python (requests)

import os
import requests

EMAIL = "you@example.com"
r = requests.get(
    'https://api.atlassian.com/ex/jira/{cloudId}/rest/api/3/myself',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)

Response: HTTP 200

{
 "self": "https://api.atlassian.com/ex/jira/<cloudId>/rest/api/3/user?accountId=<accountId>",
 "accountId": "<accountId>",
 "accountType": "atlassian",
 "displayName": "<display name>",
 "active": true
}

Response headers

X-Ratelimit-Limit: 350

Sent to Atlassian Cloud on .

GET /rest/api/3/myself

Same call on the site host, to compare the self link.

curl

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

Python (requests)

import os
import requests

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

Response: HTTP 200

{
 "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=<accountId>",
 "accountId": "<accountId>",
 "accountType": "atlassian",
 "displayName": "<display name>",
 "active": true
}

Sent to Atlassian Cloud on .

GET /rest/api/3/serverInfo

Shows the site's own base URL and deployment type, useful to confirm which tenant a credential reaches.

curl

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

Python (requests)

import os
import requests

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

Response: HTTP 200

{
 "baseUrl": "https://your-domain.atlassian.net",
 "version": "1001.0.0-SNAPSHOT",
 "deploymentType": "Cloud",
 "serverTitle": "Jira"
}

Sent to Atlassian Cloud on .

How it behaves

  • https://api.atlassian.com/ex/jira/{cloudId}/rest/api/3/myself answered 200 to the same Basic credentials used on the site host.
  • Links in gateway responses use the gateway host: the self value is api.atlassian.com/ex/jira/<cloudId>/rest/api/3/user?accountId=..., while the site host call gives the site URL.
  • The X-Ratelimit-Limit header on the gateway call was 350, the value the same endpoint shows on the site host.

Pitfalls

  • Do not build further requests by string-replacing the host in a self link. Keep one base URL per client and append /rest/api/3/... to it.
  • The guides present the gateway form as the one for OAuth 2.0 (3LO) apps and the site host form for Basic auth and Connect. The Basic call through the gateway above worked, but the guides do not describe it as a supported combination.
  • The cloud id belongs to one site. Keep it next to that site's credentials in the client configuration.

Questions and answers

Where do I get the cloud id?

The reference shows it inside the gateway URL. The run set does not include a call that looks it up, so the lookup is not demonstrated.

Is the gateway path different from the site path?

Only by the prefix. After /ex/jira/{cloudId} the path is the normal /rest/api/3/... path.

Sources

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

Markdown version · All REST API pages