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

# User deleted webhook

> Receive a JSON payload at your own URL when a user is deleted from your Zapnito community, including their name and email.

Subscribe a URL of your choosing to be notified when a user is deleted from your community. Before you start, read the [webhooks overview](/webhooks/overview) for how subscriptions and authentication work.

<Note>The payload still includes the deleted user's name, email address and professional registration number. See [payload conventions](/webhooks/overview#payload-conventions) for how to handle personal data.</Note>

## Payload

When you subscribe to the User deleted webhook, your URL is sent a JSON payload with details of the event.

### Request headers

```text title="Headers sent to your URL" theme={null}
Accept: application/json
X-Zapnito-Hostname: community.acme.org
Authorization: Token token=YOUR_ENDPOINT_TOKEN
```

* `X-Zapnito-Hostname` is the hostname of the Zapnito community that sent the event.
* `Authorization` is only sent if you set an `authorization_token` when you created the subscription.

### Example payload

<ResponseExample>
  ```json title="User deleted payload" theme={null}
  {
    "name": "Jordan Lee",
    "email": "jordan.lee@example.com",
    "professional_reg_number": "DEF456"
  }
  ```
</ResponseExample>

## Create a subscription

<ParamField header="Authorization" type="string" required>
  Your API token in the format `Token token=YOUR_API_TOKEN`.
</ParamField>

<ParamField body="url" type="string" required>
  The URL you want Zapnito to notify when a user is deleted from your community.
</ParamField>

<ParamField body="authorization_token" type="string">
  A token that Zapnito sends in the `Authorization` header of each request to your URL, in the format `Token token=YOUR_ENDPOINT_TOKEN`.
</ParamField>

```bash title="Create a subscription" theme={null}
curl -X POST https://your-community.zapnito.com/api/v1/rest_hooks/user_deleted/subscriptions \
  -H "Authorization: Token token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/webhooks/user-deleted", "authorization_token": "YOUR_ENDPOINT_TOKEN"}'
```

`POST https://your-community.zapnito.com/api/v1/rest_hooks/user_deleted/subscriptions`

* `201 Created`: the subscription was created. The response body is `{"id": "27"}`. Keep the `id` so you can delete the subscription later.

## Delete a subscription

Remove a previously registered URL for the User deleted webhook.

<ParamField header="Authorization" type="string" required>
  Your API token in the format `Token token=YOUR_API_TOKEN`.
</ParamField>

<ParamField path="id" type="integer" required>
  The ID of the subscription that was returned when you created it.
</ParamField>

```bash title="Delete a subscription" theme={null}
curl -X DELETE https://your-community.zapnito.com/api/v1/rest_hooks/user_deleted/subscriptions/27 \
  -H "Authorization: Token token=YOUR_API_TOKEN"
```

`DELETE https://your-community.zapnito.com/api/v1/rest_hooks/user_deleted/subscriptions/:id`

* `204 No Content`: the subscription was deleted.
* `404 Not Found`: no subscription matches the provided ID.


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