puter.apps.list()

Websites Puter Apps Node.js Workers

Returns an array of all apps belonging to the user and that this app has access to.

If the user has no apps, the array will be empty.

Syntax

puter.apps.list()
puter.apps.list(options)

Parameters

options (optional)

An object containing the following properties:

Option Type Description
limit Number Maximum number of apps to return in a single call.
cursor String | null Opts into paginated results. Pass null for the first page, then the cursor from each page to fetch the next one.
stream Boolean If true, the method returns an async iterator of page objects instead of a promise, for use with for await ... of. Combine with limit to control the page size, or cursor to resume from a previous page. Cannot be combined with offset. With includeTotal, only the first page carries total.
includeTotal Boolean If true, the paginated result includes a total count of the user's apps.
offset Number Skips the given number of apps. Prefer cursor for paging through large lists.
icon_size Number | null An integer representing the size of the icons to return. Possible values are null, 16, 32, 64, 128, 256, and 512. Default is null (the original size).
stats_period String The period for which to get the user and open count. Possible values are today, yesterday, 7d, 30d, this_month, last_month, this_year, last_year, month_to_date, year_to_date, last_12_months. Default is all (all time).

Return value

A Promise that will resolve to an array of all App objects belonging to the user that this app has access to.

When the request includes cursor (even null), offset, or includeTotal, the promise instead resolves to a page object:

  • items (Array): The App objects on this page.
  • cursor (String) (optional): Present while more pages exist; pass it to the next call.
  • total (Number) (optional): Total app count, present when includeTotal was set.

Without pagination params, the full list is returned as a plain array.

With stream: true, the method returns an async iterator of page objects instead:

for await (const page of puter.apps.list({ stream: true })) {
    for (const app of page.items) {
        console.log(app.name);
    }
}

Examples

Create 3 random apps and then list them

<html>
<body>
    <script src="https://js.puter.com/v2/"></script>
    <script>
        (async () => {
            // (1) Generate 3 random app names
            let appName_1 = puter.randName();
            let appName_2 = puter.randName();
            let appName_3 = puter.randName();

            // (2) Create 3 apps
            await puter.apps.create(appName_1, 'https://example.com');
            await puter.apps.create(appName_2, 'https://example.com');
            await puter.apps.create(appName_3, 'https://example.com');

            // (3) Get all apps (list)
            let apps = await puter.apps.list();

            // (4) Display the names of the apps
            puter.print(JSON.stringify(apps.map(app => app.name)));

            // (5) Delete the 3 apps we created earlier (cleanup)
            await puter.apps.delete(appName_1);
            await puter.apps.delete(appName_2);
            await puter.apps.delete(appName_3);
        })();
    </script>
</body>
</html>