> ## 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

export const WebhookResponseBodyParameters = ({type, children}) => <div>
    <h2>Response body parameters</h2>
    <p>
      All webhook payloads follow a consistent top-level structure with
      event-specific data nested within the <code>data</code> object.
    </p>
    <ParamField body="id" type="string">
      The event ID.
    </ParamField>
    <ParamField body="event" type="string">
      The event type that triggered the webhook (e.g., <code>{type}</code>).
    </ParamField>
    <ParamField body="createdAt" type="string">
      ISO 8601 timestamp when the webhook event was created.
    </ParamField>
    <ParamField body="data" type="object">
      Event-specific data containing detailed information about the event. The
      data object for the <code>{type}</code> event contains the following
      parameters:
      <Expandable defaultOpen title="object parameters">
        {children}
      </Expandable>
    </ParamField>
  </div>;

Event triggered when a [discount code is created](/docs/api-reference/discount-codes/create).

<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.
</Tip>

<WebhookResponseBodyParameters type="discount_code.created">
  <ParamField body="id" type="string">
    Unique identifier for the discount code (e.g. <code>dcode\_...</code>).
  </ParamField>

  <ParamField body="code" type="string">
    The alphanumeric discount code customers can apply at checkout.
  </ParamField>

  <ParamField body="partnerId" type="string">
    ID of the partner this discount code is assigned to.
  </ParamField>

  <ParamField body="linkId" type="string">
    ID of the partner's referral link this discount code is associated with.
  </ParamField>

  <ParamField body="disabledAt" type="string | null">
    ISO 8601 timestamp when the code was disabled, or <code>null</code> if it is
    active.
  </ParamField>

  <ParamField body="discount" type="object | null">
    The discount this code belongs to.

    <Expandable title="discount object">
      <ParamField body="id" type="string">
        Unique identifier for the discount.
      </ParamField>

      <ParamField body="amount" type="number">
        Discount amount. For <code>percentage</code> discounts this is the
        percent off (e.g. <code>10</code> = 10% off). For <code>flat</code>
        discounts this is the amount in cents (e.g. <code>500</code> = \$5.00).
      </ParamField>

      <ParamField body="type" type="string">
        Discount type: <code>percentage</code> or <code>flat</code>.
      </ParamField>

      <ParamField body="maxDuration" type="number | null">
        Maximum duration in months. <code>0</code> is one-time,
        <code>null</code> is lifetime.
      </ParamField>

      <ParamField body="provider" type="string">
        Discount provider: <code>stripe</code>, <code>shopify</code>, or
        <code>custom</code>.
      </ParamField>
    </Expandable>
  </ParamField>
</WebhookResponseBodyParameters>

<ResponseExample>
  ```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"
      }
    }
  }
  ```
</ResponseExample>
