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

# discount_code.created

Occurs whenever a [discount code is created](/docs/api-reference/discount-codes/create) for a partner.

> [!TIP]
>
> This event is sent when a discount code is created via the API, the dashboard,
> or auto-provisioning when a partner joins a group.
>
> If the discount uses the **custom** provider, listen to this webhook to create
> the corresponding promo code in your own system. For Stripe and
> Shopify discounts, Dub creates the code in the connected provider
> automatically.

## Response body parameters

All webhook payloads follow a consistent top-level structure with
event-specific data nested within the `data` object.

**id** `string`

The event ID.
**event** `string`

The event type that triggered the webhook (e.g., `discount_code.created`).
**createdAt** `string`

ISO 8601 timestamp when the webhook event was created.
**data** `object`

Event-specific data containing detailed information about the event. The
data object for the `discount_code.created` event contains the following
parameters:

**object parameters**

**id** `string`

Unique identifier for the discount code (e.g. `dcode_...`).

**code** `string`

The alphanumeric discount code customers can apply at checkout.

**partnerId** `string`

ID of the partner this discount code is assigned to.

**linkId** `string`

ID of the partner's referral link this discount code is associated with.

**disabledAt** `string | null`

ISO 8601 timestamp when the code was disabled, or `null` if it is
active.

**discount** `object | null`

The discount this code belongs to.

**discount object**

**id** `string`

Unique identifier for the discount.

**amount** `number`

Discount amount. For `percentage` discounts this is the
percent off (e.g. `10` = 10% off). For `flat`
discounts this is the amount in cents (e.g. `500` = \$5.00).

**type** `string`

Discount type: `percentage` or `flat`.

**maxDuration** `number | null`

Maximum duration in months. `0` is one-time,
`null` is lifetime.

**provider** `string`

Discount provider: `stripe`, `shopify`, or
`custom`.

```json Response theme={null}
{
  "id": "evt_KleiO4HBwZFbO1vZLWIPZ2AtX",
  "event": "discount_code.created",
  "createdAt": "2026-08-19T10:48:15.468Z",
  "data": {
    "id": "dcode_1K39DGZG3MHY9RP4PD0AS2C5P",
    "code": "STEVEN10OFF",
    "partnerId": "pn_1K9BZE1K285BSTX4W6MPKXJFZ",
    "linkId": "link_5myDHLqhIQvUmUPjchVygF9R",
    "disabledAt": null,
    "discount": {
      "id": "disc_1KEC01MXC5H50XQMSN83VCW65",
      "amount": 10,
      "type": "percentage",
      "maxDuration": 6,
      "provider": "custom"
    }
  }
}
```


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