# Event object

The fields of a Mestra webhook event and how to follow it to the object.

Every event is a small JSON object. It names what happened and links to the thing it happened to. It never carries the thing itself.

```json
{
  "id": "evt_…",
  "object": "event",
  "type": "run.completed",
  "created": "2026-10-22T03:14:15Z",
  "data": {
    "object": {
      "id": "…",
      "type": "run",
      "url": "https://app.withmestra.com/api/v1/runs/…"
    }
  }
}
```

## Fields

| Field     | Meaning                                                                                                       |
| --------- | ------------------------------------------------------------------------------------------------------------- |
| `id`      | A unique id that starts `evt_`. The same event keeps the same id on every attempt and every resend.           |
| `object`  | Always `"event"`.                                                                                             |
| `type`    | What happened, such as `run.completed`. See [event types](https://withmestra.com/docs/webhooks/event-types/). |
| `created` | When it happened, as a UTC time in RFC 3339 form.                                                             |
| `data`    | The detail. See below.                                                                                        |

## Fetch the object

Most events have an object, in `data.object`:

| Field  | Meaning                                                                    |
| ------ | -------------------------------------------------------------------------- |
| `id`   | The object's id.                                                           |
| `type` | What kind of object it is: `run`, `master`, `review_campaign` or `export`. |
| `url`  | Where to fetch it from the [API](https://withmestra.com/docs/api/).        |

Fetch the `url` with a key that can read it. You get the current state, not the state at the time of the event. That's usually what you want. See [Best practices](https://withmestra.com/docs/webhooks/best-practices/).

| Object          | URL                                               |
| --------------- | ------------------------------------------------- |
| Run             | `/api/v1/runs/{id}`                               |
| Master          | `/api/v1/masters/{id}`                            |
| Review campaign | `/api/v1/reviews/campaigns/{id}`                  |
| Export          | `/api/v1/reviews/campaigns/{id}/exports/{export}` |

Comment events point at the review campaign and add `data.comment_id`. Fetch the campaign to see the comment.

## Events with no object

A few events have nothing in the API to fetch. They carry plain values in `data` instead:

| Type                                | `data`                                                                           |
| ----------------------------------- | -------------------------------------------------------------------------------- |
| `billing.paused`, `billing.resumed` | `{"state": "read_only"}` or `{"state": "active"}`                                |
| `publish.finished`                  | `{"provider": "screen-network", "outcome": "partial", "items": 12, "failed": 2}` |

`provider` is the screen network integration's id. `outcome` is `done`, `partial` or `failed`. `items` and `failed` are counts. They never name a screen or an item.

## What an event never holds

An event holds ids, types, links and plain numbers. It never holds artwork, comment text, names, email addresses or file names.

New fields and types may be added over time. Ignore the ones you don't know.
