Skip to content

app

Application metadata and lifecycle APIs: version and identifier, theme and dock visibility, data stores and exiting the app.

This package is also accessible with window.__TAURI__.app when app.withGlobalTauri in tauri.conf.json is set to true.

Only the read-only commands are enabled by core:app:default (allow-version, allow-name, allow-tauri-version, allow-identifier, allow-bundle-type, allow-supports-multiple-windows, allow-register-listener and allow-remove-listener). Every other function in this module documents the permission it needs, which you must add to a capability yourself.

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L66

Bundle type of the current application.

getBundleType

2.7.0

App: "app";

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L80

macOS app bundle

AppImage: "appimage";

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L76

Linux AppImage

Deb: "deb";

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L72

Linux Debian package

Msi: "msi";

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L70

Windows MSI

Nsis: "nsis";

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L68

Windows NSIS

Pacman: "pacman";

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L78

Linux Pacman package

Rpm: "rpm";

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L74

Linux RPM

type DataStoreIdentifier = [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number];

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L31

Identifier type used for data stores on macOS and iOS.

Represents a 128-bit identifier, commonly expressed as a 16-byte UUID.

2.4.0


type OnBackButtonPressPayload = object;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L367

Payload for the onBackButtonPress event.

2.9.0

Property Type Description Defined in
canGoBack boolean Whether the webview canGoBack property is true. Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L369

type ProfileIdentifier = DataStoreIdentifier;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L57

Identifier of a webview browsing data profile, see the profileIdentifier webview option.

Represents a 128-bit identifier, commonly expressed as a 16-byte UUID.

2.13.0

function defaultWindowIcon(): Promise<Image | null>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L298

Gets the default window icon.

Promise<Image | null>

import { defaultWindowIcon } from '@tauri-apps/api/app';
const icon = await defaultWindowIcon();

Requires the core:app:allow-default-window-icon permission (not included in core:app:default).

2.0.0


function exit(code?): Promise<void>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L473

Exits the app with the given exit code.

This is the same as the exit function of the @tauri-apps/plugin-process plugin, but does not require a plugin to be installed.

Platform-specific

  • Android: The activity is finished instead of the process being killed, so the app closes with the system transition; code is ignored.
Parameter Type Default value Description
code number 0 The exit code to use. Defaults to 0.

Promise<void>

A promise indicating the success or failure of the operation.

import { exit } from '@tauri-apps/api/app';
await exit(1);

Requires the core:app:allow-exit permission (not included in core:app:default).

2.12.0


function fetchDataStoreIdentifiers(): Promise<DataStoreIdentifier[]>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L194

Fetches the data store identifiers on macOS and iOS.

See https://developer.apple.com/documentation/webkit/wkwebsitedatastore for more information.

Promise<DataStoreIdentifier[]>

import { fetchDataStoreIdentifiers } from '@tauri-apps/api/app';
const ids = await fetchDataStoreIdentifiers();

Requires the core:app:allow-fetch-data-store-identifiers permission (not included in core:app:default).

2.4.0

since 2.13.0. Use fetchProfileIdentifiers instead, which is also supported on Windows.


function fetchProfileIdentifiers(): Promise<DataStoreIdentifier[]>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L245

Fetches the identifiers of the app’s browsing data profiles, see the profileIdentifier webview option.

Platform-specific:

  • macOS / iOS: Lists the identifiers of the app’s WKWebsiteDataStores. Available on macOS >= 14 and iOS >= 17.
  • Windows: Lists the WebView2 profiles stored in the app local data directory, which is the default data directory, and in the data directories of the webviews created since the app started.
  • Linux / Android: Unsupported, always returns an empty list.

Promise<DataStoreIdentifier[]>

import { fetchProfileIdentifiers } from '@tauri-apps/api/app';
const ids = await fetchProfileIdentifiers();

Requires the core:app:allow-fetch-profile-identifiers permission (not included in core:app:default).

2.13.0


function getBundleType(): Promise<BundleType>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L358

Gets the application bundle type.

Promise<BundleType>

import { getBundleType } from '@tauri-apps/api/app';
const type = await getBundleType();

2.5.0


function getIdentifier(): Promise<string>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L138

Gets the application identifier.

Promise<string>

The application identifier as configured in tauri.conf.json.

import { getIdentifier } from '@tauri-apps/api/app';
const identifier = await getIdentifier();

2.4.0


function getName(): Promise<string>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L107

Gets the application name.

Promise<string>

import { getName } from '@tauri-apps/api/app';
const appName = await getName();

1.0.0


function getTauriVersion(): Promise<string>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L122

Gets the Tauri framework version used by this application.

Promise<string>

import { getTauriVersion } from '@tauri-apps/api/app';
const tauriVersion = await getTauriVersion();

1.0.0


function getVersion(): Promise<string>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L93

Gets the application version.

