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

# PATCH - Webhook

>  This API allows authenticated users to update an existing webhook configuration. Only the endpoint URL and secret hash can be modified - the API template and other core settings remain unchanged.


 **Key Notes:** 
 - Requires authentication and ownership of the webhook (created by the authenticated user). 
 - Only `endpoint_url` and `secret_hash` fields can be updated. 
 - The API template ID cannot be changed after webhook creation. 
 - Returns the updated webhook details after successful modification.


 **Updatable Fields:** 
 - **endpoint_url**: The URL where webhook notifications will be sent (required) 
 - **secret_hash**: Optional secret key for webhook authentication (will be encrypted)


 **Non-Updatable Fields:** 
 - **api_template**: Cannot be changed after webhook creation 
 - **status**: Managed separately by the system 
 - **created_by**: Immutable field


 **Scenario: Updating Webhook Configuration** 
 - A developer needs to change their webhook endpoint URL due to server migration. 
 - They call this endpoint with the webhook ID and new endpoint URL. 
 - They can also update the secret hash if they want to change authentication. 
 - The system updates the webhook and returns the modified configuration. 
 - This is useful for maintaining webhook functionality during infrastructure changes. 



## OpenAPI

````yaml PATCH /webhooks/v1/webhook/{id}/
openapi: 3.0.1
info:
  title: Webhook Management API
  description: >-
    An API for managing webhooks for automatic document processing and
    notifications.
  version: 1.0.0
servers:
  - url: https://api-staging.crazygoldfish.com
    description: SandBox endpoint
  - url: https://api.crazygoldfish.com
    description: Prod End Point
security: []
paths:
  /webhooks/v1/webhook/{id}/:
    patch:
      tags:
        - Webhooks
      summary: Update Webhook
      description: >-
        Updates an existing webhook configuration. Only the endpoint URL and
        secret hash can be modified - the API template and other core settings
        remain unchanged.
      operationId: updateWebhook
      parameters:
        - name: id
          in: path
          description: Unique identifier of the webhook to update.
          required: true
          schema:
            type: string
            format: uuid
          example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookUpdateRequest'
            example:
              endpoint_url: https://new-example.com/webhook/assignment-processing
              secret_hash: new-secret-key-456
      responses:
        '200':
          description: Webhook updated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookResponse'
              example:
                id: 428f1ea8-7efc-4ec8-a449-85b010b26472
                api_template:
                  id: 488f4644-057d-41e7-9a74-72c040602647
                  name: assignment_evaluation_student_answer_sheet_extraction
                  display_name: Assignment Answer Sheet Extraction
                  description: null
                endpoint_url: https://new-example.com/webhook/assignment-answer-sheet
        '400':
          description: Bad Request - Validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
              example:
                error:
                  code: 400
                  message:
                    endpoint_url:
                      - This field is required.
        '401':
          description: Unauthorized - Authentication required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 401
                  message:
                    non_field_errors:
                      - Authentication credentials were not provided.
        '404':
          description: Not Found - Webhook not found or not owned by user.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 404
                  message:
                    non_field_errors:
                      - Webhook not found
        '500':
          description: Internal Server Error - Unexpected server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 500
                  message:
                    non_field_errors:
                      - Internal Server Error
      security:
        - bearerAuth: []
components:
  schemas:
    WebhookUpdateRequest:
      type: object
      properties:
        endpoint_url:
          type: string
          format: uri
          description: The URL where webhook notifications will be sent
          example: https://example.com/webhook/assignment-processing
        secret_hash:
          type: string
          description: Optional secret key for webhook authentication (will be encrypted)
          example: my-secret-key-123
      required:
        - endpoint_url
    WebhookResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier of the webhook
          example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        api_template:
          type: object
          description: Webhook template details
          properties:
            id:
              type: string
              format: uuid
              description: UUID of the webhook template
              example: 488f4644-057d-41e7-9a74-72c040602647
            name:
              type: string
              description: Internal name of the webhook template
              example: assignment_evaluation_student_answer_sheet_extraction
            display_name:
              type: string
              description: Display name of the webhook template
              example: Assignment Answer Sheet Extraction
            description:
              type: string
              nullable: true
              description: Description of the webhook template
              example: null
          required:
            - id
            - name
            - display_name
        endpoint_url:
          type: string
          format: uri
          description: The URL where webhook notifications are sent
          example: https://example.com/webhook/assignment-processing
      required:
        - id
        - api_template
        - endpoint_url
    ValidationErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: HTTP status code
              example: 400
            message:
              type: object
              description: Validation error details
              additionalProperties:
                type: array
                items:
                  type: string
          required:
            - code
            - message
      required:
        - error
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: HTTP status code
              example: 404
            message:
              type: object
              properties:
                non_field_errors:
                  type: array
                  items:
                    type: string
                  description: List of error messages
                  example:
                    - Webhook not found
              required:
                - non_field_errors
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````