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

# Webhooks

> Send events from Tapfiliate to your systems with trigger webhooks.

Triggers run an action when something happens in your program. A webhook trigger sends a request to your URL, so your systems learn about new affiliates, conversions or commissions without polling the API.

## Events

| Event | Fires when |
| - | - |
| Affiliate created | Someone signs up as an affiliate or is added manually. |
| Affiliate added to program | An affiliate applies to a program or is added to it. |
| Affiliate approved for program | An affiliate is approved, automatically or manually. |
| Affiliate disapproved for program | An affiliate is disapproved for a program. |
| Affiliate added to group | An affiliate is added to an affiliate group. |
| Affiliate prospect created | A recruitment source creates an affiliate prospect. |
| Affiliate prospect promoted | A prospect becomes an affiliate. |
| Conversion created | A conversion is created. |
| Commission created | A commission is created: from a conversion, a recurring or MLM commission, or the API. |
| Commission updated | A commission is approved, disapproved or edited. |
| Customer created | A customer is created. |
| Customer updated | A customer is updated. |
| Payment created | An affiliate's balance is settled. |

Most events have **filters**, so the webhook fires only when conditions match, for example only for one program or only when an affiliate initiated the event. Open **Add filter** in the trigger to see the filters of an event.

## Set up a webhook

<Steps>
  <Step title="Create a trigger">
    Open **Triggers** in your dashboard and click **New trigger**. Choose the event.
  </Step>

  <Step title="Add filters">
    Optional. Narrow down when the trigger fires.
  </Step>

  <Step title="Choose the webhook type">
    * **Webhook** sends the object in the same format as the [API reference](/api-reference/introduction), for example a conversion for *Conversion created*.
    * **Webhook (custom)** lets you compose the request yourself. Use merge tags from the `{…}` menu next to the field to insert event data.
  </Step>

  <Step title="Save">
    The webhook starts firing on the next matching event.
  </Step>
</Steps>

<Tip>
  Track a test conversion after saving, to see the payload arrive at your endpoint.
</Tip>

## Handling webhooks

* Respond with a `2xx` status quickly and do the work asynchronously.
* Make your handler idempotent: use the object's `id` to skip events you have already processed.
* Use the [REST API](/api-reference/introduction) to fetch the current state of an object when you need more than the payload.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.