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

# Create Webhook

> Creates a webhook for the chosen events.

#### Scope

```bash theme={null}
write webhooks
```

## What it does

Creates a webhook for the chosen events. The signing `secret` is returned only in this response.

## Use cases

* Receive approved sales in your system
* Automate product delivery

**url** `string` *required*

Public `https://` address that receives the events.

**events** `string[]` *required*

One or more of: `purchase_approved`, `pix_generated`, `purchase_refunded`, `subscription_created`, `subscription_renewed`, `subscription_canceled`, `withdrawal_paid`, `withdrawal_failed`, `affiliate_approved`.

**name** `string`

Name for you to recognize (up to 80 characters). Default: `API`.

## Response

**data** `object`

**fields**

**id** `string\<uuid\>`

Unique identifier.

**name** `string`

**url** `string`

**events** `string[]`

Subscribed events.

**active** `boolean`

Whether it receives deliveries.

**created\_at** `string\<date-time\>`

When it was created.

**secret** `string`

Signing secret (`whsec_…`). Only appears here.

## Errors

| Status | Description |
| - | - |
| `400` | `invalid_url` (must be public https) or `invalid_events`. |
| `401` | Invalid or revoked key. |
| `403` | Missing scopes (`insufficient_scope`). |
| `429` | Rate limit exceeded (`rate_limited`). |

```bash cURL theme={null}
curl --request POST \
  --url https://ucsyxzpdbnuyehizezvb.supabase.co/functions/v1/doglytdc-pay/v1/webhooks \
  -u "$DPAY_CLIENT_ID:$DPAY_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://minhaloja.com/webhooks/doglytdc","events":["purchase_approved"]}'
```

```json 201 theme={null}
{
  "data": {
    "id": "c7d8e9f0-1a2b-4c3d-8e9f-0a1b2c3d4e5f",
    "name": "Minha loja",
    "url": "https://minhaloja.com/webhooks/doglytdc",
    "events": [
      "purchase_approved"
    ],
    "active": true,
    "created_at": "2026-11-06T18:10:00Z"
  },
  "secret": "whsec_8f3b…"
}
```

```json 401 theme={null}
{ "error": "unauthorized", "message": "Chave de API inválida." }
```

```json 403 theme={null}
{ "error": "insufficient_scope", "message": "Esta chave precisa dos escopos: write, webhooks." }
```


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