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

# Update Webhook

> Updates a webhook configuration.

The `"events"` listed in the request are overwritten. If you want to add more events, provide also the events that are already in the webhook configuration.

> 📘 Webhook Documentation
>
> Read [Introduction to webhooks](/api-reference/introduction-to-webhooks) article to learn how webhooks work in Voucherify.



## OpenAPI

````yaml /openapi/management.json put /management/v1/projects/{projectId}/webhooks/{webhookId}
openapi: 3.0.1
info:
  title: Voucherify API - Management
  version: v2018-08-01
  description: >-
    Voucherify promotion engine REST API. Please see
    https://docs.voucherify.io/docs for more details.
  contact:
    name: Voucherify Team
    url: https://www.voucherify.io/contact-support
    email: support@voucherify.io
  termsOfService: https://www.voucherify.io/legal/subscription-agreement
  license:
    name: MIT
    url: https://github.com/voucherifyio/voucherify-js-sdk/blob/main/LICENSE
servers:
  - url: https://{cluster}.voucherify.io
    description: Base URL
    variables:
      cluster:
        default: api
        enum:
          - api
          - us1.api
          - as1.api
          - download
          - us1.download
          - as1.download
security: []
paths:
  /management/v1/projects/{projectId}/webhooks/{webhookId}:
    parameters:
      - schema:
          $ref: '#/components/schemas/ParameterProjectId'
        in: path
        name: projectId
        description: Provide the unique identifier of the project.
        required: true
      - schema:
          $ref: '#/components/schemas/ParameterWebhookId'
        in: path
        name: webhookId
        description: Provide the unique identifier of the webhook configuration.
        required: true
    put:
      tags:
        - Management
      summary: Update Webhook
      description: >-
        Updates a webhook configuration.


        The `"events"` listed in the request are overwritten. If you want to add
        more events, provide also the events that are already in the webhook
        configuration.


        > 📘 Webhook Documentation

        >

        > Read [Introduction to
        webhooks](/api-reference/introduction-to-webhooks) article to learn how
        webhooks work in Voucherify.
      operationId: update-webhook
      parameters: []
      requestBody:
        description: Defines the webhook configuration to be updated.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ManagementProjectsWebhooksUpdateRequestBody'
        required: true
      responses:
        '200':
          description: Returns the details about the updated webhook configuration.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ManagementProjectsWebhooksUpdateResponseBody
              examples:
                Example:
                  value:
                    object: webhook
                    created_at: '2024-04-30T08:13:55.789Z'
                    id: wh_Fk1HzL9lqC1lpuIFxp3TShB4
                    events:
                      - redemption.failed
                    target_url: your_url
                    active: false
        '400':
          description: Returns an error if the payload includes incorrect details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/e_400_invalid_payload'
              examples:
                Invalid payload:
                  value:
                    code: 400
                    key: invalid_payload
                    message: Invalid payload
                    details: Property .properties.Size.eq.0 must be number
                    request_id: v-0ea5a9b9b3402940a9
        '401':
          description: Returns an error if an invalid token was provided.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Unauthorized:
                  value:
                    code: 401
                    message: Unauthorized
                    key: unauthorized
        '402':
          description: >-
            Returns an error if the current plan does not include the Management
            API feature.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorPaymentRequired'
              examples:
                Example:
                  value:
                    code: 402
                    message: Payment required
                    details: >-
                      Your current plan does not include a feature required to
                      perform this operation.
                    key: missing_required_feature
        '404':
          description: Returns an error when a resource could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Not Found:
                  value:
                    code: 404
                    key: not_found
                    message: Resource not found
                    details: Cannot find webhook with id wh_ekFHVL6lqC4lDuIFxpETSGa
                    request_id: v-0ead4423d55b6996f2
                    resource_id: wh_ekFHVL6lqC4lDuIFxpETSGa
                    resource_type: webhook
      security:
        - X-Management-Id: []
          X-Management-Token: []
