# PlayerData: delete() method

> The delete() method of the PlayerData interface deletes a key and resolves with whether it existed.

The **`delete()`** method of the [`PlayerData`](/docs/room/player-data) interface deletes a key and resolves with whether it existed.

## Syntax

```ts
delete(key)
delete(key, options)
```

### Parameters

`key`
: The key, 1 to 64 of `A-Z a-z 0-9 _ . : -`.

`options` Optional
: An object with any of these properties:

  `version`
  : The version the key must have, or the delete fails with `E_VERSION`.

  `once`
  : A key that makes the delete safe to repeat, as for [`set()`](/docs/room/player-data/set).

### Return value

A `Promise` that resolves with `true` if the key existed, or `false`.

### Exceptions

The promise rejects with a [`DataError`](/docs/room/data-error), such as `E_VERSION` when the key doesn't have the `version` given.

## Examples

### Using up a one-time pass

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

export default defineRoom({
  async onJoin(room, connection) {
    const hadPass = await room.playerData(connection.player).delete("arena-pass");
    if (!hadPass) room.kick(connection, "you need an arena pass");
  },
});
```

## See also

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