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

# Fetch new events from the API

> Poll for the project events created since your last request

Fetch the project events created since your last request, to catch any that a webhook didn't
deliver. To learn why webhooks alone can miss events, see
[How webhooks and project events work](https://docs.pocketflows.com/concepts/webhooks-and-project-events.md).

Events are kept for 30 days, so fetch new events well within that window.

## 1. Fetch the newest page and save its cursor

`GET /project_events` returns events newest first. Process the events and save
`page_info.start_cursor`, which points at the newest event you have seen.

```
GET /project_events
```

## 2. Ask for events newer than your cursor

Pass the saved cursor as `before`. The response holds the events immediately newer than it,
newest first. Process them, save the new `page_info.start_cursor`, and repeat while
`page_info.has_previous_page` is `true`.

```
GET /project_events?before=<start_cursor>
```

An empty page means nothing new has arrived, and its `start_cursor` is `null`. Keep your saved
cursor and try again later.

## 3. Leave a minute of overlap

An event can appear in the list shortly after events created later than it. If your cursor has
already moved past it, `before` will never return it. To avoid that, make each request with a
cursor you saved at least a minute ago instead of your newest one, and skip events whose `id` you
have already processed. Webhook deliveries can repeat events too, so the same check covers both.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.