Skip to content

apps-frontend-api

const StudioApp: StudioFrontendApi;

StudioApp singleton that provides methods for apps to use on the frontend.

Common entry point format for modular apps. Modular apps are meant to run in the context of a startup app. until 2026.09

PropertyModifierTypeDescription
cleanup?public() => Promise<void>Performs any necessary cleanup before consuming application deactivates. :::caution[Alpha] This API should not be used in production and may be trimmed from a public release. :::
getProviders?public() => Promise<UiItemsProvider[]>Get all UiItemsProviders provided by this package. It will be up to the consuming application to register them and unregister them when needed. :::caution[Alpha] This API should not be used in production and may be trimmed from a public release. :::
initialize?public() => Promise<void>Performs any startup logic required by packages. Should be called before getProviders :::caution[Alpha] This API should not be used in production and may be trimmed from a public release. :::
namespaces?readonlystring[]Get all locale namespaces provided by this package. It will be up to the consuming application to register them and unregister them when needed. :::caution[Alpha] This API should not be used in production and may be trimmed from a public release. :::

ITwin provided through onITwinSelected event

PropertyTypeDescription
iTwinIdstringID of iTwin
namestringName of iTwin

Navigation sidebar button props.

PropertyTypeDescription
disableReason?stringOnly considered if isDisabled is true. User facing tooltip message displayed when hovering disabled button.
icon?IconSpecIcon to display in the sidebar. :::caution[Deprecated] to be removed in 2027.03, due to IconSpec being deprecated in appUI. Use iconNode to pass a react component instead. :::
iconNode?anyIcon to display in the sidebar. Takes precedence over icon field. If undefined, defaults to a placeholder icon.
idstringUnique id among all sidebar buttons.
isActive?booleanIndicates whether the button is currently active. When set to true, the button remains active until the user clicks on another button, or until another button is activated using this flag. Note that setting isActive flag will activate the button without calling button.onClick method. An active button is highlighted in the sidebar to indicate its active state. Defaults to false.
isDisabled?booleanIf true, button is disabled. Defaults to false.
labelstringUser facing button label.
onClick() => void | Promise<void>Callback invoked when user clicks the entry. Typically, this would be used to activate a custom frontstage.
onDeactivate?() => Promise<undefined | "cancel" | "continue">Provides a callback to be invoked when the user presses another sidebar button that is not the current one.

PropertyType
productFlavorstring
productVersionstring
startupAppobject
startupApp.configPick<AppConfigJsonSchema, "appId" | "gprId" | "displayNameEnglish" | "displayNameKey">
startupApp.versionstring

appChannel(channel): string;

Wraps given IPC channel name with a prefix matching the app name. Ensures IPC channel is unique among apps. Not using this wrapper might cause IPC channel name clashes among different apps. Use StudioHost.appChannel to wrap the IPC channel in the frontend.

ParameterTypeDescription
channelstringunique channel name within your app.

string

channel name that is unique among loaded apps.

attachRpcInterface<T>(definition): void;

Attach an RPC interface to the frontend.

Type Parameter
T extends RpcInterface
ParameterTypeDescription
definitionRpcInterfaceDefinition<T>RPC interface definition.

void

copyToClipboard(text): Promise<void>;

Copies text to the clipboard.

ParameterTypeDescription
textstringText to be copied to the clipboard.

Promise<void>

getApiOverrides(): ApiOverrides;

Get the overrides for specifying which environment iTwin Studio is currently in.

ApiOverrides

getFilePath(file): Promise<string>;

Gets file path from a file object.

ParameterTypeDescription
fileFileFile object.

Promise<string>

getFrontendInitData<T>(options?): Promise<T>;

Retrieves optional initialization data from the backend to the frontend. Ensure finalizeFrontendInitData() is called in the backend before using this function. The caller should handle potential timeouts by implementing a catch statement.

