Product REST APIs
Async events API
Fetch API
Storage API

In 2024, Forge hosted storage will automatically include data residency. This means that all app data in Forge hosted storage will inherit data residency, in all current and future Atlassian-supported regions.

This implementation will provide your customers with greater control over their app data’s location. For more information, read this announcement.

Secret store

The Storage API provides a Secret store for storing app data in a secure, encrypted manner. Use this store for sensitive data. Unlike data stored on the Key-value store, data stored on Secret store can't be queried with the Query tool.

To start, import the Forge API package in your app, as follows:

1
2
import { storage } from '@forge/api';

Each installation of your app is subject to the Storage API's quotas and limits. See Storage quotas and Storage limits for more details.

The app storage API requires your app to have the storage:app scope. See Add scopes to call an Atlassian REST API guide to add new scopes to your app.

storage.setSecret

Similar to storage.set, storage.setSecret provides a way to store sensitive credentials. Values set with storage.setSecret can only be accessed with storage.getSecret.

The same limitation is applied: persisted JSON values may be up to 128 KB in size and have a key of up to 500 bytes.

You do not need to identify your app or the active site/installation in your key, as Forge will do this automatically.

Write conflicts are resolved using a last-write-wins strategy.

Method signature

1
2
storage.setSecret(key: string, value: array | boolean | number | object | string ): Promise<void>;

Example

Sets the key example-key to one of the supported value types.

1
2
// array
storage.setSecret('example-key', [ 'Hello', 'World' ]);

// boolean
storage.setSecret('example-key', true);

// number
storage.setSecret('example-key', 123);

// object
storage.setSecret('example-key', { hello: 'world' });

// string
storage.setSecret('example-key', 'Hello world');

storage.getSecret

Gets a value by key, which was stored using storage.setSecret. If the key doesn't exist, the API returns undefined.

Method signature

1
2
storage.getSecret(key: string): Promise<array | boolean | number | object | string>;

Example

Gets the secret value associated with the key example-key.

1
2
// Read the value for key `example-key`
await storage.getSecret('example-key');

storage.deleteSecret

Deletes a secret value by key, this succeeds whether the key exists or not.

Write conflicts are resolved using a last-write-wins strategy.

Method signature

1
2
storage.deleteSecret(key: string): Promise<void>;

Example

Deletes the value associated with the key example-key, if it hasn't already been deleted.

1
2
// Delete the value with the key `key`
await storage.deleteSecret('example-key');

Rate this page: