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

# Examples

> Copy-ready implementation snippets for common Evento API workflows

## Setup

<CodeGroup>
  ```bash .env theme={null}
  EVENTO_API_KEY=your_public_api_key
  ```

  ```bash cURL Header Reuse theme={null}
  export EVENTO_API_HEADER="x-evento-api-key: $EVENTO_API_KEY"
  ```
</CodeGroup>

## Example: Public event fetch (Node.js)

```javascript theme={null}
export async function getPublicEvent(eventId) {
  const response = await fetch(`https://evento.so/api/public/v1/events/${eventId}`, {
    headers: {
      'x-evento-api-key': process.env.EVENTO_API_KEY
    }
  });

  const json = await response.json();

  if (!json.success) {
    throw new Error(json.message);
  }

  return json.data;
}
```

## Example: Public user events with pagination (Python)

```python theme={null}
import os
import requests


def list_all_upcoming(username):
    all_events = []
    offset = 0
    limit = 50

    while True:
        response = requests.get(
            f'https://evento.so/api/public/v1/users/{username}/events',
            params={'type': 'upcoming', 'limit': limit, 'offset': offset},
            headers={'x-evento-api-key': os.environ['EVENTO_API_KEY']}
        )
        payload = response.json()

        if not payload['success']:
            raise RuntimeError(payload['message'])

        events = payload['data']['events']
        total = payload['data']['pagination']['total']

        all_events.extend(events)
        offset += limit

        if offset >= total:
            break

    return all_events
```

## Example: Embed API browser widget feed

```javascript theme={null}
async function loadWidgetFeed(username) {
  const response = await fetch(`https://evento.so/api/embed/v1/users/${username}/events?limit=6`);
  const payload = await response.json();

  if (!payload.success) {
    throw new Error(payload.message);
  }

  return payload.data;
}
```

## Example: Retry pattern for 429

```javascript theme={null}
export async function fetchWithRetry(url, options, retries = 4) {
  for (let i = 0; i <= retries; i += 1) {
    const response = await fetch(url, options);
    if (response.status !== 429 || i === retries) return response;
    await new Promise((resolve) => setTimeout(resolve, 500 * 2 ** i));
  }
}
```

## Next steps

<CardGroup cols={2}>
  <Card title="Use cases" icon="map" href="/guides/use-cases">
    End-to-end patterns for product and ops workflows.
  </Card>

  <Card title="Error handling" icon="triangle-exclamation" href="/api/error-handling">
    Status matrix and failure-recovery playbooks.
  </Card>
</CardGroup>
