Is it safe to use __getRuntime() (and global.__forge_runtime__) in Forge apps?

Hi Atlassian teams,

According to the official Forge documentation, the recommended way to get the current user’s accountId is via request.context.accountId, like so:

resolver.define('myMethod', ({ context }) => {
  const accountId = context.accountId;
});

However, there are situations where you may want to access the accountId deep inside your application logic — and passing it manually through all method calls can be inconvenient.

One option is to use AsyncLocalStorage, which lets you access the context anywhere:

contextStorage.getStore()?.accountId;

But I’ve noticed that the @forge/api package includes an undocumented method:

import { __getRuntime } from '@forge/api/out/api/runtime';

const accountId = __getRuntime().aaid;

This method internally accesses global.__forge_runtime__.

So my question is:

Is it officially supported to use __getRuntime() to access aaid (accountId) in Forge apps?
Or is this an internal API that could be changed or removed without notice?

Would love to hear from Atlassian team members or anyone who has experience with this.
Thanks in advance!

Hi @vzakharchenko

The __getRuntime function is an internal implementation detail and changes to it are not subject to our deprecation policy, so it could change at any time. I don’t recommend that you depend on it for retrieving the current user account ID.

Thanks for the clarification!

The reason I asked is because __getRuntime() is actually exported directly from @forge/api, so from a package consumer’s perspective, it doesn’t appear to be internal — there’s no @internal tag or deprecation notice, and no indication that it’s unsupported.

That’s why I was curious whether it was safe to rely on or not.

Appreciate the quick and clear response!