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

URL: https://goingstellar.ro/reference/atlassian-rest-api/api-gateway-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

| Method | Path | What it does |
|---|---|---|
| GET | `/rest/api/3/myself` | Same operation on both hosts: the gateway URL just prefixes /ex/jira/{cloudId}. |
| GET | `/rest/api/3/serverInfo` | Reports 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.

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

```python
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 29 Nov 2026.

### GET /rest/api/3/myself

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

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

```python
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 29 Nov 2026.

### GET /rest/api/3/serverInfo

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

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

```python
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 29 Nov 2026.

## 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.

## Related

- [Basic auth with an API token](https://goingstellar.ro/reference/atlassian-rest-api/authentication-api-tokens/)
- [Jira REST API v2 vs v3](https://goingstellar.ro/reference/atlassian-rest-api/jira-v2-vs-v3/)
- [The current user](https://goingstellar.ro/reference/atlassian-rest-api/myself-current-user/)
- [Rate limits and 429](https://goingstellar.ro/reference/atlassian-rest-api/rate-limits-and-429/)

## Sources

- [The Jira Cloud platform REST API v3 (Atlassian Developer)](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/)
- [Basic auth for REST APIs, Jira (Atlassian Developer)](https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/)
- [Security for other integrations, Jira (Atlassian Developer)](https://developer.atlassian.com/cloud/jira/platform/security-for-other-integrations/)
- [Get current user (Jira REST API v3)](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-myself/#api-rest-api-3-myself-get)

