How to get Organization Id in codes or through what REST API?

How to get Organization Id in codes or through what REST API?

If I understand correctly, you can get Organization IDs through the Organizations API: https://developer.atlassian.com/cloud/admin/organization/rest/api-group-orgs/#api-v1-orgs-get

Hi @AaronCollier Thanks for your reply. This API seems unable to be used in Forge development.

I think you can fetch it like other APIs.

Hi @AaronCollier
I’m developing a Forge app. With your suggested API, I think I need to hard code the API key because my Atlassian account has mutiple orgs. So it’s not suitable for my case.

You can use environment variables and keep it in the backend (so it’s not exposed in the frontend). :person_shrugging:

1 Like

You can also obtain the Organization id from the GraphQL API:

  query tenantContext($cloudId: ID!) {
      tenantContexts(cloudIds: [$cloudId]) {
              orgId
      }
  }
1 Like