# Events reference

> Every event topic Koil delivers to Event Destinations, with the JSON Schema of each delivery envelope.

Every delivery to an [Event Destination](https://docs.koil.co/guides/subscribe-to-events) is one JSON object with the same envelope: a stable `id` for dedupe, the wire `topic`, the event `time`, the `apiVersion` it is rendered in, the family's `context` (Koil's context for the event, always including `organizationId` and `mode`), and the topic's `data` payload. Subscribe to a topic exactly, to a family with a trailing `.*`, or to everything with `*`.

This page is generated from the event catalog when the docs are built; a topic that is not listed here is not emitted.

## Connection

### `connection.created`

A platform connection was created.

`data` is the resource exactly as `GET /v1/connections/{connectionId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `connectionId` | `string` | yes |  |
| `issuerId` | `string` | yes |  |
| `appId` | `string` | no |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"connection"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes | Koil Connection identifier. |
| `issuerId` | `string` | yes | The issuer the Connection's credential comes from (`GET /v1/issuers`): for `oauth`, its App's, such as `facebook` or `google`; for a key, the one the key is for, such as `app_store_connect`. |
| `method` | `"oauth" \| "key"` | yes | How the Connection was obtained. `oauth`: an end user authorized your App, through a Connect Session or a grant you created it from. `key`: the brand gave you a key of its own, which you sent to `POST /v1/connections`; there is no App. |
| `oauth` | `object` | no | What an `oauth` Connection was obtained through. Present exactly when `method` is `"oauth"`. |
| `key` | `object` | no | What a `key` Connection holds of its key that Koil returns. Present exactly when `method` is `"key"`. |
| `clientUserId` | `string` | no | Your own identifier for the end user the Connection belongs to. |
| `subject` | `string` | no | The platform's id for the account the Connection's credential acts as: for `oauth`, the user who authorized (Google's `sub`, Facebook's user id, Instagram's `user_id`, TikTok's `open_id`); for a key, the account the platform confirmed it belongs to. LinkedIn names none, and a lookup that failed at connect time leaves it absent. |
| `status` | `"active" \| "reauthorization_required" \| "invalid"` | yes | `active` while its credential authorizes. `reauthorization_required` while the end user must connect again soon: an `expiring` credential still works until then, while a key the platform refuses (`key_refused`, for which Koil polls nothing and bills nothing) or will not issue a token from (`renewal_failed`) does not. `invalid` once it no longer authorizes, which is final: the end user must connect again, and Koil polls nothing for its Profiles, does not bill them, and deletes the Connection six days after it became `invalid`. Either way, create a Connect Session with this `connectionId` (or, for a key, replace it with `PUT /v1/connections/{connectionId}/credential`), and `connection.updated` announces every change. `statusReason` says why it is not `active`. |
| `statusReason` | `"renewal_failed" \| "revoked" \| "expired" \| "duplicate" \| "expiring" \| "key_refused"` | no | Why the Connection is not `active`; absent while it is. For `invalid`: `renewal_failed` (the platform refused to renew the credential), `revoked` (the platform refused its token, for example because the end user removed the app), `expired` (the credential ran out with nothing to renew it), `duplicate` (the account it acts as already has another Connection under the same issuer, App where it has one, and `clientUserId`, which keeps its place), or `key_refused` (the platform still refused the key 48 hours after it first did). For `reauthorization_required`: `expiring` (the credential, or the refresh token that renews it, expires within 14 days, by `credential.reauthorizeBy`), or `key_refused` (the platform refused a key whose refusal can be a passing one, such as App Store Connect's 401: Koil asks the platform again for 48 hours, and the Connection is `active` again if it takes the key, or `invalid` if it still refuses it). |
| `credential` | `object` | no | What the Connection's credential states of itself, wherever the Connection appears: its read, its listing and its events. Absent while Koil holds no credential for the Connection, as once it is `invalid`. The expiry of an access token Koil renews is Koil's concern, so it is not stated here. |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "connection.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "connectionId",
        "issuerId"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "connectionId": {
          "type": "string",
          "minLength": 1
        },
        "issuerId": {
          "type": "string",
          "minLength": 1
        },
        "appId": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "issuerId",
        "method",
        "status",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "connection",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "description": "Koil Connection identifier.",
          "minLength": 1
        },
        "issuerId": {
          "type": "string",
          "description": "The issuer the Connection's credential comes from (`GET /v1/issuers`): for `oauth`, its App's, such as `facebook` or `google`; for a key, the one the key is for, such as `app_store_connect`.",
          "minLength": 1
        },
        "method": {
          "enum": [
            "oauth",
            "key"
          ],
          "description": "How the Connection was obtained. `oauth`: an end user authorized your App, through a Connect Session or a grant you created it from. `key`: the brand gave you a key of its own, which you sent to `POST /v1/connections`; there is no App."
        },
        "oauth": {
          "type": "object",
          "required": [
            "appId"
          ],
          "properties": {
            "appId": {
              "type": "string",
              "description": "The App the Connection acts through.",
              "minLength": 1
            }
          },
          "additionalProperties": false,
          "description": "What an `oauth` Connection was obtained through. Present exactly when `method` is `\"oauth\"`."
        },
        "key": {
          "type": "object",
          "required": [
            "config"
          ],
          "properties": {
            "config": {
              "type": "object",
              "patternProperties": {
                "^.*$": {}
              },
              "description": "The key's public half, as `GET /v1/issuers` declares it (`methods.key.config`), such as the key's id; never its secret."
            }
          },
          "additionalProperties": false,
          "description": "What a `key` Connection holds of its key that Koil returns. Present exactly when `method` is `\"key\"`."
        },
        "clientUserId": {
          "type": "string",
          "description": "Your own identifier for the end user the Connection belongs to.",
          "maxLength": 255
        },
        "subject": {
          "type": "string",
          "description": "The platform's id for the account the Connection's credential acts as: for `oauth`, the user who authorized (Google's `sub`, Facebook's user id, Instagram's `user_id`, TikTok's `open_id`); for a key, the account the platform confirmed it belongs to. LinkedIn names none, and a lookup that failed at connect time leaves it absent."
        },
        "status": {
          "enum": [
            "active",
            "reauthorization_required",
            "invalid"
          ],
          "description": "`active` while its credential authorizes. `reauthorization_required` while the end user must connect again soon: an `expiring` credential still works until then, while a key the platform refuses (`key_refused`, for which Koil polls nothing and bills nothing) or will not issue a token from (`renewal_failed`) does not. `invalid` once it no longer authorizes, which is final: the end user must connect again, and Koil polls nothing for its Profiles, does not bill them, and deletes the Connection six days after it became `invalid`. Either way, create a Connect Session with this `connectionId` (or, for a key, replace it with `PUT /v1/connections/{connectionId}/credential`), and `connection.updated` announces every change. `statusReason` says why it is not `active`."
        },
        "statusReason": {
          "enum": [
            "renewal_failed",
            "revoked",
            "expired",
            "duplicate",
            "expiring",
            "key_refused"
          ],
          "description": "Why the Connection is not `active`; absent while it is. For `invalid`: `renewal_failed` (the platform refused to renew the credential), `revoked` (the platform refused its token, for example because the end user removed the app), `expired` (the credential ran out with nothing to renew it), `duplicate` (the account it acts as already has another Connection under the same issuer, App where it has one, and `clientUserId`, which keeps its place), or `key_refused` (the platform still refused the key 48 hours after it first did). For `reauthorization_required`: `expiring` (the credential, or the refresh token that renews it, expires within 14 days, by `credential.reauthorizeBy`), or `key_refused` (the platform refused a key whose refusal can be a passing one, such as App Store Connect's 401: Koil asks the platform again for 48 hours, and the Connection is `active` again if it takes the key, or `invalid` if it still refuses it)."
        },
        "credential": {
          "type": "object",
          "properties": {
            "scopes": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "The scopes the credential holds, as Koil stores them. Absent when Koil does not know them, which is not a credential of none."
            },
            "reauthorizeBy": {
              "type": "string",
              "format": "date-time",
              "description": "When the credential stops working unless its end user authorizes again. Where Koil can renew the credential, it is the platform's deadline for renewing it: TikTok's and LinkedIn's refresh tokens expire about a year after authorization. Where nothing renews it (a LinkedIn grant without a refresh token), it is the access token's own expiry. Once a refresh token's deadline has passed, it stays that deadline, or the access token's expiry where that is earlier: it never moves later. Koil makes the Connection `reauthorization_required` 14 days ahead of it; send the end user through a Connect Session with this `connectionId` before then. Absent when nothing but a revocation ends the credential (a key, which issues its own tokens), or while Koil does not know the date: a grant created without `refreshTokenExpiresAt`, until a renewal states it."
            }
          },
          "additionalProperties": false,
          "description": "What the Connection's credential states of itself, wherever the Connection appears: its read, its listing and its events. Absent while Koil holds no credential for the Connection, as once it is `invalid`. The expiry of an access token Koil renews is Koil's concern, so it is not stated here."
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `connection.deleted`

A platform connection was deleted: through the API, with its App or Organization, or by Koil once the end user revoked access. `data` is the connection as it last stood.

`data` is the resource exactly as `GET /v1/connections/{connectionId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `connectionId` | `string` | yes |  |
| `issuerId` | `string` | yes |  |
| `appId` | `string` | no |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"connection"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes | Koil Connection identifier. |
| `issuerId` | `string` | yes | The issuer the Connection's credential comes from (`GET /v1/issuers`): for `oauth`, its App's, such as `facebook` or `google`; for a key, the one the key is for, such as `app_store_connect`. |
| `method` | `"oauth" \| "key"` | yes | How the Connection was obtained. `oauth`: an end user authorized your App, through a Connect Session or a grant you created it from. `key`: the brand gave you a key of its own, which you sent to `POST /v1/connections`; there is no App. |
| `oauth` | `object` | no | What an `oauth` Connection was obtained through. Present exactly when `method` is `"oauth"`. |
| `key` | `object` | no | What a `key` Connection holds of its key that Koil returns. Present exactly when `method` is `"key"`. |
| `clientUserId` | `string` | no | Your own identifier for the end user the Connection belongs to. |
| `subject` | `string` | no | The platform's id for the account the Connection's credential acts as: for `oauth`, the user who authorized (Google's `sub`, Facebook's user id, Instagram's `user_id`, TikTok's `open_id`); for a key, the account the platform confirmed it belongs to. LinkedIn names none, and a lookup that failed at connect time leaves it absent. |
| `status` | `"active" \| "reauthorization_required" \| "invalid"` | yes | `active` while its credential authorizes. `reauthorization_required` while the end user must connect again soon: an `expiring` credential still works until then, while a key the platform refuses (`key_refused`, for which Koil polls nothing and bills nothing) or will not issue a token from (`renewal_failed`) does not. `invalid` once it no longer authorizes, which is final: the end user must connect again, and Koil polls nothing for its Profiles, does not bill them, and deletes the Connection six days after it became `invalid`. Either way, create a Connect Session with this `connectionId` (or, for a key, replace it with `PUT /v1/connections/{connectionId}/credential`), and `connection.updated` announces every change. `statusReason` says why it is not `active`. |
| `statusReason` | `"renewal_failed" \| "revoked" \| "expired" \| "duplicate" \| "expiring" \| "key_refused"` | no | Why the Connection is not `active`; absent while it is. For `invalid`: `renewal_failed` (the platform refused to renew the credential), `revoked` (the platform refused its token, for example because the end user removed the app), `expired` (the credential ran out with nothing to renew it), `duplicate` (the account it acts as already has another Connection under the same issuer, App where it has one, and `clientUserId`, which keeps its place), or `key_refused` (the platform still refused the key 48 hours after it first did). For `reauthorization_required`: `expiring` (the credential, or the refresh token that renews it, expires within 14 days, by `credential.reauthorizeBy`), or `key_refused` (the platform refused a key whose refusal can be a passing one, such as App Store Connect's 401: Koil asks the platform again for 48 hours, and the Connection is `active` again if it takes the key, or `invalid` if it still refuses it). |
| `credential` | `object` | no | What the Connection's credential states of itself, wherever the Connection appears: its read, its listing and its events. Absent while Koil holds no credential for the Connection, as once it is `invalid`. The expiry of an access token Koil renews is Koil's concern, so it is not stated here. |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "connection.deleted"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "connectionId",
        "issuerId"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "connectionId": {
          "type": "string",
          "minLength": 1
        },
        "issuerId": {
          "type": "string",
          "minLength": 1
        },
        "appId": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "issuerId",
        "method",
        "status",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "connection",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "description": "Koil Connection identifier.",
          "minLength": 1
        },
        "issuerId": {
          "type": "string",
          "description": "The issuer the Connection's credential comes from (`GET /v1/issuers`): for `oauth`, its App's, such as `facebook` or `google`; for a key, the one the key is for, such as `app_store_connect`.",
          "minLength": 1
        },
        "method": {
          "enum": [
            "oauth",
            "key"
          ],
          "description": "How the Connection was obtained. `oauth`: an end user authorized your App, through a Connect Session or a grant you created it from. `key`: the brand gave you a key of its own, which you sent to `POST /v1/connections`; there is no App."
        },
        "oauth": {
          "type": "object",
          "required": [
            "appId"
          ],
          "properties": {
            "appId": {
              "type": "string",
              "description": "The App the Connection acts through.",
              "minLength": 1
            }
          },
          "additionalProperties": false,
          "description": "What an `oauth` Connection was obtained through. Present exactly when `method` is `\"oauth\"`."
        },
        "key": {
          "type": "object",
          "required": [
            "config"
          ],
          "properties": {
            "config": {
              "type": "object",
              "patternProperties": {
                "^.*$": {}
              },
              "description": "The key's public half, as `GET /v1/issuers` declares it (`methods.key.config`), such as the key's id; never its secret."
            }
          },
          "additionalProperties": false,
          "description": "What a `key` Connection holds of its key that Koil returns. Present exactly when `method` is `\"key\"`."
        },
        "clientUserId": {
          "type": "string",
          "description": "Your own identifier for the end user the Connection belongs to.",
          "maxLength": 255
        },
        "subject": {
          "type": "string",
          "description": "The platform's id for the account the Connection's credential acts as: for `oauth`, the user who authorized (Google's `sub`, Facebook's user id, Instagram's `user_id`, TikTok's `open_id`); for a key, the account the platform confirmed it belongs to. LinkedIn names none, and a lookup that failed at connect time leaves it absent."
        },
        "status": {
          "enum": [
            "active",
            "reauthorization_required",
            "invalid"
          ],
          "description": "`active` while its credential authorizes. `reauthorization_required` while the end user must connect again soon: an `expiring` credential still works until then, while a key the platform refuses (`key_refused`, for which Koil polls nothing and bills nothing) or will not issue a token from (`renewal_failed`) does not. `invalid` once it no longer authorizes, which is final: the end user must connect again, and Koil polls nothing for its Profiles, does not bill them, and deletes the Connection six days after it became `invalid`. Either way, create a Connect Session with this `connectionId` (or, for a key, replace it with `PUT /v1/connections/{connectionId}/credential`), and `connection.updated` announces every change. `statusReason` says why it is not `active`."
        },
        "statusReason": {
          "enum": [
            "renewal_failed",
            "revoked",
            "expired",
            "duplicate",
            "expiring",
            "key_refused"
          ],
          "description": "Why the Connection is not `active`; absent while it is. For `invalid`: `renewal_failed` (the platform refused to renew the credential), `revoked` (the platform refused its token, for example because the end user removed the app), `expired` (the credential ran out with nothing to renew it), `duplicate` (the account it acts as already has another Connection under the same issuer, App where it has one, and `clientUserId`, which keeps its place), or `key_refused` (the platform still refused the key 48 hours after it first did). For `reauthorization_required`: `expiring` (the credential, or the refresh token that renews it, expires within 14 days, by `credential.reauthorizeBy`), or `key_refused` (the platform refused a key whose refusal can be a passing one, such as App Store Connect's 401: Koil asks the platform again for 48 hours, and the Connection is `active` again if it takes the key, or `invalid` if it still refuses it)."
        },
        "credential": {
          "type": "object",
          "properties": {
            "scopes": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "The scopes the credential holds, as Koil stores them. Absent when Koil does not know them, which is not a credential of none."
            },
            "reauthorizeBy": {
              "type": "string",
              "format": "date-time",
              "description": "When the credential stops working unless its end user authorizes again. Where Koil can renew the credential, it is the platform's deadline for renewing it: TikTok's and LinkedIn's refresh tokens expire about a year after authorization. Where nothing renews it (a LinkedIn grant without a refresh token), it is the access token's own expiry. Once a refresh token's deadline has passed, it stays that deadline, or the access token's expiry where that is earlier: it never moves later. Koil makes the Connection `reauthorization_required` 14 days ahead of it; send the end user through a Connect Session with this `connectionId` before then. Absent when nothing but a revocation ends the credential (a key, which issues its own tokens), or while Koil does not know the date: a grant created without `refreshTokenExpiresAt`, until a renewal states it."
            }
          },
          "additionalProperties": false,
          "description": "What the Connection's credential states of itself, wherever the Connection appears: its read, its listing and its events. Absent while Koil holds no credential for the Connection, as once it is `invalid`. The expiry of an access token Koil renews is Koil's concern, so it is not stated here."
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `connection.updated`

A connection's `status` or `statusReason` changed, or its end user authorized the App again in place. `data` is the connection as the change left it. A `status` other than `active` means the end user must authorize again: create a Connect Session with this `connectionId` and send them to its `url`. `reauthorization_required` (`statusReason` `expiring`) means the credential still works but will stop within 14 days, by `credential.reauthorizeBy`; with `key_refused`, the platform refused the key and Koil asks it again for 48 hours before the connection is `invalid`; `invalid` means it has stopped, for good (`renewal_failed`: the platform refused to renew it; `revoked`: the platform refused its token; `expired`: it ran out with nothing to renew it; `key_refused`: the platform still refused the key 48 hours on). A reauthorization keeps the connection's id and its profiles, and returns it to `active`. A connection still `invalid` six days later is deleted, since the failure may be a revocation.

`data` is the resource exactly as `GET /v1/connections/{connectionId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `connectionId` | `string` | yes |  |
| `issuerId` | `string` | yes |  |
| `appId` | `string` | no |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"connection"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes | Koil Connection identifier. |
| `issuerId` | `string` | yes | The issuer the Connection's credential comes from (`GET /v1/issuers`): for `oauth`, its App's, such as `facebook` or `google`; for a key, the one the key is for, such as `app_store_connect`. |
| `method` | `"oauth" \| "key"` | yes | How the Connection was obtained. `oauth`: an end user authorized your App, through a Connect Session or a grant you created it from. `key`: the brand gave you a key of its own, which you sent to `POST /v1/connections`; there is no App. |
| `oauth` | `object` | no | What an `oauth` Connection was obtained through. Present exactly when `method` is `"oauth"`. |
| `key` | `object` | no | What a `key` Connection holds of its key that Koil returns. Present exactly when `method` is `"key"`. |
| `clientUserId` | `string` | no | Your own identifier for the end user the Connection belongs to. |
| `subject` | `string` | no | The platform's id for the account the Connection's credential acts as: for `oauth`, the user who authorized (Google's `sub`, Facebook's user id, Instagram's `user_id`, TikTok's `open_id`); for a key, the account the platform confirmed it belongs to. LinkedIn names none, and a lookup that failed at connect time leaves it absent. |
| `status` | `"active" \| "reauthorization_required" \| "invalid"` | yes | `active` while its credential authorizes. `reauthorization_required` while the end user must connect again soon: an `expiring` credential still works until then, while a key the platform refuses (`key_refused`, for which Koil polls nothing and bills nothing) or will not issue a token from (`renewal_failed`) does not. `invalid` once it no longer authorizes, which is final: the end user must connect again, and Koil polls nothing for its Profiles, does not bill them, and deletes the Connection six days after it became `invalid`. Either way, create a Connect Session with this `connectionId` (or, for a key, replace it with `PUT /v1/connections/{connectionId}/credential`), and `connection.updated` announces every change. `statusReason` says why it is not `active`. |
| `statusReason` | `"renewal_failed" \| "revoked" \| "expired" \| "duplicate" \| "expiring" \| "key_refused"` | no | Why the Connection is not `active`; absent while it is. For `invalid`: `renewal_failed` (the platform refused to renew the credential), `revoked` (the platform refused its token, for example because the end user removed the app), `expired` (the credential ran out with nothing to renew it), `duplicate` (the account it acts as already has another Connection under the same issuer, App where it has one, and `clientUserId`, which keeps its place), or `key_refused` (the platform still refused the key 48 hours after it first did). For `reauthorization_required`: `expiring` (the credential, or the refresh token that renews it, expires within 14 days, by `credential.reauthorizeBy`), or `key_refused` (the platform refused a key whose refusal can be a passing one, such as App Store Connect's 401: Koil asks the platform again for 48 hours, and the Connection is `active` again if it takes the key, or `invalid` if it still refuses it). |
| `credential` | `object` | no | What the Connection's credential states of itself, wherever the Connection appears: its read, its listing and its events. Absent while Koil holds no credential for the Connection, as once it is `invalid`. The expiry of an access token Koil renews is Koil's concern, so it is not stated here. |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "connection.updated"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "connectionId",
        "issuerId"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "connectionId": {
          "type": "string",
          "minLength": 1
        },
        "issuerId": {
          "type": "string",
          "minLength": 1
        },
        "appId": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "issuerId",
        "method",
        "status",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "connection",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "description": "Koil Connection identifier.",
          "minLength": 1
        },
        "issuerId": {
          "type": "string",
          "description": "The issuer the Connection's credential comes from (`GET /v1/issuers`): for `oauth`, its App's, such as `facebook` or `google`; for a key, the one the key is for, such as `app_store_connect`.",
          "minLength": 1
        },
        "method": {
          "enum": [
            "oauth",
            "key"
          ],
          "description": "How the Connection was obtained. `oauth`: an end user authorized your App, through a Connect Session or a grant you created it from. `key`: the brand gave you a key of its own, which you sent to `POST /v1/connections`; there is no App."
        },
        "oauth": {
          "type": "object",
          "required": [
            "appId"
          ],
          "properties": {
            "appId": {
              "type": "string",
              "description": "The App the Connection acts through.",
              "minLength": 1
            }
          },
          "additionalProperties": false,
          "description": "What an `oauth` Connection was obtained through. Present exactly when `method` is `\"oauth\"`."
        },
        "key": {
          "type": "object",
          "required": [
            "config"
          ],
          "properties": {
            "config": {
              "type": "object",
              "patternProperties": {
                "^.*$": {}
              },
              "description": "The key's public half, as `GET /v1/issuers` declares it (`methods.key.config`), such as the key's id; never its secret."
            }
          },
          "additionalProperties": false,
          "description": "What a `key` Connection holds of its key that Koil returns. Present exactly when `method` is `\"key\"`."
        },
        "clientUserId": {
          "type": "string",
          "description": "Your own identifier for the end user the Connection belongs to.",
          "maxLength": 255
        },
        "subject": {
          "type": "string",
          "description": "The platform's id for the account the Connection's credential acts as: for `oauth`, the user who authorized (Google's `sub`, Facebook's user id, Instagram's `user_id`, TikTok's `open_id`); for a key, the account the platform confirmed it belongs to. LinkedIn names none, and a lookup that failed at connect time leaves it absent."
        },
        "status": {
          "enum": [
            "active",
            "reauthorization_required",
            "invalid"
          ],
          "description": "`active` while its credential authorizes. `reauthorization_required` while the end user must connect again soon: an `expiring` credential still works until then, while a key the platform refuses (`key_refused`, for which Koil polls nothing and bills nothing) or will not issue a token from (`renewal_failed`) does not. `invalid` once it no longer authorizes, which is final: the end user must connect again, and Koil polls nothing for its Profiles, does not bill them, and deletes the Connection six days after it became `invalid`. Either way, create a Connect Session with this `connectionId` (or, for a key, replace it with `PUT /v1/connections/{connectionId}/credential`), and `connection.updated` announces every change. `statusReason` says why it is not `active`."
        },
        "statusReason": {
          "enum": [
            "renewal_failed",
            "revoked",
            "expired",
            "duplicate",
            "expiring",
            "key_refused"
          ],
          "description": "Why the Connection is not `active`; absent while it is. For `invalid`: `renewal_failed` (the platform refused to renew the credential), `revoked` (the platform refused its token, for example because the end user removed the app), `expired` (the credential ran out with nothing to renew it), `duplicate` (the account it acts as already has another Connection under the same issuer, App where it has one, and `clientUserId`, which keeps its place), or `key_refused` (the platform still refused the key 48 hours after it first did). For `reauthorization_required`: `expiring` (the credential, or the refresh token that renews it, expires within 14 days, by `credential.reauthorizeBy`), or `key_refused` (the platform refused a key whose refusal can be a passing one, such as App Store Connect's 401: Koil asks the platform again for 48 hours, and the Connection is `active` again if it takes the key, or `invalid` if it still refuses it)."
        },
        "credential": {
          "type": "object",
          "properties": {
            "scopes": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "The scopes the credential holds, as Koil stores them. Absent when Koil does not know them, which is not a credential of none."
            },
            "reauthorizeBy": {
              "type": "string",
              "format": "date-time",
              "description": "When the credential stops working unless its end user authorizes again. Where Koil can renew the credential, it is the platform's deadline for renewing it: TikTok's and LinkedIn's refresh tokens expire about a year after authorization. Where nothing renews it (a LinkedIn grant without a refresh token), it is the access token's own expiry. Once a refresh token's deadline has passed, it stays that deadline, or the access token's expiry where that is earlier: it never moves later. Koil makes the Connection `reauthorization_required` 14 days ahead of it; send the end user through a Connect Session with this `connectionId` before then. Absent when nothing but a revocation ends the credential (a key, which issues its own tokens), or while Koil does not know the date: a grant created without `refreshTokenExpiresAt`, until a renewal states it."
            }
          },
          "additionalProperties": false,
          "description": "What the Connection's credential states of itself, wherever the Connection appears: its read, its listing and its events. Absent while Koil holds no credential for the Connection, as once it is `invalid`. The expiry of an access token Koil renews is Koil's concern, so it is not stated here."
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

## Profile

### `profile.created`

A profile was created.

