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

# Update Webhook

> Update a specific webhook.



## OpenAPI

````yaml patch /webhooks/{webhook_id}
openapi: 3.1.0
info:
  title: public
  description: ''
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 1.102.0
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: Entitlements
  - name: Licenses
  - name: Discounts
  - name: Meters
  - name: Credit Entitlements
  - name: Credit Entitlement Balances
  - name: Outgoing Webhooks
  - name: Checkout
  - name: Webhook Events
paths:
  /webhooks/{webhook_id}:
    patch:
      tags:
        - Webhooks
      summary: Patch a webhook by id
      operationId: patch_webhook
      parameters:
        - name: webhook_id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchWebhookRequest'
        required: true
      responses:
        '200':
          description: Webhook patched successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookDetails'
        '404':
          description: Webhook Not Found
        '500':
          description: Something went wrong.
      security:
        - API_KEY: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import DodoPayments from 'dodopayments';

            const client = new DodoPayments({
              bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
            });

            const webhookDetails = await client.webhooks.update('webhook_id');

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

            client = DodoPayments(
                bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"),  # This is the default and can be omitted
            )
            webhook_details = client.webhooks.update(
                webhook_id="webhook_id",
            )
            print(webhook_details.id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/dodopayments/dodopayments-go\"\n\t\"github.com/dodopayments/dodopayments-go/option\"\n)\n\nfunc main() {\n\tclient := dodopayments.NewClient(\n\t\toption.WithBearerToken(\"My Bearer Token\"),\n\t)\n\twebhookDetails, err := client.Webhooks.Update(\n\t\tcontext.TODO(),\n\t\t\"webhook_id\",\n\t\tdodopayments.WebhookUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", webhookDetails.ID)\n}\n"
        - 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.WebhookDetails;
            import com.dodopayments.api.models.webhooks.WebhookUpdateParams;

            public final class Main {
                private Main() {}

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

                    WebhookDetails webhookDetails = client.webhooks().update("webhook_id");
                }
            }
        - 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.WebhookDetails
            import com.dodopayments.api.models.webhooks.WebhookUpdateParams

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

                val webhookDetails: WebhookDetails = client.webhooks().update("webhook_id")
            }
        - 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.update("webhook_id")

            puts(webhook_details)
        - lang: PHP
          source: |-
            <?php

            require_once dirname(__DIR__) . '/vendor/autoload.php';

            use Dodopayments\Client;
            use Dodopayments\Core\Exceptions\APIException;
            use Dodopayments\WebhookEvents\WebhookEventType;

            $client = new Client(
              bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
              environment: 'test_mode',
            );

            try {
              $webhookDetails = $client->webhooks->update(
                'webhook_id',
                description: 'description',
                disabled: true,
                filterTypes: [WebhookEventType::PAYMENT_SUCCEEDED],
                metadata: ['foo' => 'string'],
                rateLimit: 0,
                url: 'url',
              );

              var_dump($webhookDetails);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: C#
          source: |-
            using System;
            using DodoPayments.Client;
            using DodoPayments.Client.Models.Webhooks;

            DodoPaymentsClient client = new();

            WebhookUpdateParams parameters = new() { WebhookID = "webhook_id" };

            var webhookDetails = await client.Webhooks.Update(parameters);

            Console.WriteLine(webhookDetails);
components:
  schemas:
    PatchWebhookRequest:
      type: object
      properties:
        description:
          type:
            - string
            - 'null'
          description: Description of the webhook
        disabled:
          type:
            - boolean
            - 'null'
          description: To Disable the endpoint, set it to true.
        filter_types:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/EventType'
          description: |-
            Filter events to the endpoint.

            Webhook event will only be sent for events in the list.
        metadata:
          type:
            - object
            - 'null'
          description: Metadata
          additionalProperties:
            type: string
          propertyNames:
            type: string
        rate_limit:
          type:
            - integer
            - 'null'
          format: int32
          description: Rate limit
          minimum: 0
        url:
          type:
            - string
            - 'null'
          description: Url endpoint
          x-stainless-naming:
            python:
              property_name: webhook_url
    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.paused
        - subscription.cancelled
        - subscription.failed
        - subscription.expired
        - subscription.plan_changed
        - subscription.updated
        - license_key.created
        - payout.not_initiated
        - payout.on_hold
        - payout.in_progress
        - payout.failed
        - payout.success
        - credit.added
        - credit.deducted
        - credit.expired
        - credit.rolled_over
        - credit.rollover_forfeited
        - credit.overage_charged
        - credit.overage_reset
        - credit.manual_adjustment
        - credit.balance_low
        - abandoned_checkout.detected
        - abandoned_checkout.recovered
        - dunning.started
        - dunning.recovered
        - entitlement_grant.created
        - entitlement_grant.delivered
        - entitlement_grant.failed
        - entitlement_grant.revoked
  securitySchemes:
    API_KEY:
      type: http
      scheme: bearer

````