# PlayerData: list() method

> The list() method of the PlayerData interface resolves with every key of the player's data, with its value and version.

The **`list()`** method of the [`PlayerData`](/docs/room/player-data) interface resolves with every key of the player's data, with its value and version.

## Syntax

```ts
list()
```

### Parameters

None.

### Return value

A `Promise` that resolves with an array of `{ key, value, version }`, sorted by key.

### Exceptions

The promise rejects with a [`DataError`](/docs/room/data-error).

## Description

`list()` is never cached: each call reads from the data service. A player has at most 256 keys, so it gives them all at once, with no paging.

## Examples

### Sending a player their unlocked items

Each unlock is its own key, such as `unlock:rocket`.

```ts
// unlocks.ts
import { defineRoom } from "@irtio/room";

export default defineRoom({
  async onJoin(room, connection) {
    const keys = await room.playerData(connection.player).list();
    const unlocked = keys.filter((k) => k.key.startsWith("unlock:")).map((k) => k.key.slice("unlock:".length));
    room.send(connection, { type: "unlocked", items: unlocked });
  },
});
```

## See also

- [`PlayerData.get()`](/docs/room/player-data/get)