`data` is the resource exactly as `GET /v1/profiles/{profileId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes |  |
| `platformId` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"profile"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes | Koil Profile identifier. |
| `platformId` | `string` | yes | Koil platform identifier. |
| `connectionId` | `string` | yes | Koil Connection identifier. |
| `platformProfileExternalId` | `string` | yes |  |
| `status` | `"active" \| "invalid"` | yes | `active` while Koil can act for the profile. `invalid` once the platform no longer lets the Connection act for it, though the Connection itself still authorizes: the end user lost their role on the Page, or the Page is gone. Once the end user has access again, create a Connect Session with the profile's `connectionId`; the profile returns to `active` when Koil can act for it again. `profile.updated` announces every change. While `invalid`, or while its Connection is, Koil polls nothing for it, refuses operations through it, and does not bill it; one still `invalid` six days after it became so is deleted. A profile whose Connection is not `active` keeps its own status; check the Connection's too. |
| `statusReason` | `"revoked" \| "mint_failed"` | no | Why the profile is not `active`; absent while it is. `revoked`: the platform refused the credential Koil acts for the profile with, and would not issue a new one. `mint_failed`: the platform refused that credential, and minting a new one has kept failing for a day. |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "profile.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformId"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "platformId",
        "connectionId",
        "platformProfileExternalId",
        "status",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "profile",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "description": "Koil Profile identifier.",
          "minLength": 1
        },
        "platformId": {
          "type": "string",
          "description": "Koil platform identifier.",
          "minLength": 1
        },
        "connectionId": {
          "type": "string",
          "description": "Koil Connection identifier.",
          "minLength": 1
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "active",
            "invalid"
          ],
          "description": "`active` while Koil can act for the profile. `invalid` once the platform no longer lets the Connection act for it, though the Connection itself still authorizes: the end user lost their role on the Page, or the Page is gone. Once the end user has access again, create a Connect Session with the profile's `connectionId`; the profile returns to `active` when Koil can act for it again. `profile.updated` announces every change. While `invalid`, or while its Connection is, Koil polls nothing for it, refuses operations through it, and does not bill it; one still `invalid` six days after it became so is deleted. A profile whose Connection is not `active` keeps its own status; check the Connection's too."
        },
        "statusReason": {
          "enum": [
            "revoked",
            "mint_failed"
          ],
          "description": "Why the profile is not `active`; absent while it is. `revoked`: the platform refused the credential Koil acts for the profile with, and would not issue a new one. `mint_failed`: the platform refused that credential, and minting a new one has kept failing for a day."
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `profile.deleted`

A profile was deleted. `data` is the profile as it last stood.

`data` is the resource exactly as `GET /v1/profiles/{profileId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes |  |
| `platformId` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"profile"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes | Koil Profile identifier. |
| `platformId` | `string` | yes | Koil platform identifier. |
| `connectionId` | `string` | yes | Koil Connection identifier. |
| `platformProfileExternalId` | `string` | yes |  |
| `status` | `"active" \| "invalid"` | yes | `active` while Koil can act for the profile. `invalid` once the platform no longer lets the Connection act for it, though the Connection itself still authorizes: the end user lost their role on the Page, or the Page is gone. Once the end user has access again, create a Connect Session with the profile's `connectionId`; the profile returns to `active` when Koil can act for it again. `profile.updated` announces every change. While `invalid`, or while its Connection is, Koil polls nothing for it, refuses operations through it, and does not bill it; one still `invalid` six days after it became so is deleted. A profile whose Connection is not `active` keeps its own status; check the Connection's too. |
| `statusReason` | `"revoked" \| "mint_failed"` | no | Why the profile is not `active`; absent while it is. `revoked`: the platform refused the credential Koil acts for the profile with, and would not issue a new one. `mint_failed`: the platform refused that credential, and minting a new one has kept failing for a day. |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "profile.deleted"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformId"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "platformId",
        "connectionId",
        "platformProfileExternalId",
        "status",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "profile",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "description": "Koil Profile identifier.",
          "minLength": 1
        },
        "platformId": {
          "type": "string",
          "description": "Koil platform identifier.",
          "minLength": 1
        },
        "connectionId": {
          "type": "string",
          "description": "Koil Connection identifier.",
          "minLength": 1
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "active",
            "invalid"
          ],
          "description": "`active` while Koil can act for the profile. `invalid` once the platform no longer lets the Connection act for it, though the Connection itself still authorizes: the end user lost their role on the Page, or the Page is gone. Once the end user has access again, create a Connect Session with the profile's `connectionId`; the profile returns to `active` when Koil can act for it again. `profile.updated` announces every change. While `invalid`, or while its Connection is, Koil polls nothing for it, refuses operations through it, and does not bill it; one still `invalid` six days after it became so is deleted. A profile whose Connection is not `active` keeps its own status; check the Connection's too."
        },
        "statusReason": {
          "enum": [
            "revoked",
            "mint_failed"
          ],
          "description": "Why the profile is not `active`; absent while it is. `revoked`: the platform refused the credential Koil acts for the profile with, and would not issue a new one. `mint_failed`: the platform refused that credential, and minting a new one has kept failing for a day."
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `profile.updated`

A profile's `status` or `statusReason` changed. `data` is the profile as the change left it. `invalid` (`statusReason` `revoked`) means the platform no longer lets the profile's Connection act for it, though the Connection still authorizes: the end user lost their role on the Page, or the Page is gone. Once they have access again, create a Connect Session with the profile's `connectionId`; the profile returns to `active` when Koil can act for it again.

`data` is the resource exactly as `GET /v1/profiles/{profileId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes |  |
| `platformId` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"profile"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes | Koil Profile identifier. |
| `platformId` | `string` | yes | Koil platform identifier. |
| `connectionId` | `string` | yes | Koil Connection identifier. |
| `platformProfileExternalId` | `string` | yes |  |
| `status` | `"active" \| "invalid"` | yes | `active` while Koil can act for the profile. `invalid` once the platform no longer lets the Connection act for it, though the Connection itself still authorizes: the end user lost their role on the Page, or the Page is gone. Once the end user has access again, create a Connect Session with the profile's `connectionId`; the profile returns to `active` when Koil can act for it again. `profile.updated` announces every change. While `invalid`, or while its Connection is, Koil polls nothing for it, refuses operations through it, and does not bill it; one still `invalid` six days after it became so is deleted. A profile whose Connection is not `active` keeps its own status; check the Connection's too. |
| `statusReason` | `"revoked" \| "mint_failed"` | no | Why the profile is not `active`; absent while it is. `revoked`: the platform refused the credential Koil acts for the profile with, and would not issue a new one. `mint_failed`: the platform refused that credential, and minting a new one has kept failing for a day. |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "profile.updated"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformId"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "platformId",
        "connectionId",
        "platformProfileExternalId",
        "status",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "profile",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "description": "Koil Profile identifier.",
          "minLength": 1
        },
        "platformId": {
          "type": "string",
          "description": "Koil platform identifier.",
          "minLength": 1
        },
        "connectionId": {
          "type": "string",
          "description": "Koil Connection identifier.",
          "minLength": 1
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "active",
            "invalid"
          ],
          "description": "`active` while Koil can act for the profile. `invalid` once the platform no longer lets the Connection act for it, though the Connection itself still authorizes: the end user lost their role on the Page, or the Page is gone. Once the end user has access again, create a Connect Session with the profile's `connectionId`; the profile returns to `active` when Koil can act for it again. `profile.updated` announces every change. While `invalid`, or while its Connection is, Koil polls nothing for it, refuses operations through it, and does not bill it; one still `invalid` six days after it became so is deleted. A profile whose Connection is not `active` keeps its own status; check the Connection's too."
        },
        "statusReason": {
          "enum": [
            "revoked",
            "mint_failed"
          ],
          "description": "Why the profile is not `active`; absent while it is. `revoked`: the platform refused the credential Koil acts for the profile with, and would not issue a new one. `mint_failed`: the platform refused that credential, and minting a new one has kept failing for a day."
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

## Media

### `media.process_failed`

Media processing failed; the media cannot be published.

`data` is the resource exactly as `GET /v1/media/{mediaId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `mediaId` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"media"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes |  |
| `status` | `"created" \| "uploaded" \| "processing" \| "ready" \| "failed"` | yes |  |
| `origin` | `"upload" \| "source_url"` | yes |  |
| `contentType` | `string` | no | The MIME type. Once the media is `ready` it is the one Koil read from the file's bytes: `image/*`, `video/*`, `audio/*`, or a document's (`application/pdf`, or the Office type the create declared when the bytes are an Office file); before that, it is only what the create declared. |
| `sizeBytes` | `integer` | no |  |
| `width` | `integer` | no | Width in pixels as displayed: an image's EXIF orientation and a video's rotation are applied. Absent until the media is `ready`. |
| `height` | `integer` | no | Height in pixels as displayed: an image's EXIF orientation and a video's rotation are applied. Absent until the media is `ready`. |
| `format` | `string` | no | An image's format (`jpeg`, `png`, `gif`, or `webp`), a video's container as ffprobe names it, a comma-separated list of the formats it matches (`mov,mp4,m4a,3gp,3g2,mj2`), or an audio file's or document's MIME type. Absent until the media is `ready`. |
| `durationSeconds` | `number` | no | A video's duration in seconds. Absent for an image, and until the media is `ready`. |
| `videoCodec` | `string` | no | A video's codec as ffprobe names it (`h264`, `hevc`, `vp9`, `av1`). Absent for an image, and until the media is `ready`. |
| `frameRate` | `number` | no | A video's frame rate in frames per second, rounded to three decimals (`29.97`). Absent for an image, when the video does not report one, and until the media is `ready`. |
| `sourceUrl` | `string (uri)` | no |  |
| `error` | `object` | no |  |
| `previewUrl` | `string (uri)` | no |  |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "media.process_failed"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "mediaId"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "mediaId": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "status",
        "origin",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "media",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "created",
            "uploaded",
            "processing",
            "ready",
            "failed"
          ]
        },
        "origin": {
          "enum": [
            "upload",
            "source_url"
          ]
        },
        "contentType": {
          "type": "string",
          "minLength": 1,
          "description": "The MIME type. Once the media is `ready` it is the one Koil read from the file's bytes: `image/*`, `video/*`, `audio/*`, or a document's (`application/pdf`, or the Office type the create declared when the bytes are an Office file); before that, it is only what the create declared."
        },
        "sizeBytes": {
          "type": "integer",
          "minimum": 0
        },
        "width": {
          "type": "integer",
          "minimum": 0,
          "description": "Width in pixels as displayed: an image's EXIF orientation and a video's rotation are applied. Absent until the media is `ready`."
        },
        "height": {
          "type": "integer",
          "minimum": 0,
          "description": "Height in pixels as displayed: an image's EXIF orientation and a video's rotation are applied. Absent until the media is `ready`."
        },
        "format": {
          "type": "string",
          "minLength": 1,
          "description": "An image's format (`jpeg`, `png`, `gif`, or `webp`), a video's container as ffprobe names it, a comma-separated list of the formats it matches (`mov,mp4,m4a,3gp,3g2,mj2`), or an audio file's or document's MIME type. Absent until the media is `ready`."
        },
        "durationSeconds": {
          "type": "number",
          "minimum": 0,
          "description": "A video's duration in seconds. Absent for an image, and until the media is `ready`."
        },
        "videoCodec": {
          "type": "string",
          "minLength": 1,
          "description": "A video's codec as ffprobe names it (`h264`, `hevc`, `vp9`, `av1`). Absent for an image, and until the media is `ready`."
        },
        "frameRate": {
          "type": "number",
          "minimum": 0,
          "description": "A video's frame rate in frames per second, rounded to three decimals (`29.97`). Absent for an image, when the video does not report one, and until the media is `ready`."
        },
        "sourceUrl": {
          "type": "string",
          "format": "uri"
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "meta"
          ],
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "validation_error",
                "not_supported",
                "unauthorized",
                "quota_exceeded",
                "permission_denied",
                "scope_insufficient",
                "connection_invalid",
                "not_found",
                "conflict",
                "rate_limit_exceeded",
                "platform_rate_limit",
                "internal",
                "service_unavailable"
              ],
              "description": "Stable error code. `validation_error` (400), `not_supported` (400), `unauthorized` (401), `quota_exceeded` (402), `permission_denied` (403), `scope_insufficient` (403), `connection_invalid` (403), `not_found` (404), `conflict` (409), `rate_limit_exceeded` (429), `platform_rate_limit` (429), `internal` (500, 502, 504), `service_unavailable` (503)."
            },
            "message": {
              "type": "string",
              "description": "Human-readable summary."
            },
            "meta": {
              "type": "object",
              "properties": {
                "violations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "code",
                      "path",
                      "message"
                    ],
                    "properties": {
                      "code": {
                        "type": "string",
                        "description": "Stable violation code, such as `missing_field`, `unknown_field`, `schema_error`, `invalid_value` or `invalid_combination`."
                      },
                      "path": {
                        "type": "string",
                        "description": "JSON pointer into the request: path, query and body fields share one pointer space (`/cursor`, `/publishRequests/0/args/text`), a header is `/headers/<lowercase name>`, and `\"\"` is the request as a whole."
                      },
                      "message": {
                        "type": "string",
                        "description": "Human-readable explanation."
                      }
                    },
                    "additionalProperties": false
                  },
                  "description": "Every problem with the request. Always present on a `validation_error`."
                },
                "budgets": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded`: every budget that refused the request: `organization` (every authenticated request), `profile` (a request that acts on a Profile, one budget per Profile) or `client_address` (requests with no key or a rejected one). Koil may add budgets; treat an unknown one as covering the whole Organization."
                },
                "profileIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded` whose `budgets` include `profile`: the Profiles whose budget is spent. Requests that act on other Profiles are unaffected."
                },
                "required": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `permission_denied`: the API key permissions the operation requires that the key lacks."
                },
                "limit": {
                  "type": "integer",
                  "description": "On a `quota_exceeded`: the cap that was reached."
                },
                "resourceType": {
                  "type": "string",
                  "description": "On a `not_found` or a `conflict` over an existing resource: the kind of resource, such as `profile` or `connection`."
                },
                "resourceId": {
                  "type": "string",
                  "description": "With `resourceType`: the id of the resource not found or already there."
                },
                "reason": {
                  "type": "string",
                  "description": "On a failed publish or backfill request, or a failed Connect Session, that Koil failed itself, not the platform: why, such as `media_incompatible`, `media_transform_not_entitled` or `subject_mismatch` (a reconnect authorized a different platform account than the Connection's)."
                },
                "refusalReason": {
                  "type": "string",
                  "enum": [
                    "messaging_window_closed",
                    "recipient_rate_limited",
                    "recipient_unavailable",
                    "publishing_limit_reached"
                  ],
                  "description": "Why the platform refused, where the code alone does not say what to do. `messaging_window_closed`: The platform takes a message to this person only inside a window that has closed: WhatsApp's 24-hour customer service window, the Messenger and Instagram messaging window, or TikTok's allowance since the person last wrote. It reopens when the person writes again. `recipient_rate_limited`: Too many messages to this one person in a short time; messages to others are unaffected. Retry after `Retry-After`. `recipient_unavailable`: The person cannot receive messages from this Profile: they blocked it or deactivated their account, or, on WhatsApp, the number has no account or an outdated app. Retrying does not help. `publishing_limit_reached`: The account's own publishing cap on the platform is spent: Instagram's 24-hour content publishing limit, YouTube's daily upload limit, or TikTok's limit on posts. Publish again once it resets."
                }
              },
              "additionalProperties": {},
              "description": "Structured detail; the keys depend on `code`."
            }
          },
          "additionalProperties": false
        },
        "previewUrl": {
          "type": "string",
          "format": "uri"
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `media.processed`

Media was verified and copied to originals; the preview URL is now usable and it is ready to publish.

`data` is the resource exactly as `GET /v1/media/{mediaId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `mediaId` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"media"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes |  |
| `status` | `"created" \| "uploaded" \| "processing" \| "ready" \| "failed"` | yes |  |
| `origin` | `"upload" \| "source_url"` | yes |  |
| `contentType` | `string` | no | The MIME type. Once the media is `ready` it is the one Koil read from the file's bytes: `image/*`, `video/*`, `audio/*`, or a document's (`application/pdf`, or the Office type the create declared when the bytes are an Office file); before that, it is only what the create declared. |
| `sizeBytes` | `integer` | no |  |
| `width` | `integer` | no | Width in pixels as displayed: an image's EXIF orientation and a video's rotation are applied. Absent until the media is `ready`. |
| `height` | `integer` | no | Height in pixels as displayed: an image's EXIF orientation and a video's rotation are applied. Absent until the media is `ready`. |
| `format` | `string` | no | An image's format (`jpeg`, `png`, `gif`, or `webp`), a video's container as ffprobe names it, a comma-separated list of the formats it matches (`mov,mp4,m4a,3gp,3g2,mj2`), or an audio file's or document's MIME type. Absent until the media is `ready`. |
| `durationSeconds` | `number` | no | A video's duration in seconds. Absent for an image, and until the media is `ready`. |
| `videoCodec` | `string` | no | A video's codec as ffprobe names it (`h264`, `hevc`, `vp9`, `av1`). Absent for an image, and until the media is `ready`. |
| `frameRate` | `number` | no | A video's frame rate in frames per second, rounded to three decimals (`29.97`). Absent for an image, when the video does not report one, and until the media is `ready`. |
| `sourceUrl` | `string (uri)` | no |  |
| `error` | `object` | no |  |
| `previewUrl` | `string (uri)` | no |  |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "media.processed"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "mediaId"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "mediaId": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "status",
        "origin",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "media",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "created",
            "uploaded",
            "processing",
            "ready",
            "failed"
          ]
        },
        "origin": {
          "enum": [
            "upload",
            "source_url"
          ]
        },
        "contentType": {
          "type": "string",
          "minLength": 1,
          "description": "The MIME type. Once the media is `ready` it is the one Koil read from the file's bytes: `image/*`, `video/*`, `audio/*`, or a document's (`application/pdf`, or the Office type the create declared when the bytes are an Office file); before that, it is only what the create declared."
        },
        "sizeBytes": {
          "type": "integer",
          "minimum": 0
        },
        "width": {
          "type": "integer",
          "minimum": 0,
          "description": "Width in pixels as displayed: an image's EXIF orientation and a video's rotation are applied. Absent until the media is `ready`."
        },
        "height": {
          "type": "integer",
          "minimum": 0,
          "description": "Height in pixels as displayed: an image's EXIF orientation and a video's rotation are applied. Absent until the media is `ready`."
        },
        "format": {
          "type": "string",
          "minLength": 1,
          "description": "An image's format (`jpeg`, `png`, `gif`, or `webp`), a video's container as ffprobe names it, a comma-separated list of the formats it matches (`mov,mp4,m4a,3gp,3g2,mj2`), or an audio file's or document's MIME type. Absent until the media is `ready`."
        },
        "durationSeconds": {
          "type": "number",
          "minimum": 0,
          "description": "A video's duration in seconds. Absent for an image, and until the media is `ready`."
        },
        "videoCodec": {
          "type": "string",
          "minLength": 1,
          "description": "A video's codec as ffprobe names it (`h264`, `hevc`, `vp9`, `av1`). Absent for an image, and until the media is `ready`."
        },
        "frameRate": {
          "type": "number",
          "minimum": 0,
          "description": "A video's frame rate in frames per second, rounded to three decimals (`29.97`). Absent for an image, when the video does not report one, and until the media is `ready`."
        },
        "sourceUrl": {
          "type": "string",
          "format": "uri"
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "meta"
          ],
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "validation_error",
                "not_supported",
                "unauthorized",
                "quota_exceeded",
                "permission_denied",
                "scope_insufficient",
                "connection_invalid",
                "not_found",
                "conflict",
                "rate_limit_exceeded",
                "platform_rate_limit",
                "internal",
                "service_unavailable"
              ],
              "description": "Stable error code. `validation_error` (400), `not_supported` (400), `unauthorized` (401), `quota_exceeded` (402), `permission_denied` (403), `scope_insufficient` (403), `connection_invalid` (403), `not_found` (404), `conflict` (409), `rate_limit_exceeded` (429), `platform_rate_limit` (429), `internal` (500, 502, 504), `service_unavailable` (503)."
            },
            "message": {
              "type": "string",
              "description": "Human-readable summary."
            },
            "meta": {
              "type": "object",
              "properties": {
                "violations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "code",
                      "path",
                      "message"
                    ],
                    "properties": {
                      "code": {
                        "type": "string",
                        "description": "Stable violation code, such as `missing_field`, `unknown_field`, `schema_error`, `invalid_value` or `invalid_combination`."
                      },
                      "path": {
                        "type": "string",
                        "description": "JSON pointer into the request: path, query and body fields share one pointer space (`/cursor`, `/publishRequests/0/args/text`), a header is `/headers/<lowercase name>`, and `\"\"` is the request as a whole."
                      },
                      "message": {
                        "type": "string",
                        "description": "Human-readable explanation."
                      }
                    },
                    "additionalProperties": false
                  },
                  "description": "Every problem with the request. Always present on a `validation_error`."
                },
                "budgets": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded`: every budget that refused the request: `organization` (every authenticated request), `profile` (a request that acts on a Profile, one budget per Profile) or `client_address` (requests with no key or a rejected one). Koil may add budgets; treat an unknown one as covering the whole Organization."
                },
                "profileIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded` whose `budgets` include `profile`: the Profiles whose budget is spent. Requests that act on other Profiles are unaffected."
                },
                "required": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `permission_denied`: the API key permissions the operation requires that the key lacks."
                },
                "limit": {
                  "type": "integer",
                  "description": "On a `quota_exceeded`: the cap that was reached."
                },
                "resourceType": {
                  "type": "string",
                  "description": "On a `not_found` or a `conflict` over an existing resource: the kind of resource, such as `profile` or `connection`."
                },
                "resourceId": {
                  "type": "string",
                  "description": "With `resourceType`: the id of the resource not found or already there."
                },
                "reason": {
                  "type": "string",
                  "description": "On a failed publish or backfill request, or a failed Connect Session, that Koil failed itself, not the platform: why, such as `media_incompatible`, `media_transform_not_entitled` or `subject_mismatch` (a reconnect authorized a different platform account than the Connection's)."
                },
                "refusalReason": {
                  "type": "string",
                  "enum": [
                    "messaging_window_closed",
                    "recipient_rate_limited",
                    "recipient_unavailable",
                    "publishing_limit_reached"
                  ],
                  "description": "Why the platform refused, where the code alone does not say what to do. `messaging_window_closed`: The platform takes a message to this person only inside a window that has closed: WhatsApp's 24-hour customer service window, the Messenger and Instagram messaging window, or TikTok's allowance since the person last wrote. It reopens when the person writes again. `recipient_rate_limited`: Too many messages to this one person in a short time; messages to others are unaffected. Retry after `Retry-After`. `recipient_unavailable`: The person cannot receive messages from this Profile: they blocked it or deactivated their account, or, on WhatsApp, the number has no account or an outdated app. Retrying does not help. `publishing_limit_reached`: The account's own publishing cap on the platform is spent: Instagram's 24-hour content publishing limit, YouTube's daily upload limit, or TikTok's limit on posts. Publish again once it resets."
                }
              },
              "additionalProperties": {},
              "description": "Structured detail; the keys depend on `code`."
            }
          },
          "additionalProperties": false
        },
        "previewUrl": {
          "type": "string",
          "format": "uri"
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `media.upload_failed`

A media upload never arrived or failed verification.

`data` is the resource exactly as `GET /v1/media/{mediaId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `mediaId` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"media"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes |  |
| `status` | `"created" \| "uploaded" \| "processing" \| "ready" \| "failed"` | yes |  |
| `origin` | `"upload" \| "source_url"` | yes |  |
| `contentType` | `string` | no | The MIME type. Once the media is `ready` it is the one Koil read from the file's bytes: `image/*`, `video/*`, `audio/*`, or a document's (`application/pdf`, or the Office type the create declared when the bytes are an Office file); before that, it is only what the create declared. |
| `sizeBytes` | `integer` | no |  |
| `width` | `integer` | no | Width in pixels as displayed: an image's EXIF orientation and a video's rotation are applied. Absent until the media is `ready`. |
| `height` | `integer` | no | Height in pixels as displayed: an image's EXIF orientation and a video's rotation are applied. Absent until the media is `ready`. |
| `format` | `string` | no | An image's format (`jpeg`, `png`, `gif`, or `webp`), a video's container as ffprobe names it, a comma-separated list of the formats it matches (`mov,mp4,m4a,3gp,3g2,mj2`), or an audio file's or document's MIME type. Absent until the media is `ready`. |
| `durationSeconds` | `number` | no | A video's duration in seconds. Absent for an image, and until the media is `ready`. |
| `videoCodec` | `string` | no | A video's codec as ffprobe names it (`h264`, `hevc`, `vp9`, `av1`). Absent for an image, and until the media is `ready`. |
| `frameRate` | `number` | no | A video's frame rate in frames per second, rounded to three decimals (`29.97`). Absent for an image, when the video does not report one, and until the media is `ready`. |
| `sourceUrl` | `string (uri)` | no |  |
| `error` | `object` | no |  |
| `previewUrl` | `string (uri)` | no |  |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "media.upload_failed"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "mediaId"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "mediaId": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "status",
        "origin",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "media",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "created",
            "uploaded",
            "processing",
            "ready",
            "failed"
          ]
        },
        "origin": {
          "enum": [
            "upload",
            "source_url"
          ]
        },
        "contentType": {
          "type": "string",
          "minLength": 1,
          "description": "The MIME type. Once the media is `ready` it is the one Koil read from the file's bytes: `image/*`, `video/*`, `audio/*`, or a document's (`application/pdf`, or the Office type the create declared when the bytes are an Office file); before that, it is only what the create declared."
        },
        "sizeBytes": {
          "type": "integer",
          "minimum": 0
        },
        "width": {
          "type": "integer",
          "minimum": 0,
          "description": "Width in pixels as displayed: an image's EXIF orientation and a video's rotation are applied. Absent until the media is `ready`."
        },
        "height": {
          "type": "integer",
          "minimum": 0,
          "description": "Height in pixels as displayed: an image's EXIF orientation and a video's rotation are applied. Absent until the media is `ready`."
        },
        "format": {
          "type": "string",
          "minLength": 1,
          "description": "An image's format (`jpeg`, `png`, `gif`, or `webp`), a video's container as ffprobe names it, a comma-separated list of the formats it matches (`mov,mp4,m4a,3gp,3g2,mj2`), or an audio file's or document's MIME type. Absent until the media is `ready`."
        },
        "durationSeconds": {
          "type": "number",
          "minimum": 0,
          "description": "A video's duration in seconds. Absent for an image, and until the media is `ready`."
        },
        "videoCodec": {
          "type": "string",
          "minLength": 1,
          "description": "A video's codec as ffprobe names it (`h264`, `hevc`, `vp9`, `av1`). Absent for an image, and until the media is `ready`."
        },
        "frameRate": {
          "type": "number",
          "minimum": 0,
          "description": "A video's frame rate in frames per second, rounded to three decimals (`29.97`). Absent for an image, when the video does not report one, and until the media is `ready`."
        },
        "sourceUrl": {
          "type": "string",
          "format": "uri"
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "meta"
          ],
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "validation_error",
                "not_supported",
                "unauthorized",
                "quota_exceeded",
                "permission_denied",
                "scope_insufficient",
                "connection_invalid",
                "not_found",
                "conflict",
                "rate_limit_exceeded",
                "platform_rate_limit",
                "internal",
                "service_unavailable"
              ],
              "description": "Stable error code. `validation_error` (400), `not_supported` (400), `unauthorized` (401), `quota_exceeded` (402), `permission_denied` (403), `scope_insufficient` (403), `connection_invalid` (403), `not_found` (404), `conflict` (409), `rate_limit_exceeded` (429), `platform_rate_limit` (429), `internal` (500, 502, 504), `service_unavailable` (503)."
            },
            "message": {
              "type": "string",
              "description": "Human-readable summary."
            },
            "meta": {
              "type": "object",
              "properties": {
                "violations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "code",
                      "path",
                      "message"
                    ],
                    "properties": {
                      "code": {
                        "type": "string",
                        "description": "Stable violation code, such as `missing_field`, `unknown_field`, `schema_error`, `invalid_value` or `invalid_combination`."
                      },
                      "path": {
                        "type": "string",
                        "description": "JSON pointer into the request: path, query and body fields share one pointer space (`/cursor`, `/publishRequests/0/args/text`), a header is `/headers/<lowercase name>`, and `\"\"` is the request as a whole."
                      },
                      "message": {
                        "type": "string",
                        "description": "Human-readable explanation."
                      }
                    },
                    "additionalProperties": false
                  },
                  "description": "Every problem with the request. Always present on a `validation_error`."
                },
                "budgets": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded`: every budget that refused the request: `organization` (every authenticated request), `profile` (a request that acts on a Profile, one budget per Profile) or `client_address` (requests with no key or a rejected one). Koil may add budgets; treat an unknown one as covering the whole Organization."
                },
                "profileIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded` whose `budgets` include `profile`: the Profiles whose budget is spent. Requests that act on other Profiles are unaffected."
                },
                "required": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `permission_denied`: the API key permissions the operation requires that the key lacks."
                },
                "limit": {
                  "type": "integer",
                  "description": "On a `quota_exceeded`: the cap that was reached."
                },
                "resourceType": {
                  "type": "string",
                  "description": "On a `not_found` or a `conflict` over an existing resource: the kind of resource, such as `profile` or `connection`."
                },
                "resourceId": {
                  "type": "string",
                  "description": "With `resourceType`: the id of the resource not found or already there."
                },
                "reason": {
                  "type": "string",
                  "description": "On a failed publish or backfill request, or a failed Connect Session, that Koil failed itself, not the platform: why, such as `media_incompatible`, `media_transform_not_entitled` or `subject_mismatch` (a reconnect authorized a different platform account than the Connection's)."
                },
                "refusalReason": {
                  "type": "string",
                  "enum": [
                    "messaging_window_closed",
                    "recipient_rate_limited",
                    "recipient_unavailable",
                    "publishing_limit_reached"
                  ],
                  "description": "Why the platform refused, where the code alone does not say what to do. `messaging_window_closed`: The platform takes a message to this person only inside a window that has closed: WhatsApp's 24-hour customer service window, the Messenger and Instagram messaging window, or TikTok's allowance since the person last wrote. It reopens when the person writes again. `recipient_rate_limited`: Too many messages to this one person in a short time; messages to others are unaffected. Retry after `Retry-After`. `recipient_unavailable`: The person cannot receive messages from this Profile: they blocked it or deactivated their account, or, on WhatsApp, the number has no account or an outdated app. Retrying does not help. `publishing_limit_reached`: The account's own publishing cap on the platform is spent: Instagram's 24-hour content publishing limit, YouTube's daily upload limit, or TikTok's limit on posts. Publish again once it resets."
                }
              },
              "additionalProperties": {},
              "description": "Structured detail; the keys depend on `code`."
            }
          },
          "additionalProperties": false
        },
        "previewUrl": {
          "type": "string",
          "format": "uri"
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `media.uploaded`

Media bytes landed in the uploads bucket and were accepted.

`data` is the resource exactly as `GET /v1/media/{mediaId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `mediaId` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"media"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes |  |
| `status` | `"created" \| "uploaded" \| "processing" \| "ready" \| "failed"` | yes |  |
| `origin` | `"upload" \| "source_url"` | yes |  |
| `contentType` | `string` | no | The MIME type. Once the media is `ready` it is the one Koil read from the file's bytes: `image/*`, `video/*`, `audio/*`, or a document's (`application/pdf`, or the Office type the create declared when the bytes are an Office file); before that, it is only what the create declared. |
| `sizeBytes` | `integer` | no |  |
| `width` | `integer` | no | Width in pixels as displayed: an image's EXIF orientation and a video's rotation are applied. Absent until the media is `ready`. |
| `height` | `integer` | no | Height in pixels as displayed: an image's EXIF orientation and a video's rotation are applied. Absent until the media is `ready`. |
| `format` | `string` | no | An image's format (`jpeg`, `png`, `gif`, or `webp`), a video's container as ffprobe names it, a comma-separated list of the formats it matches (`mov,mp4,m4a,3gp,3g2,mj2`), or an audio file's or document's MIME type. Absent until the media is `ready`. |
| `durationSeconds` | `number` | no | A video's duration in seconds. Absent for an image, and until the media is `ready`. |
| `videoCodec` | `string` | no | A video's codec as ffprobe names it (`h264`, `hevc`, `vp9`, `av1`). Absent for an image, and until the media is `ready`. |
| `frameRate` | `number` | no | A video's frame rate in frames per second, rounded to three decimals (`29.97`). Absent for an image, when the video does not report one, and until the media is `ready`. |
| `sourceUrl` | `string (uri)` | no |  |
| `error` | `object` | no |  |
| `previewUrl` | `string (uri)` | no |  |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "media.uploaded"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "mediaId"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "mediaId": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "status",
        "origin",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "media",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "created",
            "uploaded",
            "processing",
            "ready",
            "failed"
          ]
        },
        "origin": {
          "enum": [
            "upload",
            "source_url"
          ]
        },
        "contentType": {
          "type": "string",
          "minLength": 1,
          "description": "The MIME type. Once the media is `ready` it is the one Koil read from the file's bytes: `image/*`, `video/*`, `audio/*`, or a document's (`application/pdf`, or the Office type the create declared when the bytes are an Office file); before that, it is only what the create declared."
        },
        "sizeBytes": {
          "type": "integer",
          "minimum": 0
        },
        "width": {
          "type": "integer",
          "minimum": 0,
          "description": "Width in pixels as displayed: an image's EXIF orientation and a video's rotation are applied. Absent until the media is `ready`."
        },
        "height": {
          "type": "integer",
          "minimum": 0,
          "description": "Height in pixels as displayed: an image's EXIF orientation and a video's rotation are applied. Absent until the media is `ready`."
        },
        "format": {
          "type": "string",
          "minLength": 1,
          "description": "An image's format (`jpeg`, `png`, `gif`, or `webp`), a video's container as ffprobe names it, a comma-separated list of the formats it matches (`mov,mp4,m4a,3gp,3g2,mj2`), or an audio file's or document's MIME type. Absent until the media is `ready`."
        },
        "durationSeconds": {
          "type": "number",
          "minimum": 0,
          "description": "A video's duration in seconds. Absent for an image, and until the media is `ready`."
        },
        "videoCodec": {
          "type": "string",
          "minLength": 1,
          "description": "A video's codec as ffprobe names it (`h264`, `hevc`, `vp9`, `av1`). Absent for an image, and until the media is `ready`."
        },
        "frameRate": {
          "type": "number",
          "minimum": 0,
          "description": "A video's frame rate in frames per second, rounded to three decimals (`29.97`). Absent for an image, when the video does not report one, and until the media is `ready`."
        },
        "sourceUrl": {
          "type": "string",
          "format": "uri"
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "meta"
          ],
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "validation_error",
                "not_supported",
                "unauthorized",
                "quota_exceeded",
                "permission_denied",
                "scope_insufficient",
                "connection_invalid",
                "not_found",
                "conflict",
                "rate_limit_exceeded",
                "platform_rate_limit",
                "internal",
                "service_unavailable"
              ],
              "description": "Stable error code. `validation_error` (400), `not_supported` (400), `unauthorized` (401), `quota_exceeded` (402), `permission_denied` (403), `scope_insufficient` (403), `connection_invalid` (403), `not_found` (404), `conflict` (409), `rate_limit_exceeded` (429), `platform_rate_limit` (429), `internal` (500, 502, 504), `service_unavailable` (503)."
            },
            "message": {
              "type": "string",
              "description": "Human-readable summary."
            },
            "meta": {
              "type": "object",
              "properties": {
                "violations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "code",
                      "path",
                      "message"
                    ],
                    "properties": {
                      "code": {
                        "type": "string",
                        "description": "Stable violation code, such as `missing_field`, `unknown_field`, `schema_error`, `invalid_value` or `invalid_combination`."
                      },
                      "path": {
                        "type": "string",
                        "description": "JSON pointer into the request: path, query and body fields share one pointer space (`/cursor`, `/publishRequests/0/args/text`), a header is `/headers/<lowercase name>`, and `\"\"` is the request as a whole."
                      },
                      "message": {
                        "type": "string",
                        "description": "Human-readable explanation."
                      }
                    },
                    "additionalProperties": false
                  },
                  "description": "Every problem with the request. Always present on a `validation_error`."
                },
                "budgets": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded`: every budget that refused the request: `organization` (every authenticated request), `profile` (a request that acts on a Profile, one budget per Profile) or `client_address` (requests with no key or a rejected one). Koil may add budgets; treat an unknown one as covering the whole Organization."
                },
                "profileIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded` whose `budgets` include `profile`: the Profiles whose budget is spent. Requests that act on other Profiles are unaffected."
                },
                "required": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `permission_denied`: the API key permissions the operation requires that the key lacks."
                },
                "limit": {
                  "type": "integer",
                  "description": "On a `quota_exceeded`: the cap that was reached."
                },
                "resourceType": {
                  "type": "string",
                  "description": "On a `not_found` or a `conflict` over an existing resource: the kind of resource, such as `profile` or `connection`."
                },
                "resourceId": {
                  "type": "string",
                  "description": "With `resourceType`: the id of the resource not found or already there."
                },
                "reason": {
                  "type": "string",
                  "description": "On a failed publish or backfill request, or a failed Connect Session, that Koil failed itself, not the platform: why, such as `media_incompatible`, `media_transform_not_entitled` or `subject_mismatch` (a reconnect authorized a different platform account than the Connection's)."
                },
                "refusalReason": {
                  "type": "string",
                  "enum": [
                    "messaging_window_closed",
                    "recipient_rate_limited",
                    "recipient_unavailable",
                    "publishing_limit_reached"
                  ],
                  "description": "Why the platform refused, where the code alone does not say what to do. `messaging_window_closed`: The platform takes a message to this person only inside a window that has closed: WhatsApp's 24-hour customer service window, the Messenger and Instagram messaging window, or TikTok's allowance since the person last wrote. It reopens when the person writes again. `recipient_rate_limited`: Too many messages to this one person in a short time; messages to others are unaffected. Retry after `Retry-After`. `recipient_unavailable`: The person cannot receive messages from this Profile: they blocked it or deactivated their account, or, on WhatsApp, the number has no account or an outdated app. Retrying does not help. `publishing_limit_reached`: The account's own publishing cap on the platform is spent: Instagram's 24-hour content publishing limit, YouTube's daily upload limit, or TikTok's limit on posts. Publish again once it resets."
                }
              },
              "additionalProperties": {},
              "description": "Structured detail; the keys depend on `code`."
            }
          },
          "additionalProperties": false
        },
        "previewUrl": {
          "type": "string",
          "format": "uri"
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

## Backfill request

### `backfill_request.completed`

A backfill request finished with nothing more to read inside its window: the platform's history ran out (`stopReason: exhausted`) or the run reached `since` (`reached_since`). Every `content.*` event it emits has been published, though deliveries are not ordered, so some may arrive after this one.

`data` is the resource exactly as `GET /v1/backfill-requests/{backfillRequestId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `backfillRequestId` | `string` | yes |  |
| `profileId` | `string` | yes |  |
| `collection` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"backfill_request"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes | Koil backfill request identifier. |
| `profileId` | `string` | yes | Koil Profile identifier. |
| `collection` | `string` | yes |  |
| `since` | `string (date-time)` | no |  |
| `maxItems` | `integer` | yes |  |
| `status` | `"pending" \| "running" \| "completed" \| "partial" \| "failed"` | yes |  |
| `stopReason` | `"exhausted" \| "reached_since" \| "capped"` | no |  |
| `emitted` | `integer` | yes |  |
| `fetched` | `integer` | yes |  |
| `skipped` | `integer` | yes |  |
| `oldestEmittedAt` | `string (date-time)` | no |  |
| `error` | `object` | no |  |
| `startedAt` | `string (date-time)` | no |  |
| `completedAt` | `string (date-time)` | no |  |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "backfill_request.completed"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "backfillRequestId",
        "profileId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "backfillRequestId": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "profileId",
        "collection",
        "maxItems",
        "status",
        "emitted",
        "fetched",
        "skipped",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "backfill_request",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "description": "Koil backfill request identifier.",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "description": "Koil Profile identifier.",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1
        },
        "since": {
          "type": "string",
          "format": "date-time"
        },
        "maxItems": {
          "type": "integer"
        },
        "status": {
          "enum": [
            "pending",
            "running",
            "completed",
            "partial",
            "failed"
          ]
        },
        "stopReason": {
          "enum": [
            "exhausted",
            "reached_since",
            "capped"
          ]
        },
        "emitted": {
          "type": "integer"
        },
        "fetched": {
          "type": "integer"
        },
        "skipped": {
          "type": "integer"
        },
        "oldestEmittedAt": {
          "type": "string",
          "format": "date-time"
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "meta"
          ],
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "validation_error",
                "not_supported",
                "unauthorized",
                "quota_exceeded",
                "permission_denied",
                "scope_insufficient",
                "connection_invalid",
                "not_found",
                "conflict",
                "rate_limit_exceeded",
                "platform_rate_limit",
                "internal",
                "service_unavailable"
              ],
              "description": "Stable error code. `validation_error` (400), `not_supported` (400), `unauthorized` (401), `quota_exceeded` (402), `permission_denied` (403), `scope_insufficient` (403), `connection_invalid` (403), `not_found` (404), `conflict` (409), `rate_limit_exceeded` (429), `platform_rate_limit` (429), `internal` (500, 502, 504), `service_unavailable` (503)."
            },
            "message": {
              "type": "string",
              "description": "Human-readable summary."
            },
            "meta": {
              "type": "object",
              "properties": {
                "violations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "code",
                      "path",
                      "message"
                    ],
                    "properties": {
                      "code": {
                        "type": "string",
                        "description": "Stable violation code, such as `missing_field`, `unknown_field`, `schema_error`, `invalid_value` or `invalid_combination`."
                      },
                      "path": {
                        "type": "string",
                        "description": "JSON pointer into the request: path, query and body fields share one pointer space (`/cursor`, `/publishRequests/0/args/text`), a header is `/headers/<lowercase name>`, and `\"\"` is the request as a whole."
                      },
                      "message": {
                        "type": "string",
                        "description": "Human-readable explanation."
                      }
                    },
                    "additionalProperties": false
                  },
                  "description": "Every problem with the request. Always present on a `validation_error`."
                },
                "budgets": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded`: every budget that refused the request: `organization` (every authenticated request), `profile` (a request that acts on a Profile, one budget per Profile) or `client_address` (requests with no key or a rejected one). Koil may add budgets; treat an unknown one as covering the whole Organization."
                },
                "profileIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded` whose `budgets` include `profile`: the Profiles whose budget is spent. Requests that act on other Profiles are unaffected."
                },
                "required": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `permission_denied`: the API key permissions the operation requires that the key lacks."
                },
                "limit": {
                  "type": "integer",
                  "description": "On a `quota_exceeded`: the cap that was reached."
                },
                "resourceType": {
                  "type": "string",
                  "description": "On a `not_found` or a `conflict` over an existing resource: the kind of resource, such as `profile` or `connection`."
                },
                "resourceId": {
                  "type": "string",
                  "description": "With `resourceType`: the id of the resource not found or already there."
                },
                "reason": {
                  "type": "string",
                  "description": "On a failed publish or backfill request, or a failed Connect Session, that Koil failed itself, not the platform: why, such as `media_incompatible`, `media_transform_not_entitled` or `subject_mismatch` (a reconnect authorized a different platform account than the Connection's)."
                },
                "refusalReason": {
                  "type": "string",
                  "enum": [
                    "messaging_window_closed",
                    "recipient_rate_limited",
                    "recipient_unavailable",
                    "publishing_limit_reached"
                  ],
                  "description": "Why the platform refused, where the code alone does not say what to do. `messaging_window_closed`: The platform takes a message to this person only inside a window that has closed: WhatsApp's 24-hour customer service window, the Messenger and Instagram messaging window, or TikTok's allowance since the person last wrote. It reopens when the person writes again. `recipient_rate_limited`: Too many messages to this one person in a short time; messages to others are unaffected. Retry after `Retry-After`. `recipient_unavailable`: The person cannot receive messages from this Profile: they blocked it or deactivated their account, or, on WhatsApp, the number has no account or an outdated app. Retrying does not help. `publishing_limit_reached`: The account's own publishing cap on the platform is spent: Instagram's 24-hour content publishing limit, YouTube's daily upload limit, or TikTok's limit on posts. Publish again once it resets."
                }
              },
              "additionalProperties": {},
              "description": "Structured detail; the keys depend on `code`."
            }
          },
          "additionalProperties": false
        },
        "startedAt": {
          "type": "string",
          "format": "date-time"
        },
        "completedAt": {
          "type": "string",
          "format": "date-time"
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `backfill_request.failed`

A backfill request stopped on an error (`error`). The events it emitted before failing stay published; a new request re-sends them with the same ids.

`data` is the resource exactly as `GET /v1/backfill-requests/{backfillRequestId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `backfillRequestId` | `string` | yes |  |
| `profileId` | `string` | yes |  |
| `collection` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"backfill_request"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes | Koil backfill request identifier. |
| `profileId` | `string` | yes | Koil Profile identifier. |
| `collection` | `string` | yes |  |
| `since` | `string (date-time)` | no |  |
| `maxItems` | `integer` | yes |  |
| `status` | `"pending" \| "running" \| "completed" \| "partial" \| "failed"` | yes |  |
| `stopReason` | `"exhausted" \| "reached_since" \| "capped"` | no |  |
| `emitted` | `integer` | yes |  |
| `fetched` | `integer` | yes |  |
| `skipped` | `integer` | yes |  |
| `oldestEmittedAt` | `string (date-time)` | no |  |
| `error` | `object` | no |  |
| `startedAt` | `string (date-time)` | no |  |
| `completedAt` | `string (date-time)` | no |  |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "backfill_request.failed"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "backfillRequestId",
        "profileId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "backfillRequestId": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "profileId",
        "collection",
        "maxItems",
        "status",
        "emitted",
        "fetched",
        "skipped",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "backfill_request",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "description": "Koil backfill request identifier.",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "description": "Koil Profile identifier.",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1
        },
        "since": {
          "type": "string",
          "format": "date-time"
        },
        "maxItems": {
          "type": "integer"
        },
        "status": {
          "enum": [
            "pending",
            "running",
            "completed",
            "partial",
            "failed"
          ]
        },
        "stopReason": {
          "enum": [
            "exhausted",
            "reached_since",
            "capped"
          ]
        },
        "emitted": {
          "type": "integer"
        },
        "fetched": {
          "type": "integer"
        },
        "skipped": {
          "type": "integer"
        },
        "oldestEmittedAt": {
          "type": "string",
          "format": "date-time"
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "meta"
          ],
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "validation_error",
                "not_supported",
                "unauthorized",
                "quota_exceeded",
                "permission_denied",
                "scope_insufficient",
                "connection_invalid",
                "not_found",
                "conflict",
                "rate_limit_exceeded",
                "platform_rate_limit",
                "internal",
                "service_unavailable"
              ],
              "description": "Stable error code. `validation_error` (400), `not_supported` (400), `unauthorized` (401), `quota_exceeded` (402), `permission_denied` (403), `scope_insufficient` (403), `connection_invalid` (403), `not_found` (404), `conflict` (409), `rate_limit_exceeded` (429), `platform_rate_limit` (429), `internal` (500, 502, 504), `service_unavailable` (503)."
            },
            "message": {
              "type": "string",
              "description": "Human-readable summary."
            },
            "meta": {
              "type": "object",
              "properties": {
                "violations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "code",
                      "path",
                      "message"
                    ],
                    "properties": {
                      "code": {
                        "type": "string",
                        "description": "Stable violation code, such as `missing_field`, `unknown_field`, `schema_error`, `invalid_value` or `invalid_combination`."
                      },
                      "path": {
                        "type": "string",
                        "description": "JSON pointer into the request: path, query and body fields share one pointer space (`/cursor`, `/publishRequests/0/args/text`), a header is `/headers/<lowercase name>`, and `\"\"` is the request as a whole."
                      },
                      "message": {
                        "type": "string",
                        "description": "Human-readable explanation."
                      }
                    },
                    "additionalProperties": false
                  },
                  "description": "Every problem with the request. Always present on a `validation_error`."
                },
                "budgets": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded`: every budget that refused the request: `organization` (every authenticated request), `profile` (a request that acts on a Profile, one budget per Profile) or `client_address` (requests with no key or a rejected one). Koil may add budgets; treat an unknown one as covering the whole Organization."
                },
                "profileIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded` whose `budgets` include `profile`: the Profiles whose budget is spent. Requests that act on other Profiles are unaffected."
                },
                "required": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `permission_denied`: the API key permissions the operation requires that the key lacks."
                },
                "limit": {
                  "type": "integer",
                  "description": "On a `quota_exceeded`: the cap that was reached."
                },
                "resourceType": {
                  "type": "string",
                  "description": "On a `not_found` or a `conflict` over an existing resource: the kind of resource, such as `profile` or `connection`."
                },
                "resourceId": {
                  "type": "string",
                  "description": "With `resourceType`: the id of the resource not found or already there."
                },
                "reason": {
                  "type": "string",
                  "description": "On a failed publish or backfill request, or a failed Connect Session, that Koil failed itself, not the platform: why, such as `media_incompatible`, `media_transform_not_entitled` or `subject_mismatch` (a reconnect authorized a different platform account than the Connection's)."
                },
                "refusalReason": {
                  "type": "string",
                  "enum": [
                    "messaging_window_closed",
                    "recipient_rate_limited",
                    "recipient_unavailable",
                    "publishing_limit_reached"
                  ],
                  "description": "Why the platform refused, where the code alone does not say what to do. `messaging_window_closed`: The platform takes a message to this person only inside a window that has closed: WhatsApp's 24-hour customer service window, the Messenger and Instagram messaging window, or TikTok's allowance since the person last wrote. It reopens when the person writes again. `recipient_rate_limited`: Too many messages to this one person in a short time; messages to others are unaffected. Retry after `Retry-After`. `recipient_unavailable`: The person cannot receive messages from this Profile: they blocked it or deactivated their account, or, on WhatsApp, the number has no account or an outdated app. Retrying does not help. `publishing_limit_reached`: The account's own publishing cap on the platform is spent: Instagram's 24-hour content publishing limit, YouTube's daily upload limit, or TikTok's limit on posts. Publish again once it resets."
                }
              },
              "additionalProperties": {},
              "description": "Structured detail; the keys depend on `code`."
            }
          },
          "additionalProperties": false
        },
        "startedAt": {
          "type": "string",
          "format": "date-time"
        },
        "completedAt": {
          "type": "string",
          "format": "date-time"
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `backfill_request.partial`

A backfill request spent `maxItems` with history left unread (`stopReason: capped`). `oldestEmittedAt` is how far back it reached.

`data` is the resource exactly as `GET /v1/backfill-requests/{backfillRequestId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `backfillRequestId` | `string` | yes |  |
| `profileId` | `string` | yes |  |
| `collection` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"backfill_request"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes | Koil backfill request identifier. |
| `profileId` | `string` | yes | Koil Profile identifier. |
| `collection` | `string` | yes |  |
| `since` | `string (date-time)` | no |  |
| `maxItems` | `integer` | yes |  |
| `status` | `"pending" \| "running" \| "completed" \| "partial" \| "failed"` | yes |  |
| `stopReason` | `"exhausted" \| "reached_since" \| "capped"` | no |  |
| `emitted` | `integer` | yes |  |
| `fetched` | `integer` | yes |  |
| `skipped` | `integer` | yes |  |
| `oldestEmittedAt` | `string (date-time)` | no |  |
| `error` | `object` | no |  |
| `startedAt` | `string (date-time)` | no |  |
| `completedAt` | `string (date-time)` | no |  |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "backfill_request.partial"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "backfillRequestId",
        "profileId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "backfillRequestId": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "profileId",
        "collection",
        "maxItems",
        "status",
        "emitted",
        "fetched",
        "skipped",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "backfill_request",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "description": "Koil backfill request identifier.",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "description": "Koil Profile identifier.",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1
        },
        "since": {
          "type": "string",
          "format": "date-time"
        },
        "maxItems": {
          "type": "integer"
        },
        "status": {
          "enum": [
            "pending",
            "running",
            "completed",
            "partial",
            "failed"
          ]
        },
        "stopReason": {
          "enum": [
            "exhausted",
            "reached_since",
            "capped"
          ]
        },
        "emitted": {
          "type": "integer"
        },
        "fetched": {
          "type": "integer"
        },
        "skipped": {
          "type": "integer"
        },
        "oldestEmittedAt": {
          "type": "string",
          "format": "date-time"
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "meta"
          ],
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "validation_error",
                "not_supported",
                "unauthorized",
                "quota_exceeded",
                "permission_denied",
                "scope_insufficient",
                "connection_invalid",
                "not_found",
                "conflict",
                "rate_limit_exceeded",
                "platform_rate_limit",
                "internal",
                "service_unavailable"
              ],
              "description": "Stable error code. `validation_error` (400), `not_supported` (400), `unauthorized` (401), `quota_exceeded` (402), `permission_denied` (403), `scope_insufficient` (403), `connection_invalid` (403), `not_found` (404), `conflict` (409), `rate_limit_exceeded` (429), `platform_rate_limit` (429), `internal` (500, 502, 504), `service_unavailable` (503)."
            },
            "message": {
              "type": "string",
              "description": "Human-readable summary."
            },
            "meta": {
              "type": "object",
              "properties": {
                "violations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "code",
                      "path",
                      "message"
                    ],
                    "properties": {
                      "code": {
                        "type": "string",
                        "description": "Stable violation code, such as `missing_field`, `unknown_field`, `schema_error`, `invalid_value` or `invalid_combination`."
                      },
                      "path": {
                        "type": "string",
                        "description": "JSON pointer into the request: path, query and body fields share one pointer space (`/cursor`, `/publishRequests/0/args/text`), a header is `/headers/<lowercase name>`, and `\"\"` is the request as a whole."
                      },
                      "message": {
                        "type": "string",
                        "description": "Human-readable explanation."
                      }
                    },
                    "additionalProperties": false
                  },
                  "description": "Every problem with the request. Always present on a `validation_error`."
                },
                "budgets": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded`: every budget that refused the request: `organization` (every authenticated request), `profile` (a request that acts on a Profile, one budget per Profile) or `client_address` (requests with no key or a rejected one). Koil may add budgets; treat an unknown one as covering the whole Organization."
                },
                "profileIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded` whose `budgets` include `profile`: the Profiles whose budget is spent. Requests that act on other Profiles are unaffected."
                },
                "required": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `permission_denied`: the API key permissions the operation requires that the key lacks."
                },
                "limit": {
                  "type": "integer",
                  "description": "On a `quota_exceeded`: the cap that was reached."
                },
                "resourceType": {
                  "type": "string",
                  "description": "On a `not_found` or a `conflict` over an existing resource: the kind of resource, such as `profile` or `connection`."
                },
                "resourceId": {
                  "type": "string",
                  "description": "With `resourceType`: the id of the resource not found or already there."
                },
                "reason": {
                  "type": "string",
                  "description": "On a failed publish or backfill request, or a failed Connect Session, that Koil failed itself, not the platform: why, such as `media_incompatible`, `media_transform_not_entitled` or `subject_mismatch` (a reconnect authorized a different platform account than the Connection's)."
                },
                "refusalReason": {
                  "type": "string",
                  "enum": [
                    "messaging_window_closed",
                    "recipient_rate_limited",
                    "recipient_unavailable",
                    "publishing_limit_reached"
                  ],
                  "description": "Why the platform refused, where the code alone does not say what to do. `messaging_window_closed`: The platform takes a message to this person only inside a window that has closed: WhatsApp's 24-hour customer service window, the Messenger and Instagram messaging window, or TikTok's allowance since the person last wrote. It reopens when the person writes again. `recipient_rate_limited`: Too many messages to this one person in a short time; messages to others are unaffected. Retry after `Retry-After`. `recipient_unavailable`: The person cannot receive messages from this Profile: they blocked it or deactivated their account, or, on WhatsApp, the number has no account or an outdated app. Retrying does not help. `publishing_limit_reached`: The account's own publishing cap on the platform is spent: Instagram's 24-hour content publishing limit, YouTube's daily upload limit, or TikTok's limit on posts. Publish again once it resets."
                }
              },
              "additionalProperties": {},
              "description": "Structured detail; the keys depend on `code`."
            }
          },
          "additionalProperties": false
        },
        "startedAt": {
          "type": "string",
          "format": "date-time"
        },
        "completedAt": {
          "type": "string",
          "format": "date-time"
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

## Event destination

### `event_destination.disabled`

Koil disabled an event destination. Koil doesn't disable a destination because its deliveries fail, and a destination disabled through the API doesn't emit this event. The disabled destination will not receive this event; subscribe a separate, healthy destination to `event_destination.disabled` to be notified.

`data` is the resource exactly as `GET /v1/event-destinations/{eventDestinationId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `eventDestinationId` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"event_destination"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes | Event Destination identifier. |
| `type` | `"webhook" \| "aws_sqs" \| "aws_eventbridge" \| "aws_kinesis" \| "aws_s3" \| "azure_servicebus" \| "cloudflare_queues" \| "gcp_pubsub" \| "hookdeck" \| "kafka" \| "rabbitmq"` | yes | The transport, which decides what `config` and `credentials` take. |
| `topics` | `string[]` | yes |  |
| `apiVersion` | `string` | yes | The API version of the events this destination receives: the `Koil-Version` it was created with. It never changes; to move to a newer version, create a new destination. |
| `scope` | `object \| object` | no |  |
| `config` | `Record<string, unknown>` | yes | The transport's settings. |
| `enabled` | `boolean` | no |  |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "event_destination.disabled"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "eventDestinationId"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "eventDestinationId": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "type",
        "topics",
        "apiVersion",
        "config",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "event_destination",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "description": "Event Destination identifier.",
          "minLength": 1
        },
        "type": {
          "enum": [
            "webhook",
            "aws_sqs",
            "aws_eventbridge",
            "aws_kinesis",
            "aws_s3",
            "azure_servicebus",
            "cloudflare_queues",
            "gcp_pubsub",
            "hookdeck",
            "kafka",
            "rabbitmq"
          ],
          "description": "The transport, which decides what `config` and `credentials` take."
        },
        "topics": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "apiVersion": {
          "type": "string",
          "description": "The API version of the events this destination receives: the `Koil-Version` it was created with. It never changes; to move to a newer version, create a new destination.",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "scope": {
          "anyOf": [
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "const": "organization"
                }
              },
              "additionalProperties": false
            },
            {
              "type": "object",
              "required": [
                "type",
                "profileIds"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "const": "profiles"
                },
                "profileIds": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  },
                  "minItems": 1
                }
              },
              "additionalProperties": false
            }
          ]
        },
        "config": {
          "type": "object",
          "patternProperties": {
            "^.*$": {}
          },
          "description": "The transport's settings."
        },
        "enabled": {
          "type": "boolean"
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

## Publish request

### `publish_request.cancelled`

A publish request was cancelled before publishing.

`data` is the resource exactly as `GET /v1/publish-requests/{publishRequestId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `publishRequestId` | `string` | yes |  |
| `profileId` | `string` | yes |  |
| `collection` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"publish_request"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes |  |
| `status` | `"created" \| "scheduled" \| "cancelled" \| "started" \| "succeeded" \| "failed" \| "outcome_unknown"` | yes | `outcome_unknown`: The call that creates the content failed ambiguously (a timeout, a dropped connection, a platform 5xx), so the platform may have published it. Koil does not retry it. Check the platform before submitting again, or the content may be published twice. |
| `collection` | `string` | yes |  |
| `variant` | `string` | no |  |
| `profileId` | `string` | yes |  |
| `scheduledAt` | `string (date-time)` | no | When Koil runs the publish, as an RFC 3339 date-time. On a submission it must be in the future and at most 365 days ahead; omit it to publish now. |
| `externalId` | `string` | no |  |
| `error` | `object` | no |  |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |
| `startedAt` | `string (date-time)` | no |  |
| `succeededAt` | `string (date-time)` | no |  |
| `failedAt` | `string (date-time)` | no |  |
| `cancelledAt` | `string (date-time)` | no |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "publish_request.cancelled"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "publishRequestId",
        "profileId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "publishRequestId": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "status",
        "collection",
        "profileId",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "publish_request",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "created",
            "scheduled",
            "cancelled",
            "started",
            "succeeded",
            "failed",
            "outcome_unknown"
          ],
          "description": "`outcome_unknown`: The call that creates the content failed ambiguously (a timeout, a dropped connection, a platform 5xx), so the platform may have published it. Koil does not retry it. Check the platform before submitting again, or the content may be published twice."
        },
        "collection": {
          "type": "string",
          "minLength": 1
        },
        "variant": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "scheduledAt": {
          "type": "string",
          "format": "date-time",
          "description": "When Koil runs the publish, as an RFC 3339 date-time. On a submission it must be in the future and at most 365 days ahead; omit it to publish now."
        },
        "externalId": {
          "type": "string",
          "minLength": 1
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "meta"
          ],
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "validation_error",
                "not_supported",
                "unauthorized",
                "quota_exceeded",
                "permission_denied",
                "scope_insufficient",
                "connection_invalid",
                "not_found",
                "conflict",
                "rate_limit_exceeded",
                "platform_rate_limit",
                "internal",
                "service_unavailable"
              ],
              "description": "Stable error code. `validation_error` (400), `not_supported` (400), `unauthorized` (401), `quota_exceeded` (402), `permission_denied` (403), `scope_insufficient` (403), `connection_invalid` (403), `not_found` (404), `conflict` (409), `rate_limit_exceeded` (429), `platform_rate_limit` (429), `internal` (500, 502, 504), `service_unavailable` (503)."
            },
            "message": {
              "type": "string",
              "description": "Human-readable summary."
            },
            "meta": {
              "type": "object",
              "properties": {
                "violations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "code",
                      "path",
                      "message"
                    ],
                    "properties": {
                      "code": {
                        "type": "string",
                        "description": "Stable violation code, such as `missing_field`, `unknown_field`, `schema_error`, `invalid_value` or `invalid_combination`."
                      },
                      "path": {
                        "type": "string",
                        "description": "JSON pointer into the request: path, query and body fields share one pointer space (`/cursor`, `/publishRequests/0/args/text`), a header is `/headers/<lowercase name>`, and `\"\"` is the request as a whole."
                      },
                      "message": {
                        "type": "string",
                        "description": "Human-readable explanation."
                      }
                    },
                    "additionalProperties": false
                  },
                  "description": "Every problem with the request. Always present on a `validation_error`."
                },
                "budgets": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded`: every budget that refused the request: `organization` (every authenticated request), `profile` (a request that acts on a Profile, one budget per Profile) or `client_address` (requests with no key or a rejected one). Koil may add budgets; treat an unknown one as covering the whole Organization."
                },
                "profileIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded` whose `budgets` include `profile`: the Profiles whose budget is spent. Requests that act on other Profiles are unaffected."
                },
                "required": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `permission_denied`: the API key permissions the operation requires that the key lacks."
                },
                "limit": {
                  "type": "integer",
                  "description": "On a `quota_exceeded`: the cap that was reached."
                },
                "resourceType": {
                  "type": "string",
                  "description": "On a `not_found` or a `conflict` over an existing resource: the kind of resource, such as `profile` or `connection`."
                },
                "resourceId": {
                  "type": "string",
                  "description": "With `resourceType`: the id of the resource not found or already there."
                },
                "reason": {
                  "type": "string",
                  "description": "On a failed publish or backfill request, or a failed Connect Session, that Koil failed itself, not the platform: why, such as `media_incompatible`, `media_transform_not_entitled` or `subject_mismatch` (a reconnect authorized a different platform account than the Connection's)."
                },
                "refusalReason": {
                  "type": "string",
                  "enum": [
                    "messaging_window_closed",
                    "recipient_rate_limited",
                    "recipient_unavailable",
                    "publishing_limit_reached"
                  ],
                  "description": "Why the platform refused, where the code alone does not say what to do. `messaging_window_closed`: The platform takes a message to this person only inside a window that has closed: WhatsApp's 24-hour customer service window, the Messenger and Instagram messaging window, or TikTok's allowance since the person last wrote. It reopens when the person writes again. `recipient_rate_limited`: Too many messages to this one person in a short time; messages to others are unaffected. Retry after `Retry-After`. `recipient_unavailable`: The person cannot receive messages from this Profile: they blocked it or deactivated their account, or, on WhatsApp, the number has no account or an outdated app. Retrying does not help. `publishing_limit_reached`: The account's own publishing cap on the platform is spent: Instagram's 24-hour content publishing limit, YouTube's daily upload limit, or TikTok's limit on posts. Publish again once it resets."
                }
              },
              "additionalProperties": {},
              "description": "Structured detail; the keys depend on `code`."
            }
          },
          "additionalProperties": false
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "startedAt": {
          "type": "string",
          "format": "date-time"
        },
        "succeededAt": {
          "type": "string",
          "format": "date-time"
        },
        "failedAt": {
          "type": "string",
          "format": "date-time"
        },
        "cancelledAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `publish_request.created`

A publish request entered the ledger.

`data` is the resource exactly as `GET /v1/publish-requests/{publishRequestId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `publishRequestId` | `string` | yes |  |
| `profileId` | `string` | yes |  |
| `collection` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"publish_request"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes |  |
| `status` | `"created" \| "scheduled" \| "cancelled" \| "started" \| "succeeded" \| "failed" \| "outcome_unknown"` | yes | `outcome_unknown`: The call that creates the content failed ambiguously (a timeout, a dropped connection, a platform 5xx), so the platform may have published it. Koil does not retry it. Check the platform before submitting again, or the content may be published twice. |
| `collection` | `string` | yes |  |
| `variant` | `string` | no |  |
| `profileId` | `string` | yes |  |
| `scheduledAt` | `string (date-time)` | no | When Koil runs the publish, as an RFC 3339 date-time. On a submission it must be in the future and at most 365 days ahead; omit it to publish now. |
| `externalId` | `string` | no |  |
| `error` | `object` | no |  |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |
| `startedAt` | `string (date-time)` | no |  |
| `succeededAt` | `string (date-time)` | no |  |
| `failedAt` | `string (date-time)` | no |  |
| `cancelledAt` | `string (date-time)` | no |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "publish_request.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "publishRequestId",
        "profileId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "publishRequestId": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "status",
        "collection",
        "profileId",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "publish_request",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "created",
            "scheduled",
            "cancelled",
            "started",
            "succeeded",
            "failed",
            "outcome_unknown"
          ],
          "description": "`outcome_unknown`: The call that creates the content failed ambiguously (a timeout, a dropped connection, a platform 5xx), so the platform may have published it. Koil does not retry it. Check the platform before submitting again, or the content may be published twice."
        },
        "collection": {
          "type": "string",
          "minLength": 1
        },
        "variant": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "scheduledAt": {
          "type": "string",
          "format": "date-time",
          "description": "When Koil runs the publish, as an RFC 3339 date-time. On a submission it must be in the future and at most 365 days ahead; omit it to publish now."
        },
        "externalId": {
          "type": "string",
          "minLength": 1
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "meta"
          ],
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "validation_error",
                "not_supported",
                "unauthorized",
                "quota_exceeded",
                "permission_denied",
                "scope_insufficient",
                "connection_invalid",
                "not_found",
                "conflict",
                "rate_limit_exceeded",
                "platform_rate_limit",
                "internal",
                "service_unavailable"
              ],
              "description": "Stable error code. `validation_error` (400), `not_supported` (400), `unauthorized` (401), `quota_exceeded` (402), `permission_denied` (403), `scope_insufficient` (403), `connection_invalid` (403), `not_found` (404), `conflict` (409), `rate_limit_exceeded` (429), `platform_rate_limit` (429), `internal` (500, 502, 504), `service_unavailable` (503)."
            },
            "message": {
              "type": "string",
              "description": "Human-readable summary."
            },
            "meta": {
              "type": "object",
              "properties": {
                "violations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "code",
                      "path",
                      "message"
                    ],
                    "properties": {
                      "code": {
                        "type": "string",
                        "description": "Stable violation code, such as `missing_field`, `unknown_field`, `schema_error`, `invalid_value` or `invalid_combination`."
                      },
                      "path": {
                        "type": "string",
                        "description": "JSON pointer into the request: path, query and body fields share one pointer space (`/cursor`, `/publishRequests/0/args/text`), a header is `/headers/<lowercase name>`, and `\"\"` is the request as a whole."
                      },
                      "message": {
                        "type": "string",
                        "description": "Human-readable explanation."
                      }
                    },
                    "additionalProperties": false
                  },
                  "description": "Every problem with the request. Always present on a `validation_error`."
                },
                "budgets": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded`: every budget that refused the request: `organization` (every authenticated request), `profile` (a request that acts on a Profile, one budget per Profile) or `client_address` (requests with no key or a rejected one). Koil may add budgets; treat an unknown one as covering the whole Organization."
                },
                "profileIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded` whose `budgets` include `profile`: the Profiles whose budget is spent. Requests that act on other Profiles are unaffected."
                },
                "required": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `permission_denied`: the API key permissions the operation requires that the key lacks."
                },
                "limit": {
                  "type": "integer",
                  "description": "On a `quota_exceeded`: the cap that was reached."
                },
                "resourceType": {
                  "type": "string",
                  "description": "On a `not_found` or a `conflict` over an existing resource: the kind of resource, such as `profile` or `connection`."
                },
                "resourceId": {
                  "type": "string",
                  "description": "With `resourceType`: the id of the resource not found or already there."
                },
                "reason": {
                  "type": "string",
                  "description": "On a failed publish or backfill request, or a failed Connect Session, that Koil failed itself, not the platform: why, such as `media_incompatible`, `media_transform_not_entitled` or `subject_mismatch` (a reconnect authorized a different platform account than the Connection's)."
                },
                "refusalReason": {
                  "type": "string",
                  "enum": [
                    "messaging_window_closed",
                    "recipient_rate_limited",
                    "recipient_unavailable",
                    "publishing_limit_reached"
                  ],
                  "description": "Why the platform refused, where the code alone does not say what to do. `messaging_window_closed`: The platform takes a message to this person only inside a window that has closed: WhatsApp's 24-hour customer service window, the Messenger and Instagram messaging window, or TikTok's allowance since the person last wrote. It reopens when the person writes again. `recipient_rate_limited`: Too many messages to this one person in a short time; messages to others are unaffected. Retry after `Retry-After`. `recipient_unavailable`: The person cannot receive messages from this Profile: they blocked it or deactivated their account, or, on WhatsApp, the number has no account or an outdated app. Retrying does not help. `publishing_limit_reached`: The account's own publishing cap on the platform is spent: Instagram's 24-hour content publishing limit, YouTube's daily upload limit, or TikTok's limit on posts. Publish again once it resets."
                }
              },
              "additionalProperties": {},
              "description": "Structured detail; the keys depend on `code`."
            }
          },
          "additionalProperties": false
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "startedAt": {
          "type": "string",
          "format": "date-time"
        },
        "succeededAt": {
          "type": "string",
          "format": "date-time"
        },
        "failedAt": {
          "type": "string",
          "format": "date-time"
        },
        "cancelledAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `publish_request.failed`

A publish request failed and will not be retried.

`data` is the resource exactly as `GET /v1/publish-requests/{publishRequestId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `publishRequestId` | `string` | yes |  |
| `profileId` | `string` | yes |  |
| `collection` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"publish_request"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes |  |
| `status` | `"created" \| "scheduled" \| "cancelled" \| "started" \| "succeeded" \| "failed" \| "outcome_unknown"` | yes | `outcome_unknown`: The call that creates the content failed ambiguously (a timeout, a dropped connection, a platform 5xx), so the platform may have published it. Koil does not retry it. Check the platform before submitting again, or the content may be published twice. |
| `collection` | `string` | yes |  |
| `variant` | `string` | no |  |
| `profileId` | `string` | yes |  |
| `scheduledAt` | `string (date-time)` | no | When Koil runs the publish, as an RFC 3339 date-time. On a submission it must be in the future and at most 365 days ahead; omit it to publish now. |
| `externalId` | `string` | no |  |
| `error` | `object` | no |  |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |
| `startedAt` | `string (date-time)` | no |  |
| `succeededAt` | `string (date-time)` | no |  |
| `failedAt` | `string (date-time)` | no |  |
| `cancelledAt` | `string (date-time)` | no |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "publish_request.failed"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "publishRequestId",
        "profileId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "publishRequestId": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "status",
        "collection",
        "profileId",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "publish_request",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "created",
            "scheduled",
            "cancelled",
            "started",
            "succeeded",
            "failed",
            "outcome_unknown"
          ],
          "description": "`outcome_unknown`: The call that creates the content failed ambiguously (a timeout, a dropped connection, a platform 5xx), so the platform may have published it. Koil does not retry it. Check the platform before submitting again, or the content may be published twice."
        },
        "collection": {
          "type": "string",
          "minLength": 1
        },
        "variant": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "scheduledAt": {
          "type": "string",
          "format": "date-time",
          "description": "When Koil runs the publish, as an RFC 3339 date-time. On a submission it must be in the future and at most 365 days ahead; omit it to publish now."
        },
        "externalId": {
          "type": "string",
          "minLength": 1
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "meta"
          ],
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "validation_error",
                "not_supported",
                "unauthorized",
                "quota_exceeded",
                "permission_denied",
                "scope_insufficient",
                "connection_invalid",
                "not_found",
                "conflict",
                "rate_limit_exceeded",
                "platform_rate_limit",
                "internal",
                "service_unavailable"
              ],
              "description": "Stable error code. `validation_error` (400), `not_supported` (400), `unauthorized` (401), `quota_exceeded` (402), `permission_denied` (403), `scope_insufficient` (403), `connection_invalid` (403), `not_found` (404), `conflict` (409), `rate_limit_exceeded` (429), `platform_rate_limit` (429), `internal` (500, 502, 504), `service_unavailable` (503)."
            },
            "message": {
              "type": "string",
              "description": "Human-readable summary."
            },
            "meta": {
              "type": "object",
              "properties": {
                "violations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "code",
                      "path",
                      "message"
                    ],
                    "properties": {
                      "code": {
                        "type": "string",
                        "description": "Stable violation code, such as `missing_field`, `unknown_field`, `schema_error`, `invalid_value` or `invalid_combination`."
                      },
                      "path": {
                        "type": "string",
                        "description": "JSON pointer into the request: path, query and body fields share one pointer space (`/cursor`, `/publishRequests/0/args/text`), a header is `/headers/<lowercase name>`, and `\"\"` is the request as a whole."
                      },
                      "message": {
                        "type": "string",
                        "description": "Human-readable explanation."
                      }
                    },
                    "additionalProperties": false
                  },
                  "description": "Every problem with the request. Always present on a `validation_error`."
                },
                "budgets": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded`: every budget that refused the request: `organization` (every authenticated request), `profile` (a request that acts on a Profile, one budget per Profile) or `client_address` (requests with no key or a rejected one). Koil may add budgets; treat an unknown one as covering the whole Organization."
                },
                "profileIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded` whose `budgets` include `profile`: the Profiles whose budget is spent. Requests that act on other Profiles are unaffected."
                },
                "required": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `permission_denied`: the API key permissions the operation requires that the key lacks."
                },
                "limit": {
                  "type": "integer",
                  "description": "On a `quota_exceeded`: the cap that was reached."
                },
                "resourceType": {
                  "type": "string",
                  "description": "On a `not_found` or a `conflict` over an existing resource: the kind of resource, such as `profile` or `connection`."
                },
                "resourceId": {
                  "type": "string",
                  "description": "With `resourceType`: the id of the resource not found or already there."
                },
                "reason": {
                  "type": "string",
                  "description": "On a failed publish or backfill request, or a failed Connect Session, that Koil failed itself, not the platform: why, such as `media_incompatible`, `media_transform_not_entitled` or `subject_mismatch` (a reconnect authorized a different platform account than the Connection's)."
                },
                "refusalReason": {
                  "type": "string",
                  "enum": [
                    "messaging_window_closed",
                    "recipient_rate_limited",
                    "recipient_unavailable",
                    "publishing_limit_reached"
                  ],
                  "description": "Why the platform refused, where the code alone does not say what to do. `messaging_window_closed`: The platform takes a message to this person only inside a window that has closed: WhatsApp's 24-hour customer service window, the Messenger and Instagram messaging window, or TikTok's allowance since the person last wrote. It reopens when the person writes again. `recipient_rate_limited`: Too many messages to this one person in a short time; messages to others are unaffected. Retry after `Retry-After`. `recipient_unavailable`: The person cannot receive messages from this Profile: they blocked it or deactivated their account, or, on WhatsApp, the number has no account or an outdated app. Retrying does not help. `publishing_limit_reached`: The account's own publishing cap on the platform is spent: Instagram's 24-hour content publishing limit, YouTube's daily upload limit, or TikTok's limit on posts. Publish again once it resets."
                }
              },
              "additionalProperties": {},
              "description": "Structured detail; the keys depend on `code`."
            }
          },
          "additionalProperties": false
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "startedAt": {
          "type": "string",
          "format": "date-time"
        },
        "succeededAt": {
          "type": "string",
          "format": "date-time"
        },
        "failedAt": {
          "type": "string",
          "format": "date-time"
        },
        "cancelledAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `publish_request.outcome_unknown`

The call that creates the content failed ambiguously, so the platform may have published it; Koil will not retry it. Check the platform before submitting again.

`data` is the resource exactly as `GET /v1/publish-requests/{publishRequestId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `publishRequestId` | `string` | yes |  |
| `profileId` | `string` | yes |  |
| `collection` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"publish_request"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes |  |
| `status` | `"created" \| "scheduled" \| "cancelled" \| "started" \| "succeeded" \| "failed" \| "outcome_unknown"` | yes | `outcome_unknown`: The call that creates the content failed ambiguously (a timeout, a dropped connection, a platform 5xx), so the platform may have published it. Koil does not retry it. Check the platform before submitting again, or the content may be published twice. |
| `collection` | `string` | yes |  |
| `variant` | `string` | no |  |
| `profileId` | `string` | yes |  |
| `scheduledAt` | `string (date-time)` | no | When Koil runs the publish, as an RFC 3339 date-time. On a submission it must be in the future and at most 365 days ahead; omit it to publish now. |
| `externalId` | `string` | no |  |
| `error` | `object` | no |  |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |
| `startedAt` | `string (date-time)` | no |  |
| `succeededAt` | `string (date-time)` | no |  |
| `failedAt` | `string (date-time)` | no |  |
| `cancelledAt` | `string (date-time)` | no |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "publish_request.outcome_unknown"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "publishRequestId",
        "profileId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "publishRequestId": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "status",
        "collection",
        "profileId",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "publish_request",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "created",
            "scheduled",
            "cancelled",
            "started",
            "succeeded",
            "failed",
            "outcome_unknown"
          ],
          "description": "`outcome_unknown`: The call that creates the content failed ambiguously (a timeout, a dropped connection, a platform 5xx), so the platform may have published it. Koil does not retry it. Check the platform before submitting again, or the content may be published twice."
        },
        "collection": {
          "type": "string",
          "minLength": 1
        },
        "variant": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "scheduledAt": {
          "type": "string",
          "format": "date-time",
          "description": "When Koil runs the publish, as an RFC 3339 date-time. On a submission it must be in the future and at most 365 days ahead; omit it to publish now."
        },
        "externalId": {
          "type": "string",
          "minLength": 1
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "meta"
          ],
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "validation_error",
                "not_supported",
                "unauthorized",
                "quota_exceeded",
                "permission_denied",
                "scope_insufficient",
                "connection_invalid",
                "not_found",
                "conflict",
                "rate_limit_exceeded",
                "platform_rate_limit",
                "internal",
                "service_unavailable"
              ],
              "description": "Stable error code. `validation_error` (400), `not_supported` (400), `unauthorized` (401), `quota_exceeded` (402), `permission_denied` (403), `scope_insufficient` (403), `connection_invalid` (403), `not_found` (404), `conflict` (409), `rate_limit_exceeded` (429), `platform_rate_limit` (429), `internal` (500, 502, 504), `service_unavailable` (503)."
            },
            "message": {
              "type": "string",
              "description": "Human-readable summary."
            },
            "meta": {
              "type": "object",
              "properties": {
                "violations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "code",
                      "path",
                      "message"
                    ],
                    "properties": {
                      "code": {
                        "type": "string",
                        "description": "Stable violation code, such as `missing_field`, `unknown_field`, `schema_error`, `invalid_value` or `invalid_combination`."
                      },
                      "path": {
                        "type": "string",
                        "description": "JSON pointer into the request: path, query and body fields share one pointer space (`/cursor`, `/publishRequests/0/args/text`), a header is `/headers/<lowercase name>`, and `\"\"` is the request as a whole."
                      },
                      "message": {
                        "type": "string",
                        "description": "Human-readable explanation."
                      }
                    },
                    "additionalProperties": false
                  },
                  "description": "Every problem with the request. Always present on a `validation_error`."
                },
                "budgets": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded`: every budget that refused the request: `organization` (every authenticated request), `profile` (a request that acts on a Profile, one budget per Profile) or `client_address` (requests with no key or a rejected one). Koil may add budgets; treat an unknown one as covering the whole Organization."
                },
                "profileIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded` whose `budgets` include `profile`: the Profiles whose budget is spent. Requests that act on other Profiles are unaffected."
                },
                "required": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `permission_denied`: the API key permissions the operation requires that the key lacks."
                },
                "limit": {
                  "type": "integer",
                  "description": "On a `quota_exceeded`: the cap that was reached."
                },
                "resourceType": {
                  "type": "string",
                  "description": "On a `not_found` or a `conflict` over an existing resource: the kind of resource, such as `profile` or `connection`."
                },
                "resourceId": {
                  "type": "string",
                  "description": "With `resourceType`: the id of the resource not found or already there."
                },
                "reason": {
                  "type": "string",
                  "description": "On a failed publish or backfill request, or a failed Connect Session, that Koil failed itself, not the platform: why, such as `media_incompatible`, `media_transform_not_entitled` or `subject_mismatch` (a reconnect authorized a different platform account than the Connection's)."
                },
                "refusalReason": {
                  "type": "string",
                  "enum": [
                    "messaging_window_closed",
                    "recipient_rate_limited",
                    "recipient_unavailable",
                    "publishing_limit_reached"
                  ],
                  "description": "Why the platform refused, where the code alone does not say what to do. `messaging_window_closed`: The platform takes a message to this person only inside a window that has closed: WhatsApp's 24-hour customer service window, the Messenger and Instagram messaging window, or TikTok's allowance since the person last wrote. It reopens when the person writes again. `recipient_rate_limited`: Too many messages to this one person in a short time; messages to others are unaffected. Retry after `Retry-After`. `recipient_unavailable`: The person cannot receive messages from this Profile: they blocked it or deactivated their account, or, on WhatsApp, the number has no account or an outdated app. Retrying does not help. `publishing_limit_reached`: The account's own publishing cap on the platform is spent: Instagram's 24-hour content publishing limit, YouTube's daily upload limit, or TikTok's limit on posts. Publish again once it resets."
                }
              },
              "additionalProperties": {},
              "description": "Structured detail; the keys depend on `code`."
            }
          },
          "additionalProperties": false
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "startedAt": {
          "type": "string",
          "format": "date-time"
        },
        "succeededAt": {
          "type": "string",
          "format": "date-time"
        },
        "failedAt": {
          "type": "string",
          "format": "date-time"
        },
        "cancelledAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `publish_request.scheduled`

A publish request was scheduled for a future time.

`data` is the resource exactly as `GET /v1/publish-requests/{publishRequestId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `publishRequestId` | `string` | yes |  |
| `profileId` | `string` | yes |  |
| `collection` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"publish_request"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes |  |
| `status` | `"created" \| "scheduled" \| "cancelled" \| "started" \| "succeeded" \| "failed" \| "outcome_unknown"` | yes | `outcome_unknown`: The call that creates the content failed ambiguously (a timeout, a dropped connection, a platform 5xx), so the platform may have published it. Koil does not retry it. Check the platform before submitting again, or the content may be published twice. |
| `collection` | `string` | yes |  |
| `variant` | `string` | no |  |
| `profileId` | `string` | yes |  |
| `scheduledAt` | `string (date-time)` | no | When Koil runs the publish, as an RFC 3339 date-time. On a submission it must be in the future and at most 365 days ahead; omit it to publish now. |
| `externalId` | `string` | no |  |
| `error` | `object` | no |  |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |
| `startedAt` | `string (date-time)` | no |  |
| `succeededAt` | `string (date-time)` | no |  |
| `failedAt` | `string (date-time)` | no |  |
| `cancelledAt` | `string (date-time)` | no |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "publish_request.scheduled"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "publishRequestId",
        "profileId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "publishRequestId": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "status",
        "collection",
        "profileId",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "publish_request",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "created",
            "scheduled",
            "cancelled",
            "started",
            "succeeded",
            "failed",
            "outcome_unknown"
          ],
          "description": "`outcome_unknown`: The call that creates the content failed ambiguously (a timeout, a dropped connection, a platform 5xx), so the platform may have published it. Koil does not retry it. Check the platform before submitting again, or the content may be published twice."
        },
        "collection": {
          "type": "string",
          "minLength": 1
        },
        "variant": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "scheduledAt": {
          "type": "string",
          "format": "date-time",
          "description": "When Koil runs the publish, as an RFC 3339 date-time. On a submission it must be in the future and at most 365 days ahead; omit it to publish now."
        },
        "externalId": {
          "type": "string",
          "minLength": 1
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "meta"
          ],
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "validation_error",
                "not_supported",
                "unauthorized",
                "quota_exceeded",
                "permission_denied",
                "scope_insufficient",
                "connection_invalid",
                "not_found",
                "conflict",
                "rate_limit_exceeded",
                "platform_rate_limit",
                "internal",
                "service_unavailable"
              ],
              "description": "Stable error code. `validation_error` (400), `not_supported` (400), `unauthorized` (401), `quota_exceeded` (402), `permission_denied` (403), `scope_insufficient` (403), `connection_invalid` (403), `not_found` (404), `conflict` (409), `rate_limit_exceeded` (429), `platform_rate_limit` (429), `internal` (500, 502, 504), `service_unavailable` (503)."
            },
            "message": {
              "type": "string",
              "description": "Human-readable summary."
            },
            "meta": {
              "type": "object",
              "properties": {
                "violations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "code",
                      "path",
                      "message"
                    ],
                    "properties": {
                      "code": {
                        "type": "string",
                        "description": "Stable violation code, such as `missing_field`, `unknown_field`, `schema_error`, `invalid_value` or `invalid_combination`."
                      },
                      "path": {
                        "type": "string",
                        "description": "JSON pointer into the request: path, query and body fields share one pointer space (`/cursor`, `/publishRequests/0/args/text`), a header is `/headers/<lowercase name>`, and `\"\"` is the request as a whole."
                      },
                      "message": {
                        "type": "string",
                        "description": "Human-readable explanation."
                      }
                    },
                    "additionalProperties": false
                  },
                  "description": "Every problem with the request. Always present on a `validation_error`."
                },
                "budgets": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded`: every budget that refused the request: `organization` (every authenticated request), `profile` (a request that acts on a Profile, one budget per Profile) or `client_address` (requests with no key or a rejected one). Koil may add budgets; treat an unknown one as covering the whole Organization."
                },
                "profileIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded` whose `budgets` include `profile`: the Profiles whose budget is spent. Requests that act on other Profiles are unaffected."
                },
                "required": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `permission_denied`: the API key permissions the operation requires that the key lacks."
                },
                "limit": {
                  "type": "integer",
                  "description": "On a `quota_exceeded`: the cap that was reached."
                },
                "resourceType": {
                  "type": "string",
                  "description": "On a `not_found` or a `conflict` over an existing resource: the kind of resource, such as `profile` or `connection`."
                },
                "resourceId": {
                  "type": "string",
                  "description": "With `resourceType`: the id of the resource not found or already there."
                },
                "reason": {
                  "type": "string",
                  "description": "On a failed publish or backfill request, or a failed Connect Session, that Koil failed itself, not the platform: why, such as `media_incompatible`, `media_transform_not_entitled` or `subject_mismatch` (a reconnect authorized a different platform account than the Connection's)."
                },
                "refusalReason": {
                  "type": "string",
                  "enum": [
                    "messaging_window_closed",
                    "recipient_rate_limited",
                    "recipient_unavailable",
                    "publishing_limit_reached"
                  ],
                  "description": "Why the platform refused, where the code alone does not say what to do. `messaging_window_closed`: The platform takes a message to this person only inside a window that has closed: WhatsApp's 24-hour customer service window, the Messenger and Instagram messaging window, or TikTok's allowance since the person last wrote. It reopens when the person writes again. `recipient_rate_limited`: Too many messages to this one person in a short time; messages to others are unaffected. Retry after `Retry-After`. `recipient_unavailable`: The person cannot receive messages from this Profile: they blocked it or deactivated their account, or, on WhatsApp, the number has no account or an outdated app. Retrying does not help. `publishing_limit_reached`: The account's own publishing cap on the platform is spent: Instagram's 24-hour content publishing limit, YouTube's daily upload limit, or TikTok's limit on posts. Publish again once it resets."
                }
              },
              "additionalProperties": {},
              "description": "Structured detail; the keys depend on `code`."
            }
          },
          "additionalProperties": false
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "startedAt": {
          "type": "string",
          "format": "date-time"
        },
        "succeededAt": {
          "type": "string",
          "format": "date-time"
        },
        "failedAt": {
          "type": "string",
          "format": "date-time"
        },
        "cancelledAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `publish_request.started`

A publish request began publishing to the platform.

`data` is the resource exactly as `GET /v1/publish-requests/{publishRequestId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `publishRequestId` | `string` | yes |  |
| `profileId` | `string` | yes |  |
| `collection` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"publish_request"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes |  |
| `status` | `"created" \| "scheduled" \| "cancelled" \| "started" \| "succeeded" \| "failed" \| "outcome_unknown"` | yes | `outcome_unknown`: The call that creates the content failed ambiguously (a timeout, a dropped connection, a platform 5xx), so the platform may have published it. Koil does not retry it. Check the platform before submitting again, or the content may be published twice. |
| `collection` | `string` | yes |  |
| `variant` | `string` | no |  |
| `profileId` | `string` | yes |  |
| `scheduledAt` | `string (date-time)` | no | When Koil runs the publish, as an RFC 3339 date-time. On a submission it must be in the future and at most 365 days ahead; omit it to publish now. |
| `externalId` | `string` | no |  |
| `error` | `object` | no |  |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |
| `startedAt` | `string (date-time)` | no |  |
| `succeededAt` | `string (date-time)` | no |  |
| `failedAt` | `string (date-time)` | no |  |
| `cancelledAt` | `string (date-time)` | no |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "publish_request.started"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "publishRequestId",
        "profileId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "publishRequestId": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "status",
        "collection",
        "profileId",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "publish_request",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "created",
            "scheduled",
            "cancelled",
            "started",
            "succeeded",
            "failed",
            "outcome_unknown"
          ],
          "description": "`outcome_unknown`: The call that creates the content failed ambiguously (a timeout, a dropped connection, a platform 5xx), so the platform may have published it. Koil does not retry it. Check the platform before submitting again, or the content may be published twice."
        },
        "collection": {
          "type": "string",
          "minLength": 1
        },
        "variant": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "scheduledAt": {
          "type": "string",
          "format": "date-time",
          "description": "When Koil runs the publish, as an RFC 3339 date-time. On a submission it must be in the future and at most 365 days ahead; omit it to publish now."
        },
        "externalId": {
          "type": "string",
          "minLength": 1
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "meta"
          ],
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "validation_error",
                "not_supported",
                "unauthorized",
                "quota_exceeded",
                "permission_denied",
                "scope_insufficient",
                "connection_invalid",
                "not_found",
                "conflict",
                "rate_limit_exceeded",
                "platform_rate_limit",
                "internal",
                "service_unavailable"
              ],
              "description": "Stable error code. `validation_error` (400), `not_supported` (400), `unauthorized` (401), `quota_exceeded` (402), `permission_denied` (403), `scope_insufficient` (403), `connection_invalid` (403), `not_found` (404), `conflict` (409), `rate_limit_exceeded` (429), `platform_rate_limit` (429), `internal` (500, 502, 504), `service_unavailable` (503)."
            },
            "message": {
              "type": "string",
              "description": "Human-readable summary."
            },
            "meta": {
              "type": "object",
              "properties": {
                "violations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "code",
                      "path",
                      "message"
                    ],
                    "properties": {
                      "code": {
                        "type": "string",
                        "description": "Stable violation code, such as `missing_field`, `unknown_field`, `schema_error`, `invalid_value` or `invalid_combination`."
                      },
                      "path": {
                        "type": "string",
                        "description": "JSON pointer into the request: path, query and body fields share one pointer space (`/cursor`, `/publishRequests/0/args/text`), a header is `/headers/<lowercase name>`, and `\"\"` is the request as a whole."
                      },
                      "message": {
                        "type": "string",
                        "description": "Human-readable explanation."
                      }
                    },
                    "additionalProperties": false
                  },
                  "description": "Every problem with the request. Always present on a `validation_error`."
                },
                "budgets": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded`: every budget that refused the request: `organization` (every authenticated request), `profile` (a request that acts on a Profile, one budget per Profile) or `client_address` (requests with no key or a rejected one). Koil may add budgets; treat an unknown one as covering the whole Organization."
                },
                "profileIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded` whose `budgets` include `profile`: the Profiles whose budget is spent. Requests that act on other Profiles are unaffected."
                },
                "required": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `permission_denied`: the API key permissions the operation requires that the key lacks."
                },
                "limit": {
                  "type": "integer",
                  "description": "On a `quota_exceeded`: the cap that was reached."
                },
                "resourceType": {
                  "type": "string",
                  "description": "On a `not_found` or a `conflict` over an existing resource: the kind of resource, such as `profile` or `connection`."
                },
                "resourceId": {
                  "type": "string",
                  "description": "With `resourceType`: the id of the resource not found or already there."
                },
                "reason": {
                  "type": "string",
                  "description": "On a failed publish or backfill request, or a failed Connect Session, that Koil failed itself, not the platform: why, such as `media_incompatible`, `media_transform_not_entitled` or `subject_mismatch` (a reconnect authorized a different platform account than the Connection's)."
                },
                "refusalReason": {
                  "type": "string",
                  "enum": [
                    "messaging_window_closed",
                    "recipient_rate_limited",
                    "recipient_unavailable",
                    "publishing_limit_reached"
                  ],
                  "description": "Why the platform refused, where the code alone does not say what to do. `messaging_window_closed`: The platform takes a message to this person only inside a window that has closed: WhatsApp's 24-hour customer service window, the Messenger and Instagram messaging window, or TikTok's allowance since the person last wrote. It reopens when the person writes again. `recipient_rate_limited`: Too many messages to this one person in a short time; messages to others are unaffected. Retry after `Retry-After`. `recipient_unavailable`: The person cannot receive messages from this Profile: they blocked it or deactivated their account, or, on WhatsApp, the number has no account or an outdated app. Retrying does not help. `publishing_limit_reached`: The account's own publishing cap on the platform is spent: Instagram's 24-hour content publishing limit, YouTube's daily upload limit, or TikTok's limit on posts. Publish again once it resets."
                }
              },
              "additionalProperties": {},
              "description": "Structured detail; the keys depend on `code`."
            }
          },
          "additionalProperties": false
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "startedAt": {
          "type": "string",
          "format": "date-time"
        },
        "succeededAt": {
          "type": "string",
          "format": "date-time"
        },
        "failedAt": {
          "type": "string",
          "format": "date-time"
        },
        "cancelledAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `publish_request.succeeded`

A publish request was published successfully.

`data` is the resource exactly as `GET /v1/publish-requests/{publishRequestId}` returns it — the same schema.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `publishRequestId` | `string` | yes |  |
| `profileId` | `string` | yes |  |
| `collection` | `string` | yes |  |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `"publish_request"` | yes | The kind of resource this is. |
| `mode` | `"live" \| "sandbox"` | yes | Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's. |
| `id` | `string` | yes |  |
| `status` | `"created" \| "scheduled" \| "cancelled" \| "started" \| "succeeded" \| "failed" \| "outcome_unknown"` | yes | `outcome_unknown`: The call that creates the content failed ambiguously (a timeout, a dropped connection, a platform 5xx), so the platform may have published it. Koil does not retry it. Check the platform before submitting again, or the content may be published twice. |
| `collection` | `string` | yes |  |
| `variant` | `string` | no |  |
| `profileId` | `string` | yes |  |
| `scheduledAt` | `string (date-time)` | no | When Koil runs the publish, as an RFC 3339 date-time. On a submission it must be in the future and at most 365 days ahead; omit it to publish now. |
| `externalId` | `string` | no |  |
| `error` | `object` | no |  |
| `metadata` | `Record<string, string>` | yes | Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `""` is removed. |
| `createdAt` | `string (date-time)` | yes |  |
| `updatedAt` | `string (date-time)` | yes |  |
| `startedAt` | `string (date-time)` | no |  |
| `succeededAt` | `string (date-time)` | no |  |
| `failedAt` | `string (date-time)` | no |  |
| `cancelledAt` | `string (date-time)` | no |  |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "publish_request.succeeded"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "publishRequestId",
        "profileId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "publishRequestId": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "kind",
        "mode",
        "id",
        "status",
        "collection",
        "profileId",
        "metadata",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "publish_request",
          "description": "The kind of resource this is."
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode the resource belongs to. Live and sandbox resources are separate: a key reads and writes only its own mode's."
        },
        "id": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "created",
            "scheduled",
            "cancelled",
            "started",
            "succeeded",
            "failed",
            "outcome_unknown"
          ],
          "description": "`outcome_unknown`: The call that creates the content failed ambiguously (a timeout, a dropped connection, a platform 5xx), so the platform may have published it. Koil does not retry it. Check the platform before submitting again, or the content may be published twice."
        },
        "collection": {
          "type": "string",
          "minLength": 1
        },
        "variant": {
          "type": "string",
          "minLength": 1
        },
        "profileId": {
          "type": "string",
          "minLength": 1
        },
        "scheduledAt": {
          "type": "string",
          "format": "date-time",
          "description": "When Koil runs the publish, as an RFC 3339 date-time. On a submission it must be in the future and at most 365 days ahead; omit it to publish now."
        },
        "externalId": {
          "type": "string",
          "minLength": 1
        },
        "error": {
          "type": "object",
          "required": [
            "code",
            "message",
            "meta"
          ],
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "validation_error",
                "not_supported",
                "unauthorized",
                "quota_exceeded",
                "permission_denied",
                "scope_insufficient",
                "connection_invalid",
                "not_found",
                "conflict",
                "rate_limit_exceeded",
                "platform_rate_limit",
                "internal",
                "service_unavailable"
              ],
              "description": "Stable error code. `validation_error` (400), `not_supported` (400), `unauthorized` (401), `quota_exceeded` (402), `permission_denied` (403), `scope_insufficient` (403), `connection_invalid` (403), `not_found` (404), `conflict` (409), `rate_limit_exceeded` (429), `platform_rate_limit` (429), `internal` (500, 502, 504), `service_unavailable` (503)."
            },
            "message": {
              "type": "string",
              "description": "Human-readable summary."
            },
            "meta": {
              "type": "object",
              "properties": {
                "violations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "code",
                      "path",
                      "message"
                    ],
                    "properties": {
                      "code": {
                        "type": "string",
                        "description": "Stable violation code, such as `missing_field`, `unknown_field`, `schema_error`, `invalid_value` or `invalid_combination`."
                      },
                      "path": {
                        "type": "string",
                        "description": "JSON pointer into the request: path, query and body fields share one pointer space (`/cursor`, `/publishRequests/0/args/text`), a header is `/headers/<lowercase name>`, and `\"\"` is the request as a whole."
                      },
                      "message": {
                        "type": "string",
                        "description": "Human-readable explanation."
                      }
                    },
                    "additionalProperties": false
                  },
                  "description": "Every problem with the request. Always present on a `validation_error`."
                },
                "budgets": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded`: every budget that refused the request: `organization` (every authenticated request), `profile` (a request that acts on a Profile, one budget per Profile) or `client_address` (requests with no key or a rejected one). Koil may add budgets; treat an unknown one as covering the whole Organization."
                },
                "profileIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `rate_limit_exceeded` whose `budgets` include `profile`: the Profiles whose budget is spent. Requests that act on other Profiles are unaffected."
                },
                "required": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "On a `permission_denied`: the API key permissions the operation requires that the key lacks."
                },
                "limit": {
                  "type": "integer",
                  "description": "On a `quota_exceeded`: the cap that was reached."
                },
                "resourceType": {
                  "type": "string",
                  "description": "On a `not_found` or a `conflict` over an existing resource: the kind of resource, such as `profile` or `connection`."
                },
                "resourceId": {
                  "type": "string",
                  "description": "With `resourceType`: the id of the resource not found or already there."
                },
                "reason": {
                  "type": "string",
                  "description": "On a failed publish or backfill request, or a failed Connect Session, that Koil failed itself, not the platform: why, such as `media_incompatible`, `media_transform_not_entitled` or `subject_mismatch` (a reconnect authorized a different platform account than the Connection's)."
                },
                "refusalReason": {
                  "type": "string",
                  "enum": [
                    "messaging_window_closed",
                    "recipient_rate_limited",
                    "recipient_unavailable",
                    "publishing_limit_reached"
                  ],
                  "description": "Why the platform refused, where the code alone does not say what to do. `messaging_window_closed`: The platform takes a message to this person only inside a window that has closed: WhatsApp's 24-hour customer service window, the Messenger and Instagram messaging window, or TikTok's allowance since the person last wrote. It reopens when the person writes again. `recipient_rate_limited`: Too many messages to this one person in a short time; messages to others are unaffected. Retry after `Retry-After`. `recipient_unavailable`: The person cannot receive messages from this Profile: they blocked it or deactivated their account, or, on WhatsApp, the number has no account or an outdated app. Retrying does not help. `publishing_limit_reached`: The account's own publishing cap on the platform is spent: Instagram's 24-hour content publishing limit, YouTube's daily upload limit, or TikTok's limit on posts. Publish again once it resets."
                }
              },
              "additionalProperties": {},
              "description": "Structured detail; the keys depend on `code`."
            }
          },
          "additionalProperties": false
        },
        "metadata": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "maxLength": 500
            }
          },
          "maxProperties": 50,
          "propertyNames": {
            "minLength": 1,
            "maxLength": 40
          },
          "description": "Your own key-value pairs, up to 50 keys of at most 40 characters with string values of at most 500. An update merges into what is stored, and a key set to `\"\"` is removed."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "startedAt": {
          "type": "string",
          "format": "date-time"
        },
        "succeededAt": {
          "type": "string",
          "format": "date-time"
        },
        "failedAt": {
          "type": "string",
          "format": "date-time"
        },
        "cancelledAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

## Content

### `content.facebook.dm.messages.created`

Normalized `created` event for `facebook.dm.messages` content.

Collection `facebook.dm.messages`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The conversation: the same on every message in it, on reads and events alike, so an inbox groups by it. It is TikTok's conversation id, a WhatsApp group's id, and in a 1:1 chat on Instagram, Facebook or WhatsApp the counterpart's own id, since Meta's messaging webhooks carry no conversation id. |
| `target` | `unknown \| unknown` | no | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `choice` | `object` | no | The option the person picked instead of typing: a quick reply, a button or a list row a message offered, or one of the account's ice breakers. Its label is the message's `text`, and the message that offered it is `target` where the platform names it. Present where the platform reports the tap, which on Instagram and Messenger is the message's event only: a read of the same message returns its `text` without `choice`. Absent too when the platform withholds the payload (Meta sends a postback's payload only to the app that sent the button), so such a tap reads as typed text. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"facebook.dm.messages"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.facebook.dm.messages.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "containerId",
        "externalId",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The conversation: the same on every message in it, on reads and events alike, so an inbox groups by it. It is TikTok's conversation id, a WhatsApp group's id, and in a 1:1 chat on Instagram, Facebook or WhatsApp the counterpart's own id, since Meta's messaging webhooks carry no conversation id."
        },
        "target": {
          "type": "object",
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the thing pointed at; matching and joining always use it."
            },
            "kind": {
              "type": "string",
              "minLength": 1,
              "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "anyOf": [
            {
              "required": [
                "externalId"
              ]
            },
            {
              "required": [
                "permalink"
              ]
            }
          ],
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "choice": {
          "type": "object",
          "required": [
            "payload"
          ],
          "properties": {
            "payload": {
              "type": "string",
              "minLength": 1,
              "description": "The value the account set on the option when it offered it (a quick reply's, postback button's or ice breaker's `payload`, a reply button's or list row's id), so a consumer tells options apart by it rather than by their labels."
            }
          },
          "additionalProperties": false,
          "description": "The option the person picked instead of typing: a quick reply, a button or a list row a message offered, or one of the account's ice breakers. Its label is the message's `text`, and the message that offered it is `target` where the platform names it. Present where the platform reports the tap, which on Instagram and Messenger is the message's event only: a read of the same message returns its `text` without `choice`. Absent too when the platform withholds the payload (Meta sends a postback's payload only to the app that sent the button), so such a tap reads as typed text."
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "facebook.dm.messages",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.facebook.dm.reactions.deleted`

`facebook.dm.reactions` content was deleted; `data` identifies it and carries none of its content.

Collection `facebook.dm.reactions`. `data` identifies the deleted item and carries none of its content.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `target` | `object` | yes | The message reacted to. |
| `containerId` | `string` | yes | The conversation of the message reacted to: the counterpart's IGSID or PSID, as its messages' `containerId` names it. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `kind` | `"facebook.dm.reactions"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.facebook.dm.reactions.deleted"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "target",
        "containerId",
        "externalId",
        "kind"
      ],
      "properties": {
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "facebook.dm.messages"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The message reacted to."
        },
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The conversation of the message reacted to: the counterpart's IGSID or PSID, as its messages' `containerId` names it."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "const": "facebook.dm.reactions",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false,
      "description": "What a deletion carries: the deleted item's identity, its relations and whether the observing profile wrote it, never its content."
    }
  },
  "additionalProperties": false
}
```

### `content.facebook.dm.reactions.updated`

Normalized `updated` event for `facebook.dm.reactions` content.

Collection `facebook.dm.reactions`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `target` | `object` | yes | The message reacted to. |
| `containerId` | `string` | yes | The conversation of the message reacted to: the counterpart's IGSID or PSID, as its messages' `containerId` names it. |
| `emoji` | `string` | no | The emoji reacted with, as the platform sent it. |
| `author` | `object` | yes | The account that reacted: the counterpart, or the account itself. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `reactionType` | `"smile" \| "angry" \| "sad" \| "wow" \| "love" \| "like" \| "dislike" \| "other"` | no | Messenger's name for the reaction, beside its `emoji`; `other` is an emoji outside Messenger's named set. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"facebook.dm.reactions"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.facebook.dm.reactions.updated"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "target",
        "containerId",
        "author",
        "externalId",
        "kind"
      ],
      "properties": {
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "facebook.dm.messages"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The message reacted to."
        },
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The conversation of the message reacted to: the counterpart's IGSID or PSID, as its messages' `containerId` names it."
        },
        "emoji": {
          "type": "string",
          "minLength": 1,
          "description": "The emoji reacted with, as the platform sent it."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The account that reacted: the counterpart, or the account itself."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "reactionType": {
          "enum": [
            "smile",
            "angry",
            "sad",
            "wow",
            "love",
            "like",
            "dislike",
            "other"
          ],
          "description": "Messenger's name for the reaction, beside its `emoji`; `other` is an emoji outside Messenger's named set."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "facebook.dm.reactions",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.facebook.media.comments.created`

Normalized `created` event for `facebook.media.comments` content.

Collection `facebook.media.comments`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `target` | `object` | yes | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `hidden` | `boolean` | no |  |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `updatedAt` | `string (date-time)` | no | When the platform last updated it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"facebook.media.comments"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.facebook.media.comments.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "containerId",
        "target",
        "externalId",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "facebook.media.posts",
                "facebook.media.comments"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "hidden": {
          "type": "boolean"
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform last updated it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "facebook.media.comments",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.facebook.media.comments.deleted`

`facebook.media.comments` content was deleted; `data` identifies it and carries none of its content.

Collection `facebook.media.comments`. `data` identifies the deleted item and carries none of its content.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `target` | `object` | yes | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `kind` | `"facebook.media.comments"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.facebook.media.comments.deleted"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "containerId",
        "target",
        "externalId",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "facebook.media.posts",
                "facebook.media.comments"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "const": "facebook.media.comments",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false,
      "description": "What a deletion carries: the deleted item's identity, its relations and whether the observing profile wrote it, never its content."
    }
  },
  "additionalProperties": false
}
```

### `content.facebook.media.comments.moderated`

Normalized `moderated` event for `facebook.media.comments` content.

Collection `facebook.media.comments`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `target` | `object` | yes | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `hidden` | `boolean` | no |  |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `updatedAt` | `string (date-time)` | no | When the platform last updated it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"facebook.media.comments"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.facebook.media.comments.moderated"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "containerId",
        "target",
        "externalId",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "facebook.media.posts",
                "facebook.media.comments"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "hidden": {
          "type": "boolean"
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform last updated it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "facebook.media.comments",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.facebook.media.comments.updated`

Normalized `updated` event for `facebook.media.comments` content.

Collection `facebook.media.comments`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `target` | `object` | yes | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `hidden` | `boolean` | no |  |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `updatedAt` | `string (date-time)` | no | When the platform last updated it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"facebook.media.comments"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.facebook.media.comments.updated"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "containerId",
        "target",
        "externalId",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "facebook.media.posts",
                "facebook.media.comments"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "hidden": {
          "type": "boolean"
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform last updated it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "facebook.media.comments",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.facebook.media.mentions.created`

Normalized `created` event for `facebook.media.mentions` content.

Collection `facebook.media.mentions`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `variant` | `"post" \| "comment"` | yes | Whether the mentioning item is a post (identified by the post itself) or a comment (with the post it is on as `containerId`). |
| `containerId` | `string` | no | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"facebook.media.mentions"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.facebook.media.mentions.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "variant",
        "externalId",
        "kind"
      ],
      "properties": {
        "variant": {
          "enum": [
            "post",
            "comment"
          ],
          "description": "Whether the mentioning item is a post (identified by the post itself) or a comment (with the post it is on as `containerId`)."
        },
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "facebook.media.mentions",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.facebook.media.posts.created`

Normalized `created` event for `facebook.media.posts` content.

Collection `facebook.media.posts`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `media` | `object[]` | no |  |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"facebook.media.posts"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.facebook.media.posts.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "kind"
      ],
      "properties": {
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "media": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "other"
                ]
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The asset itself, when the platform serves it.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the asset, such as a video's cover.",
                "minLength": 1,
                "pattern": "^https?://"
              }
            },
            "additionalProperties": false,
            "description": "An image or video the post published. Platform URLs are often signed and expire, so fetch rather than store them."
          }
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "facebook.media.posts",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.facebook.media.posts.deleted`

`facebook.media.posts` content was deleted; `data` identifies it and carries none of its content.

Collection `facebook.media.posts`. `data` identifies the deleted item and carries none of its content.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `kind` | `"facebook.media.posts"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.facebook.media.posts.deleted"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "kind"
      ],
      "properties": {
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "const": "facebook.media.posts",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false,
      "description": "What a deletion carries: the deleted item's identity, its relations and whether the observing profile wrote it, never its content."
    }
  },
  "additionalProperties": false
}
```

### `content.facebook.media.posts.updated`

Normalized `updated` event for `facebook.media.posts` content.

Collection `facebook.media.posts`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `media` | `object[]` | no |  |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"facebook.media.posts"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.facebook.media.posts.updated"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "kind"
      ],
      "properties": {
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "media": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "other"
                ]
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The asset itself, when the platform serves it.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the asset, such as a video's cover.",
                "minLength": 1,
                "pattern": "^https?://"
              }
            },
            "additionalProperties": false,
            "description": "An image or video the post published. Platform URLs are often signed and expire, so fetch rather than store them."
          }
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "facebook.media.posts",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.facebook.media.reactions.deleted`

`facebook.media.reactions` content was deleted; `data` identifies it and carries none of its content.

Collection `facebook.media.reactions`. `data` identifies the deleted item and carries none of its content.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `target` | `object` | yes | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `containerId` | `string` | yes | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `kind` | `"facebook.media.reactions"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.facebook.media.reactions.deleted"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "target",
        "containerId",
        "externalId",
        "kind"
      ],
      "properties": {
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "facebook.media.posts",
                "facebook.media.comments"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "const": "facebook.media.reactions",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false,
      "description": "What a deletion carries: the deleted item's identity, its relations and whether the observing profile wrote it, never its content."
    }
  },
  "additionalProperties": false
}
```

### `content.facebook.media.reactions.updated`

Normalized `updated` event for `facebook.media.reactions` content.

Collection `facebook.media.reactions`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `target` | `object` | yes | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `containerId` | `string` | yes | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `emoji` | `string` | no | The emoji reacted with, as the platform sent it. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `reactionType` | `"like" \| "love" \| "care" \| "haha" \| "wow" \| "sad" \| "angry" \| "other"` | yes | like, love, care, haha, wow, sad or angry; `other` is a type Facebook added that Koil does not model. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"facebook.media.reactions"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.facebook.media.reactions.updated"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "target",
        "containerId",
        "externalId",
        "reactionType",
        "kind"
      ],
      "properties": {
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "facebook.media.posts",
                "facebook.media.comments"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "emoji": {
          "type": "string",
          "minLength": 1,
          "description": "The emoji reacted with, as the platform sent it."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "reactionType": {
          "enum": [
            "like",
            "love",
            "care",
            "haha",
            "wow",
            "sad",
            "angry",
            "other"
          ],
          "description": "like, love, care, haha, wow, sad or angry; `other` is a type Facebook added that Koil does not model."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "facebook.media.reactions",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.facebook.stories.posts.created`

Normalized `created` event for `facebook.stories.posts` content.

Collection `facebook.stories.posts`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `media` | `object[]` | no |  |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `variant` | `"photo" \| "video" \| "other"` | yes | The story's `media_type`. `other` is a type Meta added that Koil does not model yet. |
| `status` | `"published" \| "archived" \| "other"` | yes | `archived` once the story leaves the Page. `other` is a state Meta added that Koil does not model yet. |
| `mediaExternalId` | `string` | no | Meta's id for the story's photo or video. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"facebook.stories.posts"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.facebook.stories.posts.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "variant",
        "status",
        "kind"
      ],
      "properties": {
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "media": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "other"
                ]
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The asset itself, when the platform serves it.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the asset, such as a video's cover.",
                "minLength": 1,
                "pattern": "^https?://"
              }
            },
            "additionalProperties": false,
            "description": "An image or video the post published. Platform URLs are often signed and expire, so fetch rather than store them."
          }
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "variant": {
          "enum": [
            "photo",
            "video",
            "other"
          ],
          "description": "The story's `media_type`. `other` is a type Meta added that Koil does not model yet."
        },
        "status": {
          "enum": [
            "published",
            "archived",
            "other"
          ],
          "description": "`archived` once the story leaves the Page. `other` is a state Meta added that Koil does not model yet."
        },
        "mediaExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "Meta's id for the story's photo or video."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "facebook.stories.posts",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.google_business_profile.locations.reviews.created`

Normalized `created` event for `google_business_profile.locations.reviews` content.

Collection `google_business_profile.locations.reviews`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `locationExternalId` | `string` | yes |  |
| `rating` | `object` | no | A score on the platform's own scale, with its position on that scale as a percentage. |
| `text` | `string` | no | Caption/body text for content. |
| `reviewer` | `object` | yes | The reviewer as Google reports them: a name and photo, or neither when anonymous. Google publishes no stable reviewer id. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `reply` | `object` | no |  |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `updatedAt` | `string (date-time)` | no | When the platform last updated it. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"google_business_profile.locations.reviews"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.google_business_profile.locations.reviews.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "locationExternalId",
        "reviewer",
        "kind"
      ],
      "properties": {
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "locationExternalId": {
          "type": "string",
          "minLength": 1
        },
        "rating": {
          "type": "object",
          "required": [
            "value",
            "min",
            "max",
            "percent"
          ],
          "properties": {
            "value": {
              "type": "number",
              "description": "The score as the platform reports it, on its own scale."
            },
            "min": {
              "type": "number",
              "description": "The lowest score the platform's scale allows."
            },
            "max": {
              "type": "number",
              "description": "The highest score the platform's scale allows."
            },
            "percent": {
              "type": "number",
              "minimum": 0,
              "maximum": 100,
              "description": "Where `value` sits on the scale: 0 at `min`, 100 at `max`, to two decimal places. Derived, and comparable across platforms."
            }
          },
          "additionalProperties": false,
          "description": "A score on the platform's own scale, with its position on that scale as a percentage."
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "reviewer": {
          "type": "object",
          "required": [
            "isAnonymous"
          ],
          "properties": {
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The reviewer's profile picture, as Google serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            },
            "isAnonymous": {
              "type": "boolean"
            }
          },
          "additionalProperties": false,
          "description": "The reviewer as Google reports them: a name and photo, or neither when anonymous. Google publishes no stable reviewer id."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "reply": {
          "type": "object",
          "required": [
            "text"
          ],
          "properties": {
            "text": {
              "type": "string",
              "description": "Caption/body text for content."
            },
            "state": {
              "enum": [
                "pending",
                "approved",
                "rejected",
                "other"
              ],
              "description": "Google's moderation state of the owner's reply. `other` is a state Google added that Koil does not model yet."
            },
            "policyViolation": {
              "type": "string",
              "minLength": 1
            },
            "updatedAt": {
              "type": "string",
              "format": "date-time",
              "description": "When the platform last updated it."
            }
          },
          "additionalProperties": false
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform last updated it."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "google_business_profile.locations.reviews",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.google_business_profile.locations.reviews.updated`

Normalized `updated` event for `google_business_profile.locations.reviews` content.

Collection `google_business_profile.locations.reviews`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `locationExternalId` | `string` | yes |  |
| `rating` | `object` | no | A score on the platform's own scale, with its position on that scale as a percentage. |
| `text` | `string` | no | Caption/body text for content. |
| `reviewer` | `object` | yes | The reviewer as Google reports them: a name and photo, or neither when anonymous. Google publishes no stable reviewer id. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `reply` | `object` | no |  |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `updatedAt` | `string (date-time)` | no | When the platform last updated it. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"google_business_profile.locations.reviews"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.google_business_profile.locations.reviews.updated"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "locationExternalId",
        "reviewer",
        "kind"
      ],
      "properties": {
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "locationExternalId": {
          "type": "string",
          "minLength": 1
        },
        "rating": {
          "type": "object",
          "required": [
            "value",
            "min",
            "max",
            "percent"
          ],
          "properties": {
            "value": {
              "type": "number",
              "description": "The score as the platform reports it, on its own scale."
            },
            "min": {
              "type": "number",
              "description": "The lowest score the platform's scale allows."
            },
            "max": {
              "type": "number",
              "description": "The highest score the platform's scale allows."
            },
            "percent": {
              "type": "number",
              "minimum": 0,
              "maximum": 100,
              "description": "Where `value` sits on the scale: 0 at `min`, 100 at `max`, to two decimal places. Derived, and comparable across platforms."
            }
          },
          "additionalProperties": false,
          "description": "A score on the platform's own scale, with its position on that scale as a percentage."
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "reviewer": {
          "type": "object",
          "required": [
            "isAnonymous"
          ],
          "properties": {
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The reviewer's profile picture, as Google serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            },
            "isAnonymous": {
              "type": "boolean"
            }
          },
          "additionalProperties": false,
          "description": "The reviewer as Google reports them: a name and photo, or neither when anonymous. Google publishes no stable reviewer id."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "reply": {
          "type": "object",
          "required": [
            "text"
          ],
          "properties": {
            "text": {
              "type": "string",
              "description": "Caption/body text for content."
            },
            "state": {
              "enum": [
                "pending",
                "approved",
                "rejected",
                "other"
              ],
              "description": "Google's moderation state of the owner's reply. `other` is a state Google added that Koil does not model yet."
            },
            "policyViolation": {
              "type": "string",
              "minLength": 1
            },
            "updatedAt": {
              "type": "string",
              "format": "date-time",
              "description": "When the platform last updated it."
            }
          },
          "additionalProperties": false
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform last updated it."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "google_business_profile.locations.reviews",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.instagram.dm.messages.created`

Normalized `created` event for `instagram.dm.messages` content.

Collection `instagram.dm.messages`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The conversation: the same on every message in it, on reads and events alike, so an inbox groups by it. It is TikTok's conversation id, a WhatsApp group's id, and in a 1:1 chat on Instagram, Facebook or WhatsApp the counterpart's own id, since Meta's messaging webhooks carry no conversation id. |
| `target` | `unknown \| unknown` | no | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `choice` | `object` | no | The option the person picked instead of typing: a quick reply, a button or a list row a message offered, or one of the account's ice breakers. Its label is the message's `text`, and the message that offered it is `target` where the platform names it. Present where the platform reports the tap, which on Instagram and Messenger is the message's event only: a read of the same message returns its `text` without `choice`. Absent too when the platform withholds the payload (Meta sends a postback's payload only to the app that sent the button), so such a tap reads as typed text. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"instagram.dm.messages"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.instagram.dm.messages.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "containerId",
        "externalId",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The conversation: the same on every message in it, on reads and events alike, so an inbox groups by it. It is TikTok's conversation id, a WhatsApp group's id, and in a 1:1 chat on Instagram, Facebook or WhatsApp the counterpart's own id, since Meta's messaging webhooks carry no conversation id."
        },
        "target": {
          "type": "object",
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the thing pointed at; matching and joining always use it."
            },
            "kind": {
              "type": "string",
              "minLength": 1,
              "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "anyOf": [
            {
              "required": [
                "externalId"
              ]
            },
            {
              "required": [
                "permalink"
              ]
            }
          ],
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "choice": {
          "type": "object",
          "required": [
            "payload"
          ],
          "properties": {
            "payload": {
              "type": "string",
              "minLength": 1,
              "description": "The value the account set on the option when it offered it (a quick reply's, postback button's or ice breaker's `payload`, a reply button's or list row's id), so a consumer tells options apart by it rather than by their labels."
            }
          },
          "additionalProperties": false,
          "description": "The option the person picked instead of typing: a quick reply, a button or a list row a message offered, or one of the account's ice breakers. Its label is the message's `text`, and the message that offered it is `target` where the platform names it. Present where the platform reports the tap, which on Instagram and Messenger is the message's event only: a read of the same message returns its `text` without `choice`. Absent too when the platform withholds the payload (Meta sends a postback's payload only to the app that sent the button), so such a tap reads as typed text."
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "instagram.dm.messages",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.instagram.dm.reactions.deleted`

`instagram.dm.reactions` content was deleted; `data` identifies it and carries none of its content.

Collection `instagram.dm.reactions`. `data` identifies the deleted item and carries none of its content.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `target` | `object` | yes | The message reacted to. |
| `containerId` | `string` | yes | The conversation of the message reacted to: the counterpart's IGSID or PSID, as its messages' `containerId` names it. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `kind` | `"instagram.dm.reactions"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.instagram.dm.reactions.deleted"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "target",
        "containerId",
        "externalId",
        "kind"
      ],
      "properties": {
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "instagram.dm.messages"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The message reacted to."
        },
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The conversation of the message reacted to: the counterpart's IGSID or PSID, as its messages' `containerId` names it."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "const": "instagram.dm.reactions",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false,
      "description": "What a deletion carries: the deleted item's identity, its relations and whether the observing profile wrote it, never its content."
    }
  },
  "additionalProperties": false
}
```

### `content.instagram.dm.reactions.updated`

Normalized `updated` event for `instagram.dm.reactions` content.

Collection `instagram.dm.reactions`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `target` | `object` | yes | The message reacted to. |
| `containerId` | `string` | yes | The conversation of the message reacted to: the counterpart's IGSID or PSID, as its messages' `containerId` names it. |
| `emoji` | `string` | no | The emoji reacted with, as the platform sent it. |
| `author` | `object` | yes | The account that reacted: the counterpart, or the account itself. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"instagram.dm.reactions"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.instagram.dm.reactions.updated"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "target",
        "containerId",
        "author",
        "externalId",
        "kind"
      ],
      "properties": {
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "instagram.dm.messages"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The message reacted to."
        },
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The conversation of the message reacted to: the counterpart's IGSID or PSID, as its messages' `containerId` names it."
        },
        "emoji": {
          "type": "string",
          "minLength": 1,
          "description": "The emoji reacted with, as the platform sent it."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The account that reacted: the counterpart, or the account itself."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "instagram.dm.reactions",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.instagram.media.comments.created`

Normalized `created` event for `instagram.media.comments` content.

Collection `instagram.media.comments`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `target` | `object` | yes | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `hidden` | `boolean` | no | Whether the account hid the comment from the public. Absent when the platform did not say. |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `updatedAt` | `string (date-time)` | no | When the platform last updated it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"instagram.media.comments"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.instagram.media.comments.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "containerId",
        "target",
        "externalId",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "instagram.media.posts",
                "instagram.media.comments"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "hidden": {
          "type": "boolean",
          "description": "Whether the account hid the comment from the public. Absent when the platform did not say."
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform last updated it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "instagram.media.comments",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.instagram.media.mentions.created`

Normalized `created` event for `instagram.media.mentions` content.

Collection `instagram.media.mentions`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `variant` | `"post" \| "comment"` | yes | Whether the mentioning item is a post (identified by the post itself) or a comment (with the post it is on as `containerId`). |
| `containerId` | `string` | no | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"instagram.media.mentions"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.instagram.media.mentions.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "variant",
        "externalId",
        "kind"
      ],
      "properties": {
        "variant": {
          "enum": [
            "post",
            "comment"
          ],
          "description": "Whether the mentioning item is a post (identified by the post itself) or a comment (with the post it is on as `containerId`)."
        },
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "instagram.media.mentions",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.instagram.media.posts.created`

Normalized `created` event for `instagram.media.posts` content.

Collection `instagram.media.posts`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `media` | `object[]` | no |  |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `variant` | `"feed" \| "reel" \| "other"` | yes | `reel` for a reel or any video, `feed` for other feed media. `other` is a `media_product_type` Koil does not model. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"instagram.media.posts"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.instagram.media.posts.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "variant",
        "kind"
      ],
      "properties": {
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "media": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "other"
                ]
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The asset itself, when the platform serves it.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the asset, such as a video's cover.",
                "minLength": 1,
                "pattern": "^https?://"
              }
            },
            "additionalProperties": false,
            "description": "An image or video the post published. Platform URLs are often signed and expire, so fetch rather than store them."
          }
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "variant": {
          "enum": [
            "feed",
            "reel",
            "other"
          ],
          "description": "`reel` for a reel or any video, `feed` for other feed media. `other` is a `media_product_type` Koil does not model."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "instagram.media.posts",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.instagram.stories.posts.created`

Normalized `created` event for `instagram.stories.posts` content.

Collection `instagram.stories.posts`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `media` | `object[]` | no |  |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"instagram.stories.posts"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.instagram.stories.posts.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "kind"
      ],
      "properties": {
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "media": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "other"
                ]
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The asset itself, when the platform serves it.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the asset, such as a video's cover.",
                "minLength": 1,
                "pattern": "^https?://"
              }
            },
            "additionalProperties": false,
            "description": "An image or video the post published. Platform URLs are often signed and expire, so fetch rather than store them."
          }
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "instagram.stories.posts",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.linkedin.feed.comments.created`

Normalized `created` event for `linkedin.feed.comments` content.

Collection `linkedin.feed.comments`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | no | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `target` | `object` | no | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `hidden` | `boolean` | no | Whether the account hid the comment from the public. Absent when the platform did not say. |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `updatedAt` | `string (date-time)` | no | When the platform last updated it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `commentNumericId` | `string` | yes | The comment's id without its thread, the same whichever URN names the thread: the key to join a comment read through its post with one an event delivered. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"linkedin.feed.comments"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.linkedin.feed.comments.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "commentNumericId",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "linkedin.feed.posts",
                "linkedin.feed.comments"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "hidden": {
          "type": "boolean",
          "description": "Whether the account hid the comment from the public. Absent when the platform did not say."
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform last updated it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "commentNumericId": {
          "type": "string",
          "minLength": 1,
          "description": "The comment's id without its thread, the same whichever URN names the thread: the key to join a comment read through its post with one an event delivered."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "linkedin.feed.comments",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.linkedin.feed.comments.deleted`

`linkedin.feed.comments` content was deleted; `data` identifies it and carries none of its content.

Collection `linkedin.feed.comments`. `data` identifies the deleted item and carries none of its content.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | no | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `target` | `object` | no | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `commentNumericId` | `string` | yes | The comment's id without its thread, the same whichever URN names the thread: the key to join a comment read through its post with one an event delivered. |
| `kind` | `"linkedin.feed.comments"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.linkedin.feed.comments.deleted"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "commentNumericId",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "linkedin.feed.posts",
                "linkedin.feed.comments"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "commentNumericId": {
          "type": "string",
          "minLength": 1,
          "description": "The comment's id without its thread, the same whichever URN names the thread: the key to join a comment read through its post with one an event delivered."
        },
        "kind": {
          "type": "string",
          "const": "linkedin.feed.comments",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false,
      "description": "What a deletion carries: the deleted item's identity, its relations and whether the observing profile wrote it, never its content."
    }
  },
  "additionalProperties": false
}
```

### `content.linkedin.feed.comments.updated`

Normalized `updated` event for `linkedin.feed.comments` content.

Collection `linkedin.feed.comments`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | no | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `target` | `object` | no | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `hidden` | `boolean` | no | Whether the account hid the comment from the public. Absent when the platform did not say. |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `updatedAt` | `string (date-time)` | no | When the platform last updated it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `commentNumericId` | `string` | yes | The comment's id without its thread, the same whichever URN names the thread: the key to join a comment read through its post with one an event delivered. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"linkedin.feed.comments"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.linkedin.feed.comments.updated"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "commentNumericId",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "linkedin.feed.posts",
                "linkedin.feed.comments"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "hidden": {
          "type": "boolean",
          "description": "Whether the account hid the comment from the public. Absent when the platform did not say."
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform last updated it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "commentNumericId": {
          "type": "string",
          "minLength": 1,
          "description": "The comment's id without its thread, the same whichever URN names the thread: the key to join a comment read through its post with one an event delivered."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "linkedin.feed.comments",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.linkedin.feed.mentions.created`

Normalized `created` event for `linkedin.feed.mentions` content.

Collection `linkedin.feed.mentions`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `variant` | `"post" \| "comment"` | yes | Whether the mentioning item is a post (identified by the post itself) or a comment (with the post it is on as `containerId`). |
| `containerId` | `string` | no | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `organizationExternalId` | `string` | yes |  |
| `activityUrn` | `string` | no |  |
| `kind` | `"linkedin.feed.mentions"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.linkedin.feed.mentions.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "variant",
        "externalId",
        "organizationExternalId",
        "kind"
      ],
      "properties": {
        "variant": {
          "enum": [
            "post",
            "comment"
          ],
          "description": "Whether the mentioning item is a post (identified by the post itself) or a comment (with the post it is on as `containerId`)."
        },
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "organizationExternalId": {
          "type": "string",
          "minLength": 1
        },
        "activityUrn": {
          "type": "string",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "const": "linkedin.feed.mentions",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.linkedin.feed.posts.created`

Normalized `created` event for `linkedin.feed.posts` content.

Collection `linkedin.feed.posts`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `media` | `object[]` | no |  |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `organizationExternalId` | `string` | yes |  |
| `hashtags` | `string[]` | no |  |
| `variant` | `"text" \| "image" \| "video" \| "document" \| "article" \| "multi_image" \| "poll" \| "reshare" \| "other"` | yes | What the post carries besides its text, with the details in `content` (absent when there are none, always for `text` and `other`). `image`, `video` and `document` name a single uploaded asset by its LinkedIn URN. |
| `content` | `object` | no |  |
| `visibility` | `"public" \| "connections" \| "logged_in" \| "container" \| "other"` | no | `public`, `connections`, `logged_in` or `container`; `other` is one LinkedIn added that Koil does not model. Only `public` posts raise LinkedIn's comment notifications. |
| `lifecycleState` | `"published" \| "publish_requested" \| "publish_failed" \| "draft" \| "other"` | no | `published`, or `publish_requested` while LinkedIn processes it, `publish_failed`, `draft`; `other` is one LinkedIn added that Koil does not model. |
| `reshareDisabled` | `boolean` | no |  |
| `updatedAt` | `string (date-time)` | no | When the platform last updated it. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"linkedin.feed.posts"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.linkedin.feed.posts.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "organizationExternalId",
        "variant",
        "kind"
      ],
      "properties": {
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "media": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "other"
                ]
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The asset itself, when the platform serves it.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the asset, such as a video's cover.",
                "minLength": 1,
                "pattern": "^https?://"
              }
            },
            "additionalProperties": false,
            "description": "An image or video the post published. Platform URLs are often signed and expire, so fetch rather than store them."
          }
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "organizationExternalId": {
          "type": "string",
          "minLength": 1
        },
        "hashtags": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "variant": {
          "enum": [
            "text",
            "image",
            "video",
            "document",
            "article",
            "multi_image",
            "poll",
            "reshare",
            "other"
          ],
          "description": "What the post carries besides its text, with the details in `content` (absent when there are none, always for `text` and `other`). `image`, `video` and `document` name a single uploaded asset by its LinkedIn URN."
        },
        "content": {
          "type": "object",
          "properties": {
            "mediaUrn": {
              "type": "string",
              "minLength": 1
            },
            "imageUrns": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "url": {
              "type": "string",
              "minLength": 1
            },
            "title": {
              "type": "string"
            },
            "description": {
              "type": "string"
            },
            "altText": {
              "type": "string"
            },
            "resharedPostUrn": {
              "type": "string",
              "minLength": 1
            }
          },
          "additionalProperties": false
        },
        "visibility": {
          "enum": [
            "public",
            "connections",
            "logged_in",
            "container",
            "other"
          ],
          "description": "`public`, `connections`, `logged_in` or `container`; `other` is one LinkedIn added that Koil does not model. Only `public` posts raise LinkedIn's comment notifications."
        },
        "lifecycleState": {
          "enum": [
            "published",
            "publish_requested",
            "publish_failed",
            "draft",
            "other"
          ],
          "description": "`published`, or `publish_requested` while LinkedIn processes it, `publish_failed`, `draft`; `other` is one LinkedIn added that Koil does not model."
        },
        "reshareDisabled": {
          "type": "boolean"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform last updated it."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "linkedin.feed.posts",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.tiktok.dm.conversations.updated`

Normalized `updated` event for `tiktok.dm.conversations` content.

Collection `tiktok.dm.conversations`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `counterpart` | `object` | no | The person the account is talking to in a 1:1 conversation. A group chat has none. |
| `messageRequest` | `boolean` | no | Whether the conversation is still a message request: the person wrote and the account has not replied yet. Absent when the read or event did not say. |
| `updatedAt` | `string (date-time)` | no | When the conversation last changed, as the platform reports it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `referral` | `object` | no |  |
| `lastReadAt` | `string (date-time)` | no | When the platform last updated it. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"tiktok.dm.conversations"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.tiktok.dm.conversations.updated"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "kind"
      ],
      "properties": {
        "counterpart": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The person the account is talking to in a 1:1 conversation. A group chat has none."
        },
        "messageRequest": {
          "type": "boolean",
          "description": "Whether the conversation is still a message request: the person wrote and the account has not replied yet. Absent when the read or event did not say."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the conversation last changed, as the platform reports it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "referral": {
          "type": "object",
          "properties": {
            "source": {
              "enum": [
                "ad",
                "short_link",
                "other"
              ],
              "description": "What the webhook says brought the person. `other` is a source TikTok added that Koil does not model yet."
            },
            "ads": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "advertiserId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "adId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "adName": {
                    "type": "string",
                    "minLength": 1
                  },
                  "embedUrl": {
                    "type": "string",
                    "minLength": 1
                  },
                  "materialId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "referredAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the platform last updated it."
                  }
                },
                "additionalProperties": false
              }
            },
            "shortLinks": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "ref": {
                    "type": "string",
                    "minLength": 1
                  },
                  "prefilledMessage": {
                    "type": "string",
                    "minLength": 1
                  },
                  "prefilledMessageAuditStatus": {
                    "enum": [
                      "pass",
                      "reject",
                      "other"
                    ],
                    "description": "TikTok's review of the prefilled message. `other` is a result TikTok added that Koil does not model yet."
                  }
                },
                "additionalProperties": false
              }
            }
          },
          "additionalProperties": false
        },
        "lastReadAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform last updated it."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "tiktok.dm.conversations",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.tiktok.dm.messages.created`

Normalized `created` event for `tiktok.dm.messages` content.

Collection `tiktok.dm.messages`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The conversation: the same on every message in it, on reads and events alike, so an inbox groups by it. It is TikTok's conversation id, a WhatsApp group's id, and in a 1:1 chat on Instagram, Facebook or WhatsApp the counterpart's own id, since Meta's messaging webhooks carry no conversation id. |
| `target` | `object` | no | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `choice` | `object` | no | The option the person picked instead of typing: a quick reply, a button or a list row a message offered, or one of the account's ice breakers. Its label is the message's `text`, and the message that offered it is `target` where the platform names it. Present where the platform reports the tap, which on Instagram and Messenger is the message's event only: a read of the same message returns its `text` without `choice`. Absent too when the platform withholds the payload (Meta sends a postback's payload only to the app that sent the button), so such a tap reads as typed text. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `variant` | `"text" \| "image" \| "video" \| "share_post" \| "emoji" \| "sticker" \| "template" \| "other"` | yes | TikTok's message type. `other` is a type TikTok added that Koil does not model yet. |
| `recipient` | `object` | no | Platform actor reference for observed content. |
| `source` | `string` | no |  |
| `autoMessageType` | `"welcome_message" \| "suggested_question" \| "auto_reply" \| "other"` | no | Which automation sent it. `other` is one TikTok added that Koil does not model yet. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"tiktok.dm.messages"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.tiktok.dm.messages.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "containerId",
        "externalId",
        "variant",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The conversation: the same on every message in it, on reads and events alike, so an inbox groups by it. It is TikTok's conversation id, a WhatsApp group's id, and in a 1:1 chat on Instagram, Facebook or WhatsApp the counterpart's own id, since Meta's messaging webhooks carry no conversation id."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "tiktok.dm.messages"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "choice": {
          "type": "object",
          "required": [
            "payload"
          ],
          "properties": {
            "payload": {
              "type": "string",
              "minLength": 1,
              "description": "The value the account set on the option when it offered it (a quick reply's, postback button's or ice breaker's `payload`, a reply button's or list row's id), so a consumer tells options apart by it rather than by their labels."
            }
          },
          "additionalProperties": false,
          "description": "The option the person picked instead of typing: a quick reply, a button or a list row a message offered, or one of the account's ice breakers. Its label is the message's `text`, and the message that offered it is `target` where the platform names it. Present where the platform reports the tap, which on Instagram and Messenger is the message's event only: a read of the same message returns its `text` without `choice`. Absent too when the platform withholds the payload (Meta sends a postback's payload only to the app that sent the button), so such a tap reads as typed text."
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "variant": {
          "enum": [
            "text",
            "image",
            "video",
            "share_post",
            "emoji",
            "sticker",
            "template",
            "other"
          ],
          "description": "TikTok's message type. `other` is a type TikTok added that Koil does not model yet."
        },
        "recipient": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "source": {
          "type": "string",
          "minLength": 1
        },
        "autoMessageType": {
          "enum": [
            "welcome_message",
            "suggested_question",
            "auto_reply",
            "other"
          ],
          "description": "Which automation sent it. `other` is one TikTok added that Koil does not model yet."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "tiktok.dm.messages",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.tiktok.videos.comments.created`

Normalized `created` event for `tiktok.videos.comments` content.

Collection `tiktok.videos.comments`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `target` | `object` | yes | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `hidden` | `boolean` | no | Whether the account hid the comment from the public. Absent when the platform did not say. |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `updatedAt` | `string (date-time)` | no | When the platform last updated it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `pinned` | `boolean` | no |  |
| `liked` | `boolean` | no |  |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"tiktok.videos.comments"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.tiktok.videos.comments.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "containerId",
        "target",
        "externalId",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "tiktok.videos.posts",
                "tiktok.videos.comments"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "hidden": {
          "type": "boolean",
          "description": "Whether the account hid the comment from the public. Absent when the platform did not say."
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform last updated it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "pinned": {
          "type": "boolean"
        },
        "liked": {
          "type": "boolean"
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "tiktok.videos.comments",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.tiktok.videos.comments.deleted`

`tiktok.videos.comments` content was deleted; `data` identifies it and carries none of its content.

Collection `tiktok.videos.comments`. `data` identifies the deleted item and carries none of its content.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `target` | `object` | yes | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `kind` | `"tiktok.videos.comments"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.tiktok.videos.comments.deleted"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "containerId",
        "target",
        "externalId",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "tiktok.videos.posts",
                "tiktok.videos.comments"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "const": "tiktok.videos.comments",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false,
      "description": "What a deletion carries: the deleted item's identity, its relations and whether the observing profile wrote it, never its content."
    }
  },
  "additionalProperties": false
}
```

### `content.tiktok.videos.comments.moderated`

Normalized `moderated` event for `tiktok.videos.comments` content.

Collection `tiktok.videos.comments`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `target` | `object` | yes | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `hidden` | `boolean` | no | Whether the account hid the comment from the public. Absent when the platform did not say. |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `updatedAt` | `string (date-time)` | no | When the platform last updated it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `pinned` | `boolean` | no |  |
| `liked` | `boolean` | no |  |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"tiktok.videos.comments"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.tiktok.videos.comments.moderated"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "containerId",
        "target",
        "externalId",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "tiktok.videos.posts",
                "tiktok.videos.comments"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "hidden": {
          "type": "boolean",
          "description": "Whether the account hid the comment from the public. Absent when the platform did not say."
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform last updated it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "pinned": {
          "type": "boolean"
        },
        "liked": {
          "type": "boolean"
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "tiktok.videos.comments",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.tiktok.videos.comments.updated`

Normalized `updated` event for `tiktok.videos.comments` content.

Collection `tiktok.videos.comments`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `target` | `object` | yes | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `hidden` | `boolean` | no | Whether the account hid the comment from the public. Absent when the platform did not say. |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `updatedAt` | `string (date-time)` | no | When the platform last updated it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `pinned` | `boolean` | no |  |
| `liked` | `boolean` | no |  |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"tiktok.videos.comments"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.tiktok.videos.comments.updated"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "containerId",
        "target",
        "externalId",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "tiktok.videos.posts",
                "tiktok.videos.comments"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "hidden": {
          "type": "boolean",
          "description": "Whether the account hid the comment from the public. Absent when the platform did not say."
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform last updated it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "pinned": {
          "type": "boolean"
        },
        "liked": {
          "type": "boolean"
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "tiktok.videos.comments",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.tiktok.videos.mentions.created`

Normalized `created` event for `tiktok.videos.mentions` content.

Collection `tiktok.videos.mentions`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `variant` | `"post" \| "comment"` | yes | Whether the mentioning item is a post (identified by the post itself) or a comment (with the post it is on as `containerId`). |
| `containerId` | `string` | no | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `media` | `object[]` | no |  |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"tiktok.videos.mentions"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.tiktok.videos.mentions.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "variant",
        "externalId",
        "kind"
      ],
      "properties": {
        "variant": {
          "enum": [
            "post",
            "comment"
          ],
          "description": "Whether the mentioning item is a post (identified by the post itself) or a comment (with the post it is on as `containerId`)."
        },
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "media": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "other"
                ]
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The asset itself, when the platform serves it.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the asset, such as a video's cover.",
                "minLength": 1,
                "pattern": "^https?://"
              }
            },
            "additionalProperties": false,
            "description": "An image or video the post published. Platform URLs are often signed and expire, so fetch rather than store them."
          }
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "tiktok.videos.mentions",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.tiktok.videos.mentions.updated`

Normalized `updated` event for `tiktok.videos.mentions` content.

Collection `tiktok.videos.mentions`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `variant` | `"post" \| "comment"` | yes | Whether the mentioning item is a post (identified by the post itself) or a comment (with the post it is on as `containerId`). |
| `containerId` | `string` | no | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `media` | `object[]` | no |  |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"tiktok.videos.mentions"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.tiktok.videos.mentions.updated"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "variant",
        "externalId",
        "kind"
      ],
      "properties": {
        "variant": {
          "enum": [
            "post",
            "comment"
          ],
          "description": "Whether the mentioning item is a post (identified by the post itself) or a comment (with the post it is on as `containerId`)."
        },
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "media": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "other"
                ]
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The asset itself, when the platform serves it.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the asset, such as a video's cover.",
                "minLength": 1,
                "pattern": "^https?://"
              }
            },
            "additionalProperties": false,
            "description": "An image or video the post published. Platform URLs are often signed and expire, so fetch rather than store them."
          }
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "tiktok.videos.mentions",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.tiktok.videos.posts.created`

Normalized `created` event for `tiktok.videos.posts` content.

Collection `tiktok.videos.posts`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `media` | `object[]` | no |  |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `variant` | `"video" \| "photo" \| "other"` | yes | TikTok's `media_type`. `other` is a type TikTok added that Koil does not model yet. |
| `embedUrl` | `string` | no |  |
| `durationSeconds` | `number` | no |  |
| `isAd` | `boolean` | no |  |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"tiktok.videos.posts"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.tiktok.videos.posts.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "variant",
        "kind"
      ],
      "properties": {
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "media": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "other"
                ]
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The asset itself, when the platform serves it.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the asset, such as a video's cover.",
                "minLength": 1,
                "pattern": "^https?://"
              }
            },
            "additionalProperties": false,
            "description": "An image or video the post published. Platform URLs are often signed and expire, so fetch rather than store them."
          }
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "variant": {
          "enum": [
            "video",
            "photo",
            "other"
          ],
          "description": "TikTok's `media_type`. `other` is a type TikTok added that Koil does not model yet."
        },
        "embedUrl": {
          "type": "string",
          "minLength": 1
        },
        "durationSeconds": {
          "type": "number",
          "minimum": 0
        },
        "isAd": {
          "type": "boolean"
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "tiktok.videos.posts",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.tiktok.videos.posts.deleted`

`tiktok.videos.posts` content was deleted; `data` identifies it and carries none of its content.

Collection `tiktok.videos.posts`. `data` identifies the deleted item and carries none of its content.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `kind` | `"tiktok.videos.posts"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.tiktok.videos.posts.deleted"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "kind"
      ],
      "properties": {
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "const": "tiktok.videos.posts",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false,
      "description": "What a deletion carries: the deleted item's identity, its relations and whether the observing profile wrote it, never its content."
    }
  },
  "additionalProperties": false
}
```

### `content.whatsapp.dm.messages.created`

Normalized `created` event for `whatsapp.dm.messages` content.

Collection `whatsapp.dm.messages`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The conversation: the same on every message in it, on reads and events alike, so an inbox groups by it. It is TikTok's conversation id, a WhatsApp group's id, and in a 1:1 chat on Instagram, Facebook or WhatsApp the counterpart's own id, since Meta's messaging webhooks carry no conversation id. |
| `target` | `object` | no | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | yes | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `choice` | `object` | no | The option the person picked instead of typing: a quick reply, a button or a list row a message offered, or one of the account's ice breakers. Its label is the message's `text`, and the message that offered it is `target` where the platform names it. Present where the platform reports the tap, which on Instagram and Messenger is the message's event only: a read of the same message returns its `text` without `choice`. Absent too when the platform withholds the payload (Meta sends a postback's payload only to the app that sent the button), so such a tap reads as typed text. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `variant` | `"text" \| "image" \| "video" \| "audio" \| "document" \| "sticker" \| "location" \| "contacts" \| "interactive" \| "button" \| "referral" \| "order" \| "system" \| "unsupported" \| "other"` | yes | The Cloud API message `type`. Media types carry one `attachments` entry; `location` carries `location`; `unsupported` is a type the Cloud API cannot deliver (e.g. a poll); `other` is a type Meta added that Koil does not model yet. |
| `authorPhoneNumber` | `string` | no | The person's phone number in E.164 digits, present only when Meta shares it: when the business messaged or called that number, or was messaged or called from it, in the last 30 days, or has it in its contacts. Never a key: it can be absent on one message and present on the next, so identify the person by their BSUID. |
| `location` | `object` | no | Geographic place reference for content. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"whatsapp.dm.messages"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.whatsapp.dm.messages.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "containerId",
        "author",
        "externalId",
        "variant",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The conversation: the same on every message in it, on reads and events alike, so an inbox groups by it. It is TikTok's conversation id, a WhatsApp group's id, and in a 1:1 chat on Instagram, Facebook or WhatsApp the counterpart's own id, since Meta's messaging webhooks carry no conversation id."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "whatsapp.dm.messages"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "choice": {
          "type": "object",
          "required": [
            "payload"
          ],
          "properties": {
            "payload": {
              "type": "string",
              "minLength": 1,
              "description": "The value the account set on the option when it offered it (a quick reply's, postback button's or ice breaker's `payload`, a reply button's or list row's id), so a consumer tells options apart by it rather than by their labels."
            }
          },
          "additionalProperties": false,
          "description": "The option the person picked instead of typing: a quick reply, a button or a list row a message offered, or one of the account's ice breakers. Its label is the message's `text`, and the message that offered it is `target` where the platform names it. Present where the platform reports the tap, which on Instagram and Messenger is the message's event only: a read of the same message returns its `text` without `choice`. Absent too when the platform withholds the payload (Meta sends a postback's payload only to the app that sent the button), so such a tap reads as typed text."
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "variant": {
          "enum": [
            "text",
            "image",
            "video",
            "audio",
            "document",
            "sticker",
            "location",
            "contacts",
            "interactive",
            "button",
            "referral",
            "order",
            "system",
            "unsupported",
            "other"
          ],
          "description": "The Cloud API message `type`. Media types carry one `attachments` entry; `location` carries `location`; `unsupported` is a type the Cloud API cannot deliver (e.g. a poll); `other` is a type Meta added that Koil does not model yet."
        },
        "authorPhoneNumber": {
          "type": "string",
          "minLength": 1,
          "description": "The person's phone number in E.164 digits, present only when Meta shares it: when the business messaged or called that number, or was messaged or called from it, in the last 30 days, or has it in its contacts. Never a key: it can be absent on one message and present on the next, so identify the person by their BSUID."
        },
        "location": {
          "type": "object",
          "properties": {
            "locationId": {
              "type": "string",
              "minLength": 1
            },
            "name": {
              "type": "string",
              "minLength": 1
            },
            "lat": {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            },
            "lng": {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            }
          },
          "additionalProperties": false,
          "description": "Geographic place reference for content."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "whatsapp.dm.messages",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.whatsapp.dm.reactions.deleted`

`whatsapp.dm.reactions` content was deleted; `data` identifies it and carries none of its content.

Collection `whatsapp.dm.reactions`. `data` identifies the deleted item and carries none of its content.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `target` | `object` | yes | The message reacted to. |
| `containerId` | `string` | yes | The 1:1 conversation of the message reacted to: the person's BSUID, as its messages' `containerId` names it. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `kind` | `"whatsapp.dm.reactions"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.whatsapp.dm.reactions.deleted"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "target",
        "containerId",
        "externalId",
        "kind"
      ],
      "properties": {
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "whatsapp.dm.messages"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The message reacted to."
        },
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The 1:1 conversation of the message reacted to: the person's BSUID, as its messages' `containerId` names it."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "const": "whatsapp.dm.reactions",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false,
      "description": "What a deletion carries: the deleted item's identity, its relations and whether the observing profile wrote it, never its content."
    }
  },
  "additionalProperties": false
}
```

### `content.whatsapp.dm.reactions.updated`

Normalized `updated` event for `whatsapp.dm.reactions` content.

Collection `whatsapp.dm.reactions`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `target` | `object` | yes | The message reacted to. |
| `containerId` | `string` | yes | The 1:1 conversation of the message reacted to: the person's BSUID, as its messages' `containerId` names it. |
| `emoji` | `string` | no | The emoji reacted with, as the platform sent it. |
| `author` | `object` | yes | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `authorPhoneNumber` | `string` | no | The person's phone number in E.164 digits, present only when Meta shares it: when the business messaged or called that number, or was messaged or called from it, in the last 30 days, or has it in its contacts. Never a key: it can be absent on one message and present on the next, so identify the person by their BSUID. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"whatsapp.dm.reactions"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.whatsapp.dm.reactions.updated"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "target",
        "containerId",
        "author",
        "externalId",
        "kind"
      ],
      "properties": {
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "whatsapp.dm.messages"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The message reacted to."
        },
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The 1:1 conversation of the message reacted to: the person's BSUID, as its messages' `containerId` names it."
        },
        "emoji": {
          "type": "string",
          "minLength": 1,
          "description": "The emoji reacted with, as the platform sent it."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "authorPhoneNumber": {
          "type": "string",
          "minLength": 1,
          "description": "The person's phone number in E.164 digits, present only when Meta shares it: when the business messaged or called that number, or was messaged or called from it, in the last 30 days, or has it in its contacts. Never a key: it can be absent on one message and present on the next, so identify the person by their BSUID."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "whatsapp.dm.reactions",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.whatsapp.dm.statuses.created`

Normalized `created` event for `whatsapp.dm.statuses` content.

Collection `whatsapp.dm.statuses`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `containerId` | `string` | yes | The conversation of the message this status reports on: the recipient's business-scoped user id (BSUID), as that conversation's messages name it. |
| `target` | `object` | yes | The outbound message this status reports on, by the `externalId` its publish request returned. |
| `status` | `"sent" \| "delivered" \| "read" \| "played" \| "failed" \| "other"` | yes | The delivery state this status reports. `other` is a state Meta added that Koil does not model yet. |
| `recipient` | `object` | yes | Platform actor reference for observed content. |
| `recipientPhoneNumber` | `string` | no | The person's phone number in E.164 digits, present only when Meta shares it: when the business messaged or called that number, or was messaged or called from it, in the last 30 days, or has it in its contacts. Never a key: it can be absent on one message and present on the next, so identify the person by their BSUID. |
| `occurredAt` | `string (date-time)` | no |  |
| `conversation` | `object` | no |  |
| `pricing` | `object` | no |  |
| `errors` | `object[]` | no |  |
| `callbackData` | `string` | no |  |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"whatsapp.dm.statuses"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.whatsapp.dm.statuses.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "containerId",
        "target",
        "status",
        "recipient",
        "kind"
      ],
      "properties": {
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The conversation of the message this status reports on: the recipient's business-scoped user id (BSUID), as that conversation's messages name it."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "whatsapp.dm.messages"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The outbound message this status reports on, by the `externalId` its publish request returned."
        },
        "status": {
          "enum": [
            "sent",
            "delivered",
            "read",
            "played",
            "failed",
            "other"
          ],
          "description": "The delivery state this status reports. `other` is a state Meta added that Koil does not model yet."
        },
        "recipient": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "recipientPhoneNumber": {
          "type": "string",
          "minLength": 1,
          "description": "The person's phone number in E.164 digits, present only when Meta shares it: when the business messaged or called that number, or was messaged or called from it, in the last 30 days, or has it in its contacts. Never a key: it can be absent on one message and present on the next, so identify the person by their BSUID."
        },
        "occurredAt": {
          "type": "string",
          "format": "date-time"
        },
        "conversation": {
          "type": "object",
          "required": [
            "id"
          ],
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1
            },
            "originType": {
              "enum": [
                "service",
                "marketing",
                "marketing_lite",
                "utility",
                "authentication",
                "authentication_international",
                "referral_conversion",
                "other"
              ],
              "description": "Meta's category for the conversation or message (`referral_conversion` is legacy); `other` is one Meta added that Koil does not model."
            },
            "expiresAt": {
              "type": "string",
              "format": "date-time"
            }
          },
          "additionalProperties": false
        },
        "pricing": {
          "type": "object",
          "properties": {
            "billable": {
              "type": "boolean"
            },
            "model": {
              "enum": [
                "pmp",
                "cbp",
                "other"
              ],
              "description": "`pmp` (per-message) or the legacy `cbp` (per-conversation); `other` is one Meta added that Koil does not model."
            },
            "type": {
              "enum": [
                "regular",
                "free_customer_service",
                "free_entry_point",
                "other"
              ],
              "description": "`regular`, `free_customer_service`, or `free_entry_point`; `other` is one Meta added that Koil does not model."
            },
            "category": {
              "enum": [
                "service",
                "marketing",
                "marketing_lite",
                "utility",
                "authentication",
                "authentication_international",
                "referral_conversion",
                "other"
              ],
              "description": "Meta's category for the conversation or message (`referral_conversion` is legacy); `other` is one Meta added that Koil does not model."
            }
          },
          "additionalProperties": false
        },
        "errors": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "code"
            ],
            "properties": {
              "code": {
                "type": "number"
              },
              "title": {
                "type": "string",
                "minLength": 1
              },
              "message": {
                "type": "string",
                "minLength": 1
              },
              "details": {
                "type": "string",
                "minLength": 1
              }
            },
            "additionalProperties": false
          }
        },
        "callbackData": {
          "type": "string",
          "minLength": 1
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "whatsapp.dm.statuses",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.whatsapp.groups.conversations.created`

Normalized `created` event for `whatsapp.groups.conversations` content.

Collection `whatsapp.groups.conversations`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `counterpart` | `object` | no | The person the account is talking to in a 1:1 conversation. A group chat has none. |
| `messageRequest` | `boolean` | no | Whether the conversation is still a message request: the person wrote and the account has not replied yet. Absent when the read or event did not say. |
| `updatedAt` | `string (date-time)` | no | When the conversation last changed, as the platform reports it. |
| `externalId` | `string` | yes | The group's id: the `containerId` its messages carry, which a group send takes. |
| `subject` | `string` | no | The group's name. |
| `description` | `string` | no | The group's description. Read by `get`; an event carries it only when it changed. |
| `participants` | `object[]` | no | The people in the group, not counting the business, each keyed by BSUID as a group message's `author` is. Read by `get` only. |
| `participantCount` | `integer` | no | How many people are in the group, not counting the business. Read by `get` only. |
| `joinApprovalMode` | `"approval_required" \| "auto_approve" \| "other"` | no | Whether a person who opens the group's invite link needs the business's approval to join (`approval_required`) or joins at once (`auto_approve`). Read by `get`, and carried by the `created` event. |
| `suspended` | `boolean` | no | Whether WhatsApp has suspended the group, which stops activity in it. Read by `get`, and carried by the `updated` event of a suspension or its lifting. |
| `createdAt` | `string (date-time)` | no | When the group was created. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"whatsapp.groups.conversations"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.whatsapp.groups.conversations.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "kind"
      ],
      "properties": {
        "counterpart": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The person the account is talking to in a 1:1 conversation. A group chat has none."
        },
        "messageRequest": {
          "type": "boolean",
          "description": "Whether the conversation is still a message request: the person wrote and the account has not replied yet. Absent when the read or event did not say."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the conversation last changed, as the platform reports it."
        },
        "externalId": {
          "type": "string",
          "description": "The group's id: the `containerId` its messages carry, which a group send takes.",
          "minLength": 1
        },
        "subject": {
          "type": "string",
          "minLength": 1,
          "description": "The group's name."
        },
        "description": {
          "type": "string",
          "minLength": 1,
          "description": "The group's description. Read by `get`; an event carries it only when it changed."
        },
        "participants": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "externalId"
            ],
            "properties": {
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the account; matching and joining always use it."
              },
              "displayName": {
                "type": "string",
                "minLength": 1
              },
              "username": {
                "type": "string",
                "minLength": 1
              },
              "avatarUrl": {
                "type": "string",
                "format": "uri",
                "description": "The author's profile picture, as the platform serves it.",
                "minLength": 1,
                "pattern": "^https?://"
              }
            },
            "additionalProperties": false,
            "description": "Platform actor reference for observed content."
          },
          "description": "The people in the group, not counting the business, each keyed by BSUID as a group message's `author` is. Read by `get` only."
        },
        "participantCount": {
          "type": "integer",
          "minimum": 0,
          "description": "How many people are in the group, not counting the business. Read by `get` only."
        },
        "joinApprovalMode": {
          "enum": [
            "approval_required",
            "auto_approve",
            "other"
          ],
          "description": "Whether a person who opens the group's invite link needs the business's approval to join (`approval_required`) or joins at once (`auto_approve`). Read by `get`, and carried by the `created` event."
        },
        "suspended": {
          "type": "boolean",
          "description": "Whether WhatsApp has suspended the group, which stops activity in it. Read by `get`, and carried by the `updated` event of a suspension or its lifting."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the group was created."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "whatsapp.groups.conversations",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.whatsapp.groups.conversations.deleted`

`whatsapp.groups.conversations` content was deleted; `data` identifies it and carries none of its content.

Collection `whatsapp.groups.conversations`. `data` identifies the deleted item and carries none of its content.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `externalId` | `string` | yes | The group's id: the `containerId` its messages carry, which a group send takes. |
| `kind` | `"whatsapp.groups.conversations"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.whatsapp.groups.conversations.deleted"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "kind"
      ],
      "properties": {
        "externalId": {
          "type": "string",
          "description": "The group's id: the `containerId` its messages carry, which a group send takes.",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "const": "whatsapp.groups.conversations",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false,
      "description": "What a deletion carries: the deleted item's identity, its relations and whether the observing profile wrote it, never its content."
    }
  },
  "additionalProperties": false
}
```

### `content.whatsapp.groups.conversations.updated`

Normalized `updated` event for `whatsapp.groups.conversations` content.

Collection `whatsapp.groups.conversations`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `counterpart` | `object` | no | The person the account is talking to in a 1:1 conversation. A group chat has none. |
| `messageRequest` | `boolean` | no | Whether the conversation is still a message request: the person wrote and the account has not replied yet. Absent when the read or event did not say. |
| `updatedAt` | `string (date-time)` | no | When the conversation last changed, as the platform reports it. |
| `externalId` | `string` | yes | The group's id: the `containerId` its messages carry, which a group send takes. |
| `subject` | `string` | no | The group's name. |
| `description` | `string` | no | The group's description. Read by `get`; an event carries it only when it changed. |
| `participants` | `object[]` | no | The people in the group, not counting the business, each keyed by BSUID as a group message's `author` is. Read by `get` only. |
| `participantCount` | `integer` | no | How many people are in the group, not counting the business. Read by `get` only. |
| `joinApprovalMode` | `"approval_required" \| "auto_approve" \| "other"` | no | Whether a person who opens the group's invite link needs the business's approval to join (`approval_required`) or joins at once (`auto_approve`). Read by `get`, and carried by the `created` event. |
| `suspended` | `boolean` | no | Whether WhatsApp has suspended the group, which stops activity in it. Read by `get`, and carried by the `updated` event of a suspension or its lifting. |
| `createdAt` | `string (date-time)` | no | When the group was created. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"whatsapp.groups.conversations"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.whatsapp.groups.conversations.updated"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "kind"
      ],
      "properties": {
        "counterpart": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The person the account is talking to in a 1:1 conversation. A group chat has none."
        },
        "messageRequest": {
          "type": "boolean",
          "description": "Whether the conversation is still a message request: the person wrote and the account has not replied yet. Absent when the read or event did not say."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the conversation last changed, as the platform reports it."
        },
        "externalId": {
          "type": "string",
          "description": "The group's id: the `containerId` its messages carry, which a group send takes.",
          "minLength": 1
        },
        "subject": {
          "type": "string",
          "minLength": 1,
          "description": "The group's name."
        },
        "description": {
          "type": "string",
          "minLength": 1,
          "description": "The group's description. Read by `get`; an event carries it only when it changed."
        },
        "participants": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "externalId"
            ],
            "properties": {
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the account; matching and joining always use it."
              },
              "displayName": {
                "type": "string",
                "minLength": 1
              },
              "username": {
                "type": "string",
                "minLength": 1
              },
              "avatarUrl": {
                "type": "string",
                "format": "uri",
                "description": "The author's profile picture, as the platform serves it.",
                "minLength": 1,
                "pattern": "^https?://"
              }
            },
            "additionalProperties": false,
            "description": "Platform actor reference for observed content."
          },
          "description": "The people in the group, not counting the business, each keyed by BSUID as a group message's `author` is. Read by `get` only."
        },
        "participantCount": {
          "type": "integer",
          "minimum": 0,
          "description": "How many people are in the group, not counting the business. Read by `get` only."
        },
        "joinApprovalMode": {
          "enum": [
            "approval_required",
            "auto_approve",
            "other"
          ],
          "description": "Whether a person who opens the group's invite link needs the business's approval to join (`approval_required`) or joins at once (`auto_approve`). Read by `get`, and carried by the `created` event."
        },
        "suspended": {
          "type": "boolean",
          "description": "Whether WhatsApp has suspended the group, which stops activity in it. Read by `get`, and carried by the `updated` event of a suspension or its lifting."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the group was created."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "whatsapp.groups.conversations",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.whatsapp.groups.messages.created`

Normalized `created` event for `whatsapp.groups.messages` content.

Collection `whatsapp.groups.messages`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | yes | The conversation: the same on every message in it, on reads and events alike, so an inbox groups by it. It is TikTok's conversation id, a WhatsApp group's id, and in a 1:1 chat on Instagram, Facebook or WhatsApp the counterpart's own id, since Meta's messaging webhooks carry no conversation id. |
| `target` | `object` | no | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | yes | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `choice` | `object` | no | The option the person picked instead of typing: a quick reply, a button or a list row a message offered, or one of the account's ice breakers. Its label is the message's `text`, and the message that offered it is `target` where the platform names it. Present where the platform reports the tap, which on Instagram and Messenger is the message's event only: a read of the same message returns its `text` without `choice`. Absent too when the platform withholds the payload (Meta sends a postback's payload only to the app that sent the button), so such a tap reads as typed text. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `variant` | `"text" \| "image" \| "video" \| "audio" \| "document" \| "sticker" \| "location" \| "contacts" \| "interactive" \| "button" \| "referral" \| "order" \| "system" \| "unsupported" \| "other"` | yes | The Cloud API message `type`. Media types carry one `attachments` entry; `location` carries `location`; `unsupported` is a type the Cloud API cannot deliver (e.g. a poll); `other` is a type Meta added that Koil does not model yet. |
| `authorPhoneNumber` | `string` | no | The person's phone number in E.164 digits, present only when Meta shares it: when the business messaged or called that number, or was messaged or called from it, in the last 30 days, or has it in its contacts. Never a key: it can be absent on one message and present on the next, so identify the person by their BSUID. |
| `location` | `object` | no | Geographic place reference for content. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"whatsapp.groups.messages"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.whatsapp.groups.messages.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "containerId",
        "author",
        "externalId",
        "variant",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The conversation: the same on every message in it, on reads and events alike, so an inbox groups by it. It is TikTok's conversation id, a WhatsApp group's id, and in a 1:1 chat on Instagram, Facebook or WhatsApp the counterpart's own id, since Meta's messaging webhooks carry no conversation id."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "whatsapp.groups.messages"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "choice": {
          "type": "object",
          "required": [
            "payload"
          ],
          "properties": {
            "payload": {
              "type": "string",
              "minLength": 1,
              "description": "The value the account set on the option when it offered it (a quick reply's, postback button's or ice breaker's `payload`, a reply button's or list row's id), so a consumer tells options apart by it rather than by their labels."
            }
          },
          "additionalProperties": false,
          "description": "The option the person picked instead of typing: a quick reply, a button or a list row a message offered, or one of the account's ice breakers. Its label is the message's `text`, and the message that offered it is `target` where the platform names it. Present where the platform reports the tap, which on Instagram and Messenger is the message's event only: a read of the same message returns its `text` without `choice`. Absent too when the platform withholds the payload (Meta sends a postback's payload only to the app that sent the button), so such a tap reads as typed text."
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "variant": {
          "enum": [
            "text",
            "image",
            "video",
            "audio",
            "document",
            "sticker",
            "location",
            "contacts",
            "interactive",
            "button",
            "referral",
            "order",
            "system",
            "unsupported",
            "other"
          ],
          "description": "The Cloud API message `type`. Media types carry one `attachments` entry; `location` carries `location`; `unsupported` is a type the Cloud API cannot deliver (e.g. a poll); `other` is a type Meta added that Koil does not model yet."
        },
        "authorPhoneNumber": {
          "type": "string",
          "minLength": 1,
          "description": "The person's phone number in E.164 digits, present only when Meta shares it: when the business messaged or called that number, or was messaged or called from it, in the last 30 days, or has it in its contacts. Never a key: it can be absent on one message and present on the next, so identify the person by their BSUID."
        },
        "location": {
          "type": "object",
          "properties": {
            "locationId": {
              "type": "string",
              "minLength": 1
            },
            "name": {
              "type": "string",
              "minLength": 1
            },
            "lat": {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            },
            "lng": {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            }
          },
          "additionalProperties": false,
          "description": "Geographic place reference for content."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "whatsapp.groups.messages",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.whatsapp.groups.statuses.created`

Normalized `created` event for `whatsapp.groups.statuses` content.

Collection `whatsapp.groups.statuses`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `containerId` | `string` | yes | The group the message this status reports on went to, as the group's messages name it. |
| `target` | `object` | yes | The outbound message this status reports on, by the `externalId` its publish request returned. |
| `status` | `"sent" \| "delivered" \| "read" \| "played" \| "failed" \| "other"` | yes | The delivery state this status reports. `other` is a state Meta added that Koil does not model yet. |
| `recipient` | `object` | no | Platform actor reference for observed content. |
| `occurredAt` | `string (date-time)` | no |  |
| `conversation` | `object` | no |  |
| `pricing` | `object` | no |  |
| `errors` | `object[]` | no |  |
| `callbackData` | `string` | no |  |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"whatsapp.groups.statuses"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.whatsapp.groups.statuses.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "containerId",
        "target",
        "status",
        "kind"
      ],
      "properties": {
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The group the message this status reports on went to, as the group's messages name it."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "whatsapp.groups.messages"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The outbound message this status reports on, by the `externalId` its publish request returned."
        },
        "status": {
          "enum": [
            "sent",
            "delivered",
            "read",
            "played",
            "failed",
            "other"
          ],
          "description": "The delivery state this status reports. `other` is a state Meta added that Koil does not model yet."
        },
        "recipient": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "occurredAt": {
          "type": "string",
          "format": "date-time"
        },
        "conversation": {
          "type": "object",
          "required": [
            "id"
          ],
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1
            },
            "originType": {
              "enum": [
                "service",
                "marketing",
                "marketing_lite",
                "utility",
                "authentication",
                "authentication_international",
                "referral_conversion",
                "other"
              ],
              "description": "Meta's category for the conversation or message (`referral_conversion` is legacy); `other` is one Meta added that Koil does not model."
            },
            "expiresAt": {
              "type": "string",
              "format": "date-time"
            }
          },
          "additionalProperties": false
        },
        "pricing": {
          "type": "object",
          "properties": {
            "billable": {
              "type": "boolean"
            },
            "model": {
              "enum": [
                "pmp",
                "cbp",
                "other"
              ],
              "description": "`pmp` (per-message) or the legacy `cbp` (per-conversation); `other` is one Meta added that Koil does not model."
            },
            "type": {
              "enum": [
                "regular",
                "free_customer_service",
                "free_entry_point",
                "other"
              ],
              "description": "`regular`, `free_customer_service`, or `free_entry_point`; `other` is one Meta added that Koil does not model."
            },
            "category": {
              "enum": [
                "service",
                "marketing",
                "marketing_lite",
                "utility",
                "authentication",
                "authentication_international",
                "referral_conversion",
                "other"
              ],
              "description": "Meta's category for the conversation or message (`referral_conversion` is legacy); `other` is one Meta added that Koil does not model."
            }
          },
          "additionalProperties": false
        },
        "errors": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "code"
            ],
            "properties": {
              "code": {
                "type": "number"
              },
              "title": {
                "type": "string",
                "minLength": 1
              },
              "message": {
                "type": "string",
                "minLength": 1
              },
              "details": {
                "type": "string",
                "minLength": 1
              }
            },
            "additionalProperties": false
          }
        },
        "callbackData": {
          "type": "string",
          "minLength": 1
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "whatsapp.groups.statuses",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.youtube.videos.comments.created`

Normalized `created` event for `youtube.videos.comments` content.

Collection `youtube.videos.comments`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | `string` | no | The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none. |
| `target` | `object` | yes | The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to. |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `author` | `object` | no | Platform actor reference for observed content. |
| `ownerAuthored` | `boolean` | no | Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did. |
| `attachments` | `unknown \| unknown \| unknown[]` | no |  |
| `hidden` | `boolean` | no | Whether the account hid the comment from the public. Absent when the platform did not say. |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `updatedAt` | `string (date-time)` | no | When the platform last updated it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `moderationStatus` | `"published" \| "held_for_review" \| "likely_spam" \| "rejected" \| "other"` | no | YouTube's moderation state of a comment. `other` is a state YouTube added that Koil does not model yet. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"youtube.videos.comments"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.youtube.videos.comments.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "target",
        "externalId",
        "kind"
      ],
      "properties": {
        "containerId": {
          "type": "string",
          "minLength": 1,
          "description": "The place the item was published into and lives in: the post or video a comment is on, or the conversation a message is in. Every item in the same place has the same `containerId`, replies to replies included. A post in the account has none."
        },
        "target": {
          "type": "object",
          "required": [
            "kind",
            "externalId"
          ],
          "properties": {
            "kind": {
              "enum": [
                "youtube.videos.posts",
                "youtube.videos.comments"
              ]
            },
            "externalId": {
              "type": "string",
              "description": "Platform-owned content identifier.",
              "minLength": 1
            },
            "permalink": {
              "type": "string",
              "format": "uri",
              "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "The one thing on the platform this item directly responds to: a comment's post, or the comment it replies to; a message's quoted or replied-to message, story or comment; what a reaction reacts to. Absent when the platform reports nothing it responds to."
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "author": {
          "type": "object",
          "required": [
            "externalId"
          ],
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "description": "The platform's id for the account; matching and joining always use it."
            },
            "displayName": {
              "type": "string",
              "minLength": 1
            },
            "username": {
              "type": "string",
              "minLength": 1
            },
            "avatarUrl": {
              "type": "string",
              "format": "uri",
              "description": "The author's profile picture, as the platform serves it.",
              "minLength": 1,
              "pattern": "^https?://"
            }
          },
          "additionalProperties": false,
          "description": "Platform actor reference for observed content."
        },
        "ownerAuthored": {
          "type": "boolean",
          "description": "Whether the Profile's own account wrote it. Absent when Koil cannot tell, which does not mean someone else did."
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "file",
                  "other"
                ],
                "description": "The file's class, not what the message is: a sticker is an `image`. `file` is a file the platform identifies that is not an image, video, or audio, such as a document; `other` is one whose type the platform does not say."
              },
              "externalId": {
                "type": "string",
                "minLength": 1,
                "description": "The platform's id for the file. It is scoped to the item: resolving it may also need the item's `externalId` and `containerId`."
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The file as the platform serves it. Absent where the platform gives only an id.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the file, such as a video's preview.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "contentType": {
                "type": "string",
                "minLength": 1,
                "description": "The media type, as the platform reports it, parameters included (`audio/ogg; codecs=opus`): compare its `type/subtype` part."
              },
              "filename": {
                "type": "string",
                "minLength": 1,
                "description": "The file name, as the platform reports it."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "externalId"
                ]
              },
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "thumbnailUrl"
                ]
              }
            ],
            "description": "A file carried by a message, comment, or review. Platform URLs are signed and expire, so fetch rather than store them. Where `url` is absent and `externalId` is present, get a URL from the collection's `GET /v1/profiles/{profileId}/content/{collection}/{externalId}/attachments/{attachmentExternalId}`; one with only a `thumbnailUrl` has no other file to fetch."
          }
        },
        "hidden": {
          "type": "boolean",
          "description": "Whether the account hid the comment from the public. Absent when the platform did not say."
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform last updated it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "moderationStatus": {
          "enum": [
            "published",
            "held_for_review",
            "likely_spam",
            "rejected",
            "other"
          ],
          "description": "YouTube's moderation state of a comment. `other` is a state YouTube added that Koil does not model yet."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "youtube.videos.comments",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```

### `content.youtube.videos.posts.created`

Normalized `created` event for `youtube.videos.posts` content.

Collection `youtube.videos.posts`. `data` is the collection's own schema — the same shape content reads return for it.

#### `context`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `string` | yes |  |
| `mode` | `"live" \| "sandbox"` | yes | Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure. |
| `profileId` | `string` | yes | The Profile that observed the content. |
| `platformProfileExternalId` | `string` | yes | The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this. |
| `platformId` | `string` | yes |  |
| `collection` | `string` | yes | The canonical `{platform}.{surface}.{resource}` identifier. |

#### `data`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `references` | `object[]` | no |  |
| `text` | `string` | no | Caption/body text for content. |
| `media` | `object[]` | no |  |
| `engagement` | `object` | no | Platform-reported engagement counts. |
| `permalink` | `string (uri)` | no | The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired. |
| `publishedAt` | `string (date-time)` | no | When the platform published it. |
| `externalId` | `string` | yes | Platform-owned content identifier. |
| `title` | `string` | yes |  |
| `tags` | `string[]` | no |  |
| `privacyStatus` | `"public" \| "private" \| "unlisted" \| "other"` | no | Who can see the video. `other` is a setting YouTube added that Koil does not model yet. |
| `aspectRatio` | `number` | no |  |
| `uploadStatus` | `"uploaded" \| "processed" \| "failed" \| "rejected" \| "deleted" \| "other"` | no | `uploaded` until YouTube has processed the file, then `processed`; `failed`, `rejected`, or `deleted` otherwise. `other` is a state YouTube added that Koil does not model yet. |
| `liveBroadcast` | `"none" \| "live" \| "upcoming" \| "other"` | no | `live` or `upcoming` while the video is a broadcast; `none` for an ordinary upload. |
| `madeForKids` | `boolean` | no |  |
| `durationSeconds` | `number` | no |  |
| `scheduledPublishAt` | `string (date-time)` | no | When a private video is scheduled to go public. |
| `platformRaw` | `unknown` | no | Optional platform-native payload included only for transient delivery/debug use. |
| `kind` | `"youtube.videos.posts"` | yes | The collection that delivered this item. |

Envelope JSON Schema

```json
{
  "type": "object",
  "required": [
    "id",
    "topic",
    "time",
    "apiVersion",
    "context",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable dedupe id for this logical event (`evt_…`).",
      "pattern": "^evt_[0-9a-f]{40}$"
    },
    "topic": {
      "type": "string",
      "const": "content.youtube.videos.posts.created"
    },
    "time": {
      "type": "string",
      "description": "When the event occurred (RFC 3339).",
      "format": "date-time"
    },
    "apiVersion": {
      "type": "string",
      "description": "The API version this event is rendered in: its destination's `apiVersion`.",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "context": {
      "type": "object",
      "required": [
        "organizationId",
        "mode",
        "profileId",
        "platformProfileExternalId",
        "platformId",
        "collection"
      ],
      "properties": {
        "organizationId": {
          "type": "string",
          "minLength": 1
        },
        "mode": {
          "enum": [
            "live",
            "sandbox"
          ],
          "description": "Which mode produced the event. Sandbox events come from emulated platforms and never reach live infrastructure."
        },
        "profileId": {
          "type": "string",
          "minLength": 1,
          "description": "The Profile that observed the content."
        },
        "platformProfileExternalId": {
          "type": "string",
          "minLength": 1,
          "description": "The observing profile's platform-namespace id. Whether the profile wrote the item is `data.ownerAuthored`; some platforms' author ids are not comparable with this."
        },
        "platformId": {
          "type": "string",
          "minLength": 1
        },
        "collection": {
          "type": "string",
          "minLength": 1,
          "description": "The canonical `{platform}.{surface}.{resource}` identifier."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "required": [
        "externalId",
        "title",
        "kind"
      ],
      "properties": {
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "target"
            ],
            "properties": {
              "type": {
                "enum": [
                  "mention",
                  "embed",
                  "link"
                ],
                "description": "How the item uses its target: `mention`, its text names an account; `embed`, it carries other content inside it, such as a quote post or a shared post; `link`, it shows a link card for a URL."
              },
              "target": {
                "type": "object",
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform's id for the thing pointed at; matching and joining always use it."
                  },
                  "kind": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The collection the pointing item's platform data places the thing in. Absent when the thing is an account, or when the platform does not say."
                  },
                  "permalink": {
                    "type": "string",
                    "format": "uri",
                    "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
                    "minLength": 1,
                    "pattern": "^https?://"
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "externalId"
                    ]
                  },
                  {
                    "required": [
                      "permalink"
                    ]
                  }
                ],
                "description": "One thing on the platform outside this item: content, an account, or anything else the platform gives an id or a URL."
              },
              "span": {
                "type": "object",
                "required": [
                  "start",
                  "length"
                ],
                "properties": {
                  "start": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "length": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "additionalProperties": false,
                "description": "The part of `text` the reference occupies, in UTF-16 code units. Absent when the reference is not in the text or the platform gives no position."
              }
            },
            "additionalProperties": false,
            "description": "Something the item's text or body points at that exists apart from it, in text order."
          }
        },
        "text": {
          "type": "string",
          "description": "Caption/body text for content."
        },
        "media": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "image",
                  "video",
                  "other"
                ]
              },
              "url": {
                "type": "string",
                "format": "uri",
                "description": "The asset itself, when the platform serves it.",
                "minLength": 1,
                "pattern": "^https?://"
              },
              "thumbnailUrl": {
                "type": "string",
                "format": "uri",
                "description": "A still image of the asset, such as a video's cover.",
                "minLength": 1,
                "pattern": "^https?://"
              }
            },
            "additionalProperties": false,
            "description": "An image or video the post published. Platform URLs are often signed and expire, so fetch rather than store them."
          }
        },
        "engagement": {
          "type": "object",
          "properties": {
            "views": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was viewed."
            },
            "likes": {
              "type": "number",
              "minimum": 0,
              "description": "Likes, favourites, or reactions on the content."
            },
            "comments": {
              "type": "number",
              "minimum": 0,
              "description": "Comments or replies on the content."
            },
            "shares": {
              "type": "number",
              "minimum": 0,
              "description": "Times the content was shared or reposted."
            }
          },
          "additionalProperties": false,
          "description": "Platform-reported engagement counts."
        },
        "permalink": {
          "type": "string",
          "format": "uri",
          "description": "The thing's URL on the platform, for display and linking only, never as a key. It may point at something private or expired.",
          "minLength": 1,
          "pattern": "^https?://"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the platform published it."
        },
        "externalId": {
          "type": "string",
          "description": "Platform-owned content identifier.",
          "minLength": 1
        },
        "title": {
          "type": "string"
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "privacyStatus": {
          "enum": [
            "public",
            "private",
            "unlisted",
            "other"
          ],
          "description": "Who can see the video. `other` is a setting YouTube added that Koil does not model yet."
        },
        "aspectRatio": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "uploadStatus": {
          "enum": [
            "uploaded",
            "processed",
            "failed",
            "rejected",
            "deleted",
            "other"
          ],
          "description": "`uploaded` until YouTube has processed the file, then `processed`; `failed`, `rejected`, or `deleted` otherwise. `other` is a state YouTube added that Koil does not model yet."
        },
        "liveBroadcast": {
          "enum": [
            "none",
            "live",
            "upcoming",
            "other"
          ],
          "description": "`live` or `upcoming` while the video is a broadcast; `none` for an ordinary upload."
        },
        "madeForKids": {
          "type": "boolean"
        },
        "durationSeconds": {
          "type": "number",
          "minimum": 0
        },
        "scheduledPublishAt": {
          "type": "string",
          "format": "date-time",
          "description": "When a private video is scheduled to go public."
        },
        "platformRaw": {
          "description": "Optional platform-native payload included only for transient delivery/debug use."
        },
        "kind": {
          "type": "string",
          "const": "youtube.videos.posts",
          "description": "The collection that delivered this item."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```