Type Parameter
T extends Record<string, JSONSchemaType>
ParameterType
options?{ timeoutInMS?: number; }
options.timeoutInMS?number

Promise<T>

Initialization data in JSON format as a Promise.

getITwin():
| undefined
| {
iTwinId: string;
name: string;
};

Get the iTwin id that is currently open.

| undefined | { iTwinId: string; name: string; }

The iTwin that is currently open, or undefined if no iTwin is open.

getUrlEnvironmentPrefix(): UrlEnvironmentPrefix;

Get the current environment prefix iTwinStudio is in.

UrlEnvironmentPrefix

it returns url prefix like “dev-”, “qa-” or ""

logError(error, metaData?): void;

Logs an error, with the category being the app name.

ParameterTypeDescription
errorstringError message.
metaData?LoggingMetaDataAdditional metadata.

void

Please use studio-cli helpers migrate-to-logger path/to/src --logCategory category to migrate to Logger apis.

logException(exception): void;

Logs an exception, with the category being the app name.

ParameterTypeDescription
exceptionunknownException object.

void

Please use studio-cli helpers migrate-to-logger path/to/src --logCategory category to migrate to Logger apis.

logInfo(info, metaData?): void;

Logs an info level message, with the category being the app name.

ParameterTypeDescription
infostringInfo message.
metaData?LoggingMetaDataAdditional metadata.

void

Please use studio-cli helpers migrate-to-logger path/to/src --logCategory category to migrate to Logger apis.

logTrace(trace, metaData?): void;

Logs a trace, with the category being the app name.

ParameterTypeDescription
tracestringTrace message.
metaData?LoggingMetaDataAdditional metadata.

void

Please use studio-cli helpers migrate-to-logger path/to/src --logCategory category to migrate to Logger apis.

logWarning(warning, metaData?): void;

Logs a warning, with the category being the app name.

ParameterTypeDescription
warningstringWarning message.
metaData?LoggingMetaDataAdditional metadata.

void

Please use studio-cli helpers migrate-to-logger path/to/src --logCategory category to migrate to Logger apis.

onApplicationClose(handler): () => void;

Registers a handler to be called when an attempt has been made at closing the frontend application.

This handler should be used to implement custom logic for handling unsaved changes or other cleanup tasks, which could not be done by simply using the StudioAppConfigurableOpts#promptPushOnClose application configuration option. This handler is executed before the prompt triggered by the #showPushPrompt startup option.

ParameterTypeDescription
handler() => Promise<boolean>Callback to be invoked when the application is closing. Returning false from this callback will prevent the application from closing.

A function to unregister the handler.

(): void;

void

postTelemetry(telemetry): void;

Sends the telemetry to azure app insights Note: initializeTelemetry needs to be called first from studio-backend-api before using postTelemetry

ParameterTypeDescription
telemetryStudioTelemetrytelemetry data to send

void

runtimeInfo(): Promise<StudioAppRuntimeInfo>;

runtime information like product flavor and version etc

Promise<StudioAppRuntimeInfo>

saveUserPreferences(newUserPreferences): Promise<void>;

Saves the user preferences in the preferences property database.

ParameterTypeDescription
newUserPreferencesUserPreferenceObjectuser/overwrite preferences.

Promise<void>

showOpenDialog(options): object;

Shows a “open file” dialog.

ParameterTypeDescription
optionsOpenDialogOptionsElectron open dialog options

object

closed: Promise<OpenDialogReturnValue>;
showPushPrompt(onPush): Promise<boolean>;

Shows a pop-up dialog prompting the user to push changes. It’s up to the implementation to verify that there is an open iModel with pending changes before showing the dialog.

Typically used before iModel connection is closed, e.g. when switching to a different iModel.

ParameterTypeDescription
onPushPushCallbackCallback invoked when user clicks on “push”. Should not throw - exceptions will not be handled. If the callback returns success: true, the pop-up will be closed. If the callback returns success: false, the pop-up will stay open (typically used when “push” action fails, and the user should choose whether or not to retry).

