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

# Update webhook



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/cerca/openapi.documented.yml put /fleets/{fleetId}/webhooks/{webhookId}
openapi: 3.1.0
info:
  description: API-key accessible routes for Cerca agents.
  title: Cerca API
  version: 0.0.0
servers:
  - url: https://api.cerca.dev
security:
  - bearerAuth: []
paths:
  /fleets/{fleetId}/webhooks/{webhookId}:
    put:
      tags:
        - Webhooks
      summary: Update webhook
      parameters:
        - schema:
            type: string
            minLength: 1
            example: fleet_abc123
          required: true
          in: path
          name: fleetId
        - schema:
            type: string
            minLength: 1
            example: webhook_abc123
          required: true
          in: path
          name: webhookId
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateWebhookRequest'
      responses:
        '200':
          description: Webhook subscription updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookSubscription'
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Not authorized for this fleet.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Fleet or webhook subscription not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Webhook subscription conflict.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: Content-Type must be application/json.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        default:
          description: Error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Cerca from '@cerca-dev/sdk';


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


            const webhookSubscription = await
            client.webhooks.update('fleet_abc123', 'webhook_abc123');


            console.log(webhookSubscription.id);
        - lang: Python
          source: |-
            import os
            from cerca import Cerca

            client = Cerca(
                api_key=os.environ.get("CERCA_API_KEY"),  # This is the default and can be omitted
            )
            webhook_subscription = client.webhooks.update(
                fleet_id="fleet_abc123",
                webhook_id="webhook_abc123",
            )
            print(webhook_subscription.id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/matrices/cerca-go\"\n\t\"github.com/matrices/cerca-go/option\"\n)\n\nfunc main() {\n\tclient := cercago.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\twebhookSubscription, err := client.Webhooks.Update(\n\t\tcontext.TODO(),\n\t\t\"fleet_abc123\",\n\t\t\"webhook_abc123\",\n\t\tcercago.WebhookUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", webhookSubscription.ID)\n}\n"
        - lang: Ruby
          source: >-
            require "cerca"


            cerca = Cerca::Client.new(api_key: "My API Key")


            webhook_subscription = cerca.webhooks.update("fleet_abc123",
            "webhook_abc123")


            puts(webhook_subscription)
        - lang: CLI
          source: |-
            cerca webhooks update \
              --api-key 'My API Key' \
              --fleet-id fleet_abc123 \
              --webhook-id webhook_abc123
components:
  schemas:
    UpdateWebhookRequest:
      type: object
      properties:
        enabled:
          type: boolean
          description: Whether deliveries are enabled for this subscription.
          example: true
        events:
          type: array
          items:
            $ref: '#/components/schemas/WebhookSubscriptionEventType'
          description: Event names to deliver. Omit to subscribe to all non-test events.
        url:
          type: string
          description: HTTPS endpoint that will receive webhook deliveries.
          example: https://example.com/webhook
          format: uri
      additionalProperties:
        x-stainless-any: true
    WebhookSubscription:
      type: object
      properties:
        createdAt:
          type: string
        enabled:
          type: boolean
        fleetId:
          type: string
        events:
          type: array
          items:
            $ref: '#/components/schemas/WebhookEventType'
        id:
          type: string
        updatedAt:
          type: string
        url:
          type: string
      required:
        - createdAt
        - enabled
        - fleetId
        - events
        - id
        - updatedAt
        - url
      description: >-
        Webhook subscription metadata returned by list, get, and update. The
        one-time signing secret is not returned here.
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
          description: Stable machine-readable error code when the API can provide one.
          example: MONTHLY_TOKEN_BUDGET_EXCEEDED
      required:
        - error
    WebhookSubscriptionEventType:
      type: string
      enum:
        - agent.created
        - agent.updated
        - agent.deleted
        - thread.created
        - thread.status.changed
        - thread.completed
        - thread.failed
        - turn.created
        - turn.completed
        - turn.failed
        - message.created
        - approval.requested
        - approval.resolved
        - approval.granted
        - schedule.created
        - schedule.deleted
        - schedule.triggered
        - connection.attached
        - connection.detached
      description: >-
        `webhook.test` is reserved for the test endpoint and cannot be
        subscribed to.
    WebhookEventType:
      type: string
      enum:
        - agent.created
        - agent.updated
        - agent.deleted
        - thread.created
        - thread.status.changed
        - thread.completed
        - thread.failed
        - turn.created
        - turn.completed
        - turn.failed
        - message.created
        - approval.requested
        - approval.resolved
        - approval.granted
        - schedule.created
        - schedule.deleted
        - schedule.triggered
        - connection.attached
        - connection.detached
        - webhook.test
  securitySchemes:
    bearerAuth:
      bearerFormat: Cerca API key
      scheme: bearer
      type: http

````