Promise<string>

import { getVersion } from '@tauri-apps/api/app';
const appVersion = await getVersion();

1.0.0


function hide(): Promise<void>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L173

Hides the application on macOS.

Promise<void>

import { hide } from '@tauri-apps/api/app';
await hide();

Requires the core:app:allow-app-hide permission (not included in core:app:default).

1.2.0


function onBackButtonPress(handler): Promise<PluginListener>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L406

Listens to the Android hardware/gesture back button.

Registering a handler takes over the default behavior, so the app no longer navigates back or closes on its own: decide what to do inside the handler, using payload.canGoBack to know whether the webview has history to go back to.

Platform-specific

  • Android: Supported.
  • Windows / Linux / macOS / iOS: Unsupported, the handler is never called.
Parameter Type Description
handler (payload) => void Called on every back button press.

Promise<PluginListener>

A listener handle, call unregister() on it to restore the default behavior.

import { onBackButtonPress } from '@tauri-apps/api/app';
import { exit } from '@tauri-apps/api/app';
const listener = await onBackButtonPress(({ canGoBack }) => {
if (canGoBack) {
window.history.back();
} else {
void exit(0);
}
});
// stop handling the back button
await listener.unregister();

2.9.0


function removeDataStore(uuid): Promise<void>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L219

Removes the data store with the given identifier on macOS and iOS.

Note that any webview using this data store should be closed before running this API.

See https://developer.apple.com/documentation/webkit/wkwebsitedatastore for more information.

Parameter Type
uuid DataStoreIdentifier

Promise<void>

import { fetchDataStoreIdentifiers, removeDataStore } from '@tauri-apps/api/app';
for (const id of (await fetchDataStoreIdentifiers())) {
await removeDataStore(id);
}

Requires the core:app:allow-remove-data-store permission (not included in core:app:default).

2.4.0

since 2.13.0. Use removeProfile instead, which is also supported on Windows.


function removeProfile(profileIdentifier): Promise<void>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L277

Removes the browsing data profile with the given identifier, see the profileIdentifier webview option.

Every webview using this profile must be closed before calling this function.

Platform-specific:

  • macOS / iOS: Removes the app’s WKWebsiteDataStore with this identifier. Available on macOS >= 14 and iOS >= 17.
  • Windows: Removes the WebView2 profile from the same data directories fetchProfileIdentifiers looks in. Rejects if a webview still uses the profile. Closing a webview is asynchronous and WebView2 releases the profile files shortly after, so the removal can fail right after closing the last webview using it, in which case the profile is left untouched and the removal can be retried later.
  • Linux / Android: Unsupported, does nothing.
Parameter Type
profileIdentifier DataStoreIdentifier

Promise<void>

import { fetchProfileIdentifiers, removeProfile } from '@tauri-apps/api/app';
for (const id of (await fetchProfileIdentifiers())) {
await removeProfile(id);
}

Requires the core:app:allow-remove-profile permission (not included in core:app:default).

2.13.0


function setDockVisibility(visible): Promise<void>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L343

Sets the dock visibility for the application on macOS.

Parameter Type Description
visible boolean Whether the dock should be visible or not.

Promise<void>

import { setDockVisibility } from '@tauri-apps/api/app';
await setDockVisibility(false);

Requires the core:app:allow-set-dock-visibility permission (not included in core:app:default).

2.5.0


function setTheme(theme?): Promise<void>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L323

Sets the application’s theme. Pass in null or undefined to follow the system theme.

Parameter Type
theme? Theme | null

Promise<void>

import { setTheme } from '@tauri-apps/api/app';
await setTheme('dark');

Platform-specific

  • iOS / Android: Unsupported.

Requires the core:app:allow-set-app-theme permission (not included in core:app:default).

2.0.0


function show(): Promise<void>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L156

Shows the application on macOS. This function does not automatically focus any specific app window.

Promise<void>

import { show } from '@tauri-apps/api/app';
await show();

Requires the core:app:allow-app-show permission (not included in core:app:default).

1.2.0


function supportsMultipleWindows(): Promise<boolean>;

Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L444

Whether the current platform can show more than one window at a time.

Use it to hide or disable multi-window features on platforms where creating a second window is not possible.

Platform-specific

  • Windows / Linux / macOS: Always true.
  • Android: true on API level 32 (Android 12L) and above.
  • iOS: Reflects UIApplication.supportsMultipleScenes, so it is true on iPadOS and false on iPhone.

See the mobile multiwindow guide for how windows behave on mobile.

Promise<boolean>

import { supportsMultipleWindows } from '@tauri-apps/api/app';
import { WebviewWindow } from '@tauri-apps/api/webviewWindow';
if (await supportsMultipleWindows()) {
new WebviewWindow('settings', { url: '/settings' });
}

2.11.0


© 2026 Tauri Contributors. CC-BY / MIT