Promise<boolean>

True if user clicked “push” or “continue”. False if user clicked cancel. until 2026.09

const onPush = async () => {
try {
// Inform the user push is starting
// Push changes
// Inform the user push was successful
return true;
} catch(e) {
// Inform the user of the failure
return false;
}
}
const shouldContinue = await StudioApp.showPushPrompt(onPush);
if (shouldContinue){
// change active frontstage / close iModel / etc
} else {
return; // stay on the current frontstage, don't close the imodel.
}
showSaveDialog(options): object;

Shows a “save file” dialog.

ParameterTypeDescription
optionsSaveDialogOptionsElectron save dialog options

object

closed: Promise<SaveDialogReturnValue>;
PropertyModifierTypeDescription
addSidebarButtonpublic(props) => booleanAdds an button to the sidebar navigation. Typically used to allow navigating between different frontstages. If sidebar button already exists, use updateSidebarButton instead.
checkInternetConnectivitypublic() => Promise<InternetConnectivityStatus>Performs an in-depth check to determine the current internet connectivity status. Recommended to use after http requests throw. until 2026.09 :::caution[Alpha] This API should not be used in production and may be trimmed from a public release. :::
createSelectionStoragepublic() => SelectionStorageCreates a new unified selection storage instance. Useful for apps that want to manage their own selection storage separate from the main one provided by iTwin Studio. until 2026.09 - This API is a placeholder until we drop createStorage proxy from @itwin/unified-selection package. :::caution[Alpha] This API should not be used in production and may be trimmed from a public release. :::
getConnectionpublic() => undefined | IModelConnection-
getConnectivityStatuspublic() => 0 | 1Get the current connectivity status. :::caution[Deprecated] to be removed in 2027.03, use checkInternetConnectivity for in-depth checks, or NativeApp.checkInternetConnectivity for quick checks. :::
getCurrentUserpublic() => undefined | UserConvenience method to get the current logged in user from the frontend store.
getUnifiedSelectionStoragepublic() => SelectionStorageReturns unified selection storage instance that is managed by iTwin Studio. Removes the need to create a new instance of SelectionStorage and clear it on every iModel change.
getUserPreferencepublic(preferenceName) => Promise<undefined | JSONSchemaType>Convenience method to get the user preference value for the given preference name. Uses IPC to get the user preference value from the backend. :::caution[Alpha] This API should not be used in production and may be trimmed from a public release. :::
onITwinSelectedreadonly(listener) => () => voidFires when iTwin is selected either through header dropdown or from iTwin route
onUserPreferencesChangedpublic(listener) => () => voidFires when user preferences are modified by user.
removeSidebarButtonpublic(id) => booleanRemoves an existing sidebar button. Note: does not deactivate active frontstages or do any “cleanup” other than removing the button.
resolveAssetPathpublic(pathFromProjectRoot) => stringResolves the path to the asset using the studio-app:// url which defines an app-local resource. Example const path = StudioApp.resolveAssetPath("assets/my-asset.png"); // path === "studio-app://my-app/dist/assets/my-asset.png"
updateSidebarButtonpublic(props) => booleanUpdates existing sidebar button. Can be used to disable/enable the button or update any properties other than the id. Example StudioApp.updateSidebarButton({ id: "my-sidebar-button", isDisabled: true, disableReason: "Incompatible frontstage" });

UserPreference schema object.

[name: string]: undefined | JSONSchemaType

Re-exports StudioTelemetry

type PushCallback = (description?) => Promise<{
success: boolean;
}>;

Callback invoked when iModel changes should be pushed. Should return true if push was successful, and false if it failed for any reason.

ParameterTypeDescription
description?stringchangeset description.

Promise<{ success: boolean; }>


type UpdateSidebarButtonProps = Required<Pick<SidebarButtonProps, "id">> & Partial<SidebarButtonProps>;