> ## Documentation Index
> Fetch the complete documentation index at: https://dodopayments-mintlify-external-integration-datafast-autosen.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Webhook

> Create a new webhook for a business.



## OpenAPI

````yaml post /webhooks
openapi: 3.1.0
info:
  title: public
  description: ''
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 1.61.5
servers:
  - url: https://test.dodopayments.com/
    description: Test Mode Server Host
  - url: https://live.dodopayments.com/
    description: Live Mode Server Host
security: []
tags:
  - name: Products
  - name: Payments
  - name: Subscriptions
  - name: Addons
  - name: Customers
  - name: Refunds
  - name: Disputes
  - name: Events
  - name: License Keys
  - name: Licenses
  - name: Discounts
  - name: Meters
  - name: Outgoing Webhooks
  - name: Checkout
  - name: Webhook Events
paths:
  /webhooks:
    post:
      tags:
        - Webhooks
      summary: Create a new webhook
      operationId: create_webhook
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookRequest'
        required: true
      responses:
        '200':
          description: Endpoint created Successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookDetails'
      security:
        - API_KEY: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import DodoPayments from 'dodopayments';

            const client = new DodoPayments({
              bearerToken: 'My Bearer Token',
            });

            const webhookDetails = await client.webhooks.create({ url: 'url' });

            console.log(webhookDetails.id);
        - lang: Python
          source: |-
            from dodopayments import DodoPayments

            client = DodoPayments(
                bearer_token="My Bearer Token",
            )
            webhook_details = client.webhooks.create(
                url="url",
            )
            print(webhook_details.id)
        - lang: Go
          source: |
            package main

            import (
              "context"
              "fmt"

              "github.com/dodopayments/dodopayments-go"
              "github.com/dodopayments/dodopayments-go/option"
            )

            func main() {
              client := dodopayments.NewClient(
                option.WithBearerToken("My Bearer Token"),
              )
              webhookDetails, err := client.Webhooks.New(context.TODO(), dodopayments.WebhookNewParams{
                URL: dodopayments.F("url"),
              })
              if err != nil {
                panic(err.Error())
              }
              fmt.Printf("%+v\n", webhookDetails.ID)
            }
        - lang: Java
          source: |-
            package com.dodopayments.api.example;

            import com.dodopayments.api.client.DodoPaymentsClient;
            import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
            import com.dodopayments.api.models.webhooks.WebhookCreateParams;
            import com.dodopayments.api.models.webhooks.WebhookDetails;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();

                    WebhookCreateParams params = WebhookCreateParams.builder()
                        .url("url")
                        .build();
                    WebhookDetails webhookDetails = client.webhooks().create(params);
                }
            }
        - lang: Kotlin
          source: |-
            package com.dodopayments.api.example

            import com.dodopayments.api.client.DodoPaymentsClient
            import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
            import com.dodopayments.api.models.webhooks.WebhookCreateParams
            import com.dodopayments.api.models.webhooks.WebhookDetails

            fun main() {
                val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()

                val params: WebhookCreateParams = WebhookCreateParams.builder()
                    .url("url")
                    .build()
                val webhookDetails: WebhookDetails = client.webhooks().create(params)
            }
        - lang: Ruby
          source: |-
            require "dodopayments"

            dodo_payments = Dodopayments::Client.new(
              bearer_token: "My Bearer Token",
              environment: "test_mode" # defaults to "live_mode"
            )

            webhook_details = dodo_payments.webhooks.create(url: "url")

            puts(webhook_details)
components:
  schemas:
    CreateWebhookRequest:
      type: object
      required:
        - url
      properties:
        description:
          type:
            - string
            - 'null'
        disabled:
          type:
            - boolean
            - 'null'
          description: |-
            Create the webhook in a disabled state.

            Default is false
        filter_types:
          type: array
          items:
            $ref: '#/components/schemas/EventType'
          description: |-
            Filter events to the webhook.

            Webhook event will only be sent for events in the list.
        headers:
          type:
            - object
            - 'null'
          description: Custom headers to be passed
          additionalProperties:
            type: string
          propertyNames:
            type: string
        idempotency_key:
          type:
            - string
            - 'null'
          description: The request's idempotency key
        metadata:
          type:
            - object
            - 'null'
          description: |-
            Metadata to be passed to the webhook
            Defaut is {}
          additionalProperties:
            type: string
          propertyNames:
            type: string
        rate_limit:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        url:
          type: string
          description: Url of the webhook
    WebhookDetails:
      type: object
      title: Webhook Details
      required:
        - description
        - id
        - metadata
        - created_at
        - updated_at
        - url
      properties:
        created_at:
          type: string
          description: Created at timestamp
        description:
          type: string
          description: An example webhook name.
        disabled:
          type:
            - boolean
            - 'null'
          description: |-
            Status of the webhook.

            If true, events are not sent
        filter_types:
          type:
            - array
            - 'null'
          items:
            type: string
          description: |-
            Filter events to the webhook.

            Webhook event will only be sent for events in the list.
        id:
          type: string
          description: The webhook's ID.
        metadata:
          type: object
          description: Metadata of the webhook
          additionalProperties:
            type: string
          propertyNames:
            type: string
        rate_limit:
          type:
            - integer
            - 'null'
          format: int32
          description: Configured rate limit
          minimum: 0
        updated_at:
          type: string
          description: Updated at timestamp
        url:
          type: string
          description: Url endpoint of the webhook
    EventType:
      type: string
      description: Event types for Dodo events
      enum:
        - payment.succeeded
        - payment.failed
        - payment.processing
        - payment.cancelled
        - refund.succeeded
        - refund.failed
        - dispute.opened
        - dispute.expired
        - dispute.accepted
        - dispute.cancelled
        - dispute.challenged
        - dispute.won
        - dispute.lost
        - subscription.active
        - subscription.renewed
        - subscription.on_hold
        - subscription.cancelled
        - subscription.failed
        - subscription.expired
        - subscription.plan_changed
        - license_key.created
  securitySchemes:
    API_KEY:
      type: http
      scheme: bearer

````