# List recent events

> The latest events (up to 50) sent to your webhook endpoints, newest first, exactly as they were delivered. With `sample=true` and a `type`, an account with no such event yet gets one example event instead (`livemode: false`, an id starting `evt_sample`, and `meta.sample: true`), for tools that need an example to map fields from.

```http
GET https://yapfactory.com/api/v1/events
```

|   |   |
| --- | --- |
| Who can use it | Everyone: brands and creators |
| Tier | `read`: Reads. Changes nothing. |
| Scope | `webhooks:read`, or `read` |
| Idempotency-Key | Not used |
| Rate limit | Reads: 120 a minute |
| MCP tool | None. This one is REST only. |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `type` | query | `"deal.updated" \| "deal.invited" \| "invite.accepted" \| "invite.declined" \| "invite.expired" \| "deal.started" \| "draft.submitted" \| "revision.requested" \| "draft.approved" \| "deal.completed" \| "deal.cancelled" \| "ask.received" \| "message.received" \| "campaign.published" \| "post.published" \| "post.failed"` | no | Only events of this type. |
| `sample` | query | `boolean` | no | When there's no real event of `type` yet, return an example one. Default `false`. |
| `limit` | query | `integer` | no | How many to return. 1 to 50. Default `20`. |
| `cursor` | query | `string` | no | The `nextCursor` from the previous page. Leave out for the first page. |

## Example request

```bash
curl "https://yapfactory.com/api/v1/events?type=draft.submitted&sample=true" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

## Response

`200` with a list. Each item in `data` is what the MCP tool returns in `events`, and `meta` carries the summary fields. Pass `nextCursor` back as `cursor` until `hasMore` is false. [How paging works](https://yapfactory.com/developers/pagination.md).

```json
{
  "data": [
    {
      "id": "evt_sampledraftsubmitted",
      "type": "draft.submitted",
      "createdAt": "2026-12-08T16:12:04.000Z",
      "livemode": false,
      "data": {
        "dealId": "3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19",
        "campaignId": "8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f",
        "status": "draft_submitted",
        "url": "https://yapfactory.com/deals/3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19",
        "version": 1
      }
    }
  ],
  "nextCursor": null,
  "hasMore": false,
  "meta": {
    "sample": false
  }
}
```

An example: fields that don't apply are `null`, and new fields can be added at any time, so ignore ones you don't know. Every response carries `Request-Id` and the `RateLimit-*` headers.

## Errors

| Code | Status | When |
| --- | --- | --- |
| `invalid_request` | 400 | A field failed validation (see `meta.issues`), or an unknown query parameter. |
| `unauthorized` | 401 | No token, or it's wrong, expired, revoked or from the other environment. |
| `insufficient_scope` | 403 | The token doesn't have `webhooks:read` (or `read`). |
| `forbidden` | 403 | Not allowed for this account, for example while it's paused. |
| `rate_limited` | 429 | Over the limit. Wait for `Retry-After` seconds. |
| `internal` | 500 | Our fault. Retry later, and send us the `requestId` if it keeps happening. |

Every error has the same shape. See [Errors](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/list_events