components:
  schemas:
    ParameterProjectId:
      type: string
      example: proj_TrlkLiH4
    ParameterWebhookId:
      type: string
      example: wh_Fk1HzL9lqC1lpuIFxp3TShB4
    ManagementProjectsWebhooksUpdateRequestBody:
      type: object
      title: Management Webhook Update Request Body
      description: >-
        Request body schema for **PUT**
        `/management/v1/projects/{projectId}/webhooks`.
      allOf:
        - $ref: '#/components/schemas/ManagementProjectsWebhookBase'
      required:
        - target_url
        - events
    ManagementProjectsWebhooksUpdateResponseBody:
      type: object
      title: Management Webhook Update Response Response
      description: >-
        Response body schema for **PUT**
        `/management/v1/projects/{projectId}/webhooks/{webhookId}`.
      allOf:
        - $ref: '#/components/schemas/ManagementProjectsWebhook'
    e_400_invalid_payload:
      title: Invalid Payload
      type: object
      description: 'Error: Bad Request &rarr; Invalid Payload'
      properties:
        code:
          type: integer
          default: 400
          description: Error's HTTP status code.
        key:
          type: string
          default: invalid_payload
          description: Short string describing the kind of error which occurred.
        message:
          type: string
          default: Invalid payload
          description: A human-readable message providing a short description of the error.
        details:
          type: string
          description: A human-readable message providing more details about the error.
        request_id:
          type: string
          example: v-0a884c6be8c3756f42
          description: >-
            This ID is useful when troubleshooting and/or finding the root cause
            of an error response by our support team.
    Error:
      title: Error Object
      type: object
      description: Error details
      properties:
        code:
          type: integer
          description: Error's HTTP status code.
        key:
          type: string
          description: Short string describing the kind of error which occurred.
        message:
          type: string
          description: A human-readable message providing a short description of the error.
        details:
          type: string
          description: A human-readable message providing more details about the error.
        request_id:
          type: string
          example: v-0a885062c80375740f
          description: >-
            This ID is useful when troubleshooting and/or finding the root cause
            of an error response by our support team.
        resource_id:
          type: string
          description: >-
            Unique resource ID that can be used in another endpoint to get more
            details.
          example: rf_0c5d710a87c8a31f86
        resource_type:
          type: string
          description: The resource type.
          example: voucher
        error:
          type: object
          description: Includes additional information about the error.
          properties:
            message:
              type: string
              description: The message configured by the user in a validation rule.
      required:
        - code
        - message
    ErrorPaymentRequired:
      title: Payment Required Error
      type: object
      description: 'Error: Payment required - the current plan does not include the feature.'
      properties:
        code:
          type: integer
          description: Error's HTTP status code.
        message:
          type: string
          description: A human-readable message providing a short description of the error.
        details:
          type: string
          description: A human-readable message providing more details about the error.
        key:
          type: string
          description: Short string describing the kind of error which occurred.
      required:
        - code
        - message
        - details
        - key
    ManagementProjectsWebhookBase:
      type: object
      description: ''
      properties:
        target_url:
          type: string
          description: URL address that receives webhooks.
        events:
          type: array
          description: Lists the events that trigger webhook sendout.
          items:
            type: string
            enum:
              - business_validation_rule.assignment.created
              - business_validation_rule.assignment.deleted
              - business_validation_rule.created
              - business_validation_rule.deleted
              - business_validation_rule.updated
              - campaign.created
              - campaign.deleted
              - campaign.disabled
              - campaign.enabled
              - campaign.earning_rule.assigned
              - campaign.earning_rule.deleted
              - campaign.earning_rule.disabled
              - campaign.earning_rule.enabled
              - campaign.earning_rule.updated
              - campaign.loyalty_tier.created
              - campaign.loyalty_tier.deleted
              - campaign.loyalty_tier.updated
              - campaign.promotion_stack.created
              - campaign.promotion_stack.updated
              - campaign.promotion_tier.created
              - campaign.promotion_tier.deleted
              - campaign.promotion_tier.disabled
              - campaign.promotion_tier.enabled
              - campaign.promotion_tier.updated
              - campaign.referral_tier.created
              - campaign.referral_tier.deleted
              - campaign.referral_tier.updated
              - campaign.reward.assignment.created
              - campaign.reward.assignment.deleted
              - campaign.reward.assignment.updated
              - campaign.updated
              - campaign.vouchers.aded
              - campaign.vouchers.generation.completed
              - campaign.vouchers.generation.failed
              - campaign.vouchers.generation.started
              - customer.confirmed
              - customer.created
              - customer.deleted
              - customer.rewarded
              - customer.rewarded.loyalty_points
              - publication.succeeded
              - redemption.failed
              - redemption.rollback.failed
              - redemption.rollback.succeeded
              - redemption.succeeded
              - voucher.created
              - voucher.deleted
              - voucher.disabled
              - voucher.enabled
              - voucher.gift.balance_aded
              - voucher.gift.transaction.created
              - voucher.loyalty_card.pending_points.activated
              - voucher.loyalty_card.pending_points.aded
              - voucher.loyalty_card.pending_points.canceled
              - voucher.loyalty_card.pending_points.updated
              - voucher.loyalty_card.points_aded
              - voucher.loyalty_card.points_expired
              - voucher.loyalty_card.transaction.created
              - voucher.published
              - voucher.updated
        active:
          type: boolean
          description: Determines if the webhook configuration is active.
          default: true
    ManagementProjectsWebhook:
      type: object
      title: Management Projects Webhook
      description: Response body schema for webhook endpoints.
      allOf:
        - type: object
          properties:
            id:
              type: string
              description: Unique identifier of the webhook.
              example: wh_i45Uez36Uz8XNW6PXC0eyGmb
            object:
              type: string
              description: The type of the object represented by JSON.
              default: webhook
              enum:
                - webhook
            created_at:
              type: string
              description: >-
                Timestamp representing the date and time when the webhook
                configuration was created. The value for this parameter is shown
                in the ISO 8601 format.
              format: date-time
              example: '2024-01-02T08:31:46.562Z'
        - $ref: '#/components/schemas/ManagementProjectsWebhookBase'
      required:
        - id
        - object
        - created_at
        - target_url
        - events
        - active
  securitySchemes:
    X-Management-Id:
      type: apiKey
      name: X-Management-Id
      in: header
    X-Management-Token:
      type: apiKey
      name: X-Management-Token
      in: header

````