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

# Affiliate Events

> Webhook events for affiliate lifecycle changes

Affiliate events are triggered when changes occur to affiliate accounts in your program.

## Events

| Event                 | Description                                   |
| --------------------- | --------------------------------------------- |
| `affiliate.created`   | New affiliate signs up or is manually created |
| `affiliate.confirmed` | Affiliate confirms their email address        |
| `affiliate.updated`   | Affiliate details or status are updated       |
| `affiliate.deleted`   | Affiliate is removed from the program         |

## Payload

<ResponseField name="id" type="string">
  Unique event identifier
</ResponseField>

<ResponseField name="type" type="string">
  Event type (e.g., `affiliate.created`)
</ResponseField>

<ResponseField name="createdAt" type="string">
  ISO 8601 timestamp of when the event occurred
</ResponseField>

<ResponseField name="data" type="object">
  Event payload data.

  <Expandable title="Data Object Properties">
    <ResponseField name="affiliateId" type="string">
      Unique identifier for the affiliate
    </ResponseField>

    <ResponseField name="affiliateProgramId" type="string">
      The program this affiliate belongs to
    </ResponseField>

    <ResponseField name="trackingId" type="string">
      The affiliate's unique tracking/referral code
    </ResponseField>

    <ResponseField name="status" type="string">
      Current status: `PENDING`, `ACTIVE`, `INACTIVE`
    </ResponseField>

    <ResponseField name="email" type="string">
      Affiliate's email address
    </ResponseField>

    <ResponseField name="name" type="string | null">
      Affiliate's display name
    </ResponseField>

    <ResponseField name="externalUserId" type="string | null">
      Customer's external user ID for linking referral users
    </ResponseField>

    <ResponseField name="metadata" type="object | null">
      Custom key-value data stored with the affiliate
    </ResponseField>

    <ResponseField name="groupId" type="string | null">
      Affiliate's group ID
    </ResponseField>
  </Expandable>
</ResponseField>

## Example Payloads

```json affiliate.created theme={null}
{
  "id": "evt_abc123",
  "type": "affiliate.created",
  "createdAt": "2024-01-15T10:30:00.000Z",
  "data": {
    "affiliateId": "aff_xyz789",
    "affiliateProgramId": "prog_abc123",
    "trackingId": "john-doe",
    "status": "PENDING",
    "email": "john@example.com",
    "name": "John Doe",
    "externalUserId": "user_123",
    "metadata": {
      "plan": "pro",
      "signup_source": "landing_page"
    },
    "groupId": "grp_abc123"
  }
}
```

```json affiliate.confirmed theme={null}
{
  "id": "evt_abc123",
  "type": "affiliate.confirmed",
  "createdAt": "2024-01-15T10:30:00.000Z",
  "data": {
    "affiliateId": "aff_xyz789",
    "affiliateProgramId": "prog_abc123",
    "trackingId": "john-doe",
    "status": "ACTIVE",
    "email": "john@example.com",
    "name": "John Doe",
    "externalUserId": "user_123",
    "metadata": {
      "plan": "pro"
    },
    "groupId": "grp_abc123"
  }
}
```

```json affiliate.updated theme={null}
{
  "id": "evt_abc123",
  "type": "affiliate.updated",
  "createdAt": "2024-01-15T10:30:00.000Z",
  "data": {
    "affiliateId": "aff_xyz789",
    "affiliateProgramId": "prog_abc123",
    "trackingId": "john-doe",
    "status": "ACTIVE",
    "email": "john@example.com",
    "name": "John Doe",
    "externalUserId": "user_456",
    "metadata": {
      "plan": "enterprise"
    },
    "groupId": "grp_abc123"
  }
}
```

```json affiliate.deleted theme={null}
{
  "id": "evt_abc123",
  "type": "affiliate.deleted",
  "createdAt": "2024-01-15T10:30:00.000Z",
  "data": {
    "affiliateId": "aff_xyz789",
    "affiliateProgramId": "prog_abc123",
    "trackingId": "john-doe",
    "email": "john@example.com",
    "externalUserId": "user_123",
    "metadata": {
      "plan": "pro"
    }
  }
}
```
