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

# React to call events

> Subscribe to a webhook and take action the moment a call ends, instead of polling the API to find out.

Get notified the moment a call ends, instead of polling for it.

**Time required:** \~15 minutes
**You will need:** an API key, and an HTTPS endpoint you control that can receive a `POST`

## Steps

<Steps>
  <Step title="Stand up an endpoint">
    Your endpoint needs to accept a `POST` with a JSON body and respond `2xx` within 10
    seconds. Respond immediately and do any slow work afterward — see [Webhook
    retries and replay](/developers/webhooks/retries-and-replay).
  </Step>

  <Step title="Subscribe to call.hangup">
    ```bash theme={null}
    curl -X POST "https://api.get2dial.com/api/v1/webhooks" \
      -H "Authorization: Bearer <your-api-key>" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "Call ended notifier",
        "url": "https://example.com/webhooks/get2dial",
        "event_types": ["call.hangup"]
      }'
    ```

    The response includes a `secret` — save it now. It's shown exactly once.
  </Step>

  <Step title="Verify the signature on every delivery">
    See [Verify webhook signatures](/developers/webhooks/verify-signatures) — implement this
    before you trust any payload.
  </Step>

  <Step title="Handle the event">
    A `call.hangup` payload looks like this — see the [event
    catalog](/developers/webhooks/event-catalog#callhangup) for the full shape:

    ```json theme={null}
    {
      "tenant_id": "...",
      "call_id": "...",
      "trace_id": "...",
      "hangup_cause": "NORMAL_CLEARING",
      "duration_ms": 125000,
      "timestamp": "2026-08-05T14:32:11Z"
    }
    ```

    Use `call_id` to look up the full record via [Search call detail
    records](/reports/call-detail-records) if you need more than the event carries.
  </Step>
</Steps>

## What you accomplished

Your system now reacts to calls ending in real time, instead of polling CDRs on a schedule.

## Next steps

<CardGroup cols={2}>
  <Card title="Webhook event catalog" href="/developers/webhooks/event-catalog" />

  <Card title="Webhook delivery failures" href="/troubleshooting/webhook-delivery-failures" />
</CardGroup>
