# Payload format

All webhook deliveries are HTTP POST requests with a JSON body. There are two event categories:

### Data Change Events

Triggered when a contribution (create, update, or delete) is merged for any of the non-flight event types.

```json
{
  "event": "DATA_CHANGE",
  "timestamp": "2026-05-15T14:30:00",
  "data": {
    "type": "AIRPORT",
    "aid": "APTxxxxxxxx",
    "action": "CREATE",
    "url": "https://api.aviowiki.com/airports/APTxxxxxxxx"
  }
}
```

| Field         | Description                                    |
| ------------- | ---------------------------------------------- |
| `event`       | Always `DATA_CHANGE` for non-flight events     |
| `timestamp`   | When the event occurred (ISO 8601)             |
| `data.type`   | The event type matching your subscription      |
| `data.aid`    | The aviowiki identifier of the affected entity |
| `data.action` | One of `CREATE`, `UPDATE`, or `DELETE`         |
| `data.url`    | Direct API link to fetch the full entity       |

Use the `data.url` to retrieve the complete, up-to-date entity from the API.

### Flight Update Events

Triggered when a tracked aircraft changes state.

```json
{
  "event": "FLIGHT_UPDATE",
  "timestamp": "2026-05-15T14:30:00",
  "data": {
    "type": "FLIGHT",
    "id": "12345",
    "action": "TAKE_OFF",
    "url": "https://api.aviowiki.com/flights/12345",
    "parent": {
      "aid": "ACFxxxxxxxx",
      "registration": "DABCD"
    }
  }
}
```

| Field                      | Description                              |
| -------------------------- | ---------------------------------------- |
| `event`                    | Always `FLIGHT_UPDATE` for flight events |
| `data.id`                  | The flight identifier                    |
| `data.action`              | The flight event action (see below)      |
| `data.url`                 | Direct API link to fetch the full flight |
| `data.parent.aid`          | The aircraft's aviowiki identifier       |
| `data.parent.registration` | The aircraft registration (tail number)  |

**Flight Actions:**

| Action               | Description                              |
| -------------------- | ---------------------------------------- |
| `OFF_BLOCK`          | Aircraft has pushed back from the gate   |
| `ON_BLOCK`           | Aircraft has arrived at the gate         |
| `TAKE_OFF`           | Aircraft has taken off                   |
| `LANDING`            | Aircraft has landed                      |
| `APPROACH`           | Aircraft is on approach                  |
| `OFF_ROUTE`          | Aircraft has deviated from planned route |
| `RETURN_TO_STAND`    | Aircraft is returning to the stand       |
| `INITIATE_EMERGENCY` | Emergency declared                       |
| `END_EMERGENCY`      | Emergency cancelled                      |
| `DIVERSION`          | Aircraft is diverting to another airport |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aviowiki.com/webhooks/payload-format.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
