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

# Events

> List a user's past or upcoming events from the public API

The SDK lets you fetch a user's **upcoming** or **past** events. You need the user ID and your API key (for example from `process.env.PEERPOP_API_KEY`).

## Usage

```js theme={null}
const peerpop = require("peerpop");

// Upcoming events
const upcoming = await peerpop.events.list("upcoming", userId, process.env.PEERPOP_API_KEY);

// Past events
const past = await peerpop.events.list("past", userId, process.env.PEERPOP_API_KEY);
```

## API

**`peerpop.events.list(type, userId, apiKey)`**

| Parameter | Type   | Description                                |
| --------- | ------ | ------------------------------------------ |
| `type`    | string | `"upcoming"` or `"past"`                   |
| `userId`  | string | The user ID whose events you want to list. |
| `apiKey`  | string | Your PeerPop API key.                      |

Returns a Promise that resolves to the API response (parsed JSON).

For the exact request/response shape, see the [API Reference endpoints](/api-reference/endpoints) (`POST /v1/events/upcoming` and `POST /v1/events/past`).
