---
title: "List apps"
description: "Page through apps in your namespace."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.stackmachine.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List apps

`client.apps.list()` returns a **page** of apps (cursor-style pagination). Choose an approach below based on how much control you need over paging.

## One page at a time

Use this when you build **UI with Next/Previous**, tables, or APIs that expose one page per request. You call `list()` for each screen, read `page.data`, and pass `startingAfter` / `starting_after` when `hasMore` / `has_more` is true.

```javascript
// MY_APP_JSON =
// {
//   "id": "da_abc123",
//   "name": "my-app",
//   "url": "https://my-app.stackmachine.app",
//   "adminUrl": "https://stackmachine.com/app/da_abc123",
//   "willPerishAt": null,
//   "favicon": null,
//   "screenshot": null,
//   "activeVersion": { "id": "dv_xyz789" }
// }

const page = await client.apps.list({
  limit: 10, // max apps per page (1–100)
  sortBy: "NEWEST", // other options: "OLDEST", "MOST_ACTIVE"
});
// Should return: {
//   "data": [ MY_APP_JSON ],
//   "hasMore": true,
//   "nextPageCursor": "YXJyYXljb25uZWN0aW9uOjE=",
//   "previousPageCursor": null,
//   "totalCount": 24
// }
console.log(page.data);
console.log(page.hasMore, page.nextPageCursor);

if (page.hasMore) {
  const nextPage = await client.apps.list({
    limit: 10,
    startingAfter: page.nextPageCursor,
  });
  console.log(nextPage.data);
}
```

```python
# MY_APP_JSON =
# {
#   "id": "da_abc123",
#   "name": "my-app",
#   "url": "https://my-app.stackmachine.app",
#   "admin_url": "https://stackmachine.com/app/da_abc123",
#   "will_perish_at": null,
#   "favicon": null,
#   "screenshot": null,
#   "active_version": { "id": "dv_xyz789" }
# }

page = client.apps.list(
    limit=10,  # max apps per page (1–100)
    sort_by="NEWEST",  # other options: "OLDEST", "MOST_ACTIVE"
)
# Should return: {
#   "data": [ MY_APP_JSON ],
#   "has_more": true,
#   "next_page_cursor": "YXJyYXljb25uZWN0aW9uOjE=",
#   "previous_page_cursor": null,
#   "total_count": 24
# }
print(page.data)
print(page.has_more, page.next_page_cursor)

if page.has_more:
    next_page = client.apps.list(
        limit=10,
        starting_after=page.next_page_cursor,
    )
    print(next_page.data)
```

## Collect a bounded set

Use this when you only need **up to N apps** and do not want to write the paging loop yourself. In JavaScript, chain `autoPagingToArray({ limit: N })` on `list()` — the SDK fetches pages until it reaches your cap or runs out of apps. In Python, use `itertools.islice` to collect up to N items from the paginated iterator.

```javascript
const firstFiveApps = await client.apps
  .list({ limit: 2, sortBy: "OLDEST" })
  .autoPagingToArray({ limit: 5 }); // max total apps to collect across pages
// Should return: [ MY_APP_JSON, ... ]
console.log(firstFiveApps);
```

```python
from itertools import islice

apps = list(islice(client.apps.list(limit=2, sort_by="OLDEST"), 5))
print([app.name for app in apps])
```

## Stream every app

Use this for **scripts, exports, or sync jobs** when you want to walk the full list. The SDK keeps requesting pages until there are no more results. In JavaScript use `for await`; in Python, iterate the object returned by `list()`.

```javascript
for await (const app of client.apps.list({
  limit: 25,
  sortBy: "MOST_ACTIVE",
})) {
  // Should log: MY_APP_JSON
  console.log(app.id, app.name, app.url);
}
```

```python
for app in client.apps.list(
    limit=25,
    sort_by="MOST_ACTIVE",
):
    # Should log: MY_APP_JSON
    print(app.id, app.name, app.url)
```

> Source: [stackmachine/sdks](https://github.com/stackmachine/sdks/tree/main) examples.

Source: https://docs.stackmachine.com/apps/list/index.mdx
