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

# Update a webhook endpoint

> URL, events, description or active. The agent cannot change: to move an endpoint to another agent, delete it and create a new one. Reactivating an endpoint when the agent already has 3 active returns 409 webhook_endpoint_limit_reached.



## OpenAPI

````yaml /openapi.yaml patch /webhook_endpoints/{webhook_endpoint_id}
openapi: 3.1.0
info:
  title: NewLead API
  version: 1.0.0
  description: >-
    The NewLead public API. Each API key belongs to one subaccount and can read
    and change only that subaccount's data. Errors, pagination, idempotency and
    rate limits are documented at https://docs.newlead.ai.
servers:
  - url: https://rest.newlead.ai/v1
security:
  - BearerAuth: []
  - ApiKeyHeader: []
tags:
  - name: Specification
    description: This document.
paths:
  /webhook_endpoints/{webhook_endpoint_id}:
    parameters:
      - $ref: '#/components/parameters/WebhookEndpointId'
    patch:
      tags:
        - Webhooks
      summary: Update a webhook endpoint
      description: >-
        URL, events, description or active. The agent cannot change: to move an
        endpoint to another agent, delete it and create a new one. Reactivating
        an endpoint when the agent already has 3 active returns 409
        webhook_endpoint_limit_reached.
      operationId: updateWebhookEndpoint
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookEndpointUpdateRequest'
      responses:
        '200':
          description: The updated endpoint.
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookEndpoint'
        '429':
          $ref: '#/components/responses/RateLimited'
        4XX:
          $ref: '#/components/responses/Error'
        5XX:
          $ref: '#/components/responses/Error'
components:
  parameters:
    WebhookEndpointId:
      name: webhook_endpoint_id
      in: path
      required: true
      description: The webhook endpoint id.
      schema:
        type: string
        format: uuid
  schemas:
    WebhookEndpointUpdateRequest:
      type: object
      additionalProperties: false
      minProperties: 1
      properties:
        url:
          $ref: '#/components/schemas/WebhookEndpointUrl'
        events:
          $ref: '#/components/schemas/WebhookEvents'
        description:
          type:
            - string
            - 'null'
          maxLength: 200
          description: null or an empty string deletes it.
        active:
          type: boolean
          description: >-
            true reactivates it and resets consecutive_failures to 0; false
            pauses it.
    WebhookEndpoint:
      type: object
      additionalProperties: false
      required:
        - object
        - id
        - url
        - events
        - text_agent_id
        - voice_agent_id
        - description
        - active
        - last_success_at
        - last_failure_at
        - consecutive_failures
        - created_at
      properties:
        object:
          type: string
          const: webhook_endpoint
        id:
          type: string
          format: uuid
        url:
          type: string
          format: uri
        events:
          type: array
          items:
            $ref: '#/components/schemas/WebhookEvent'
        text_agent_id:
          type:
            - string
            - 'null'
          format: uuid
          description: The endpoint's text agent, or null if it belongs to a voice agent.
        voice_agent_id:
          type:
            - string
            - 'null'
          format: uuid
          description: The endpoint's voice agent, or null if it belongs to a text agent.
        description:
          type:
            - string
            - 'null'
        active:
          type: boolean
          description: >-
            false: paused, receives no deliveries. It pauses itself after 20
            consecutive failed deliveries; when reactivated,
            consecutive_failures resets to 0.
        last_success_at:
          type:
            - string
            - 'null'
          format: date-time
        last_failure_at:
          type:
            - string
            - 'null'
          format: date-time
        consecutive_failures:
          type: integer
          minimum: 0
          description: >-
            Consecutive failed deliveries, each after its 13 attempts. Test
            deliveries do not count.
        created_at:
          type: string
          format: date-time
        secret:
          type: string
          pattern: ^whsec_[0-9a-f]{64}$
          description: >-
            Only in the POST /webhook_endpoints response: the key that signs
            deliveries (X-Webhook-Signature header). Store it: it is never shown
            again.
    WebhookEndpointUrl:
      type: string
      format: uri
      maxLength: 2048
      pattern: ^https://
      description: >-
        https only. It cannot point to a private address, and redirects are not
        followed.
      examples:
        - https://n8n.example.com/webhook/newlead
    WebhookEvents:
      type: array
      minItems: 1
      uniqueItems: true
      items:
        $ref: '#/components/schemas/WebhookEvent'
    WebhookEvent:
      type: string
      enum:
        - call.started
        - call.rejected
        - call.ended
        - call.analyzed
        - lead.created
        - lead.qualified
        - lead.appointment_booked
        - lead.handoff
        - follow_up.sent
        - message.received
        - message.failed
      description: >-
        call.* events belong to voice agents; the others belong to text agents.
        What each event carries and how to verify the signature are at
        https://docs.newlead.ai/webhook-events.
    ErrorResponse:
      type: object
      additionalProperties: false
      required:
        - error
      properties:
        error:
          type: object
          additionalProperties: false
          required:
            - type
            - code
            - message
            - param
            - request_id
            - doc_url
          properties:
            type:
              $ref: '#/components/schemas/ErrorType'
            code:
              $ref: '#/components/schemas/ErrorCode'
            message:
              type: string
              description: 'A human-readable explanation. It can change: never match on it.'
            param:
              type:
                - string
                - 'null'
              description: The offending field, dot-separated (variables.city), or null.
            request_id:
              type: string
              description: The same value as the x-request-id header.
            doc_url:
              type: string
              format: uri
            details:
              type: object
              additionalProperties: true
              description: >-
                On agent_not_ready, carries blockers. On send_outcome_unknown
                from POST /calls, carries call_id if the call is known.
      examples:
        - error:
            type: invalid_request_error
            code: parameter_invalid
            message: phone must match pattern "^\+[1-9]\d{6,14}$".
            param: phone
            request_id: req_m3k2a9_4f1c2b7e
            doc_url: https://docs.newlead.ai/errors#parameter_invalid
    ErrorType:
      type: string
      enum:
        - invalid_request_error
        - authentication_error
        - billing_error
        - permission_error
        - not_found_error
        - conflict_error
        - rate_limit_error
        - api_error
        - provider_error
    ErrorCode:
      type: string
      description: >-
        The closed list of error causes. The table is at
        https://docs.newlead.ai/errors.
      enum:
        - parameter_missing
        - parameter_invalid
        - parameter_unknown
        - body_invalid_json
        - recipient_invalid
        - api_key_missing
        - api_key_invalid
        - insufficient_balance
        - subscription_inactive
        - api_key_forbidden
        - feature_disabled
        - resource_not_found
        - route_not_found
        - agent_not_ready
        - lead_do_not_contact
        - lead_ai_paused
        - lead_ai_not_paused
        - messaging_window_closed
        - template_not_approved
        - outside_initiation_hours
        - voice_number_missing
        - webhook_endpoint_limit_reached
        - webhook_endpoint_disabled
        - idempotency_key_reused
        - idempotency_key_in_use
        - rate_limit_exceeded
        - internal_error
        - provider_unavailable
        - send_outcome_unknown
  headers:
    X-Request-ID:
      description: The id of this request. Quote it when you contact support.
      schema:
        type: string
    RateLimit-Limit:
      description: Requests allowed per minute for this API key.
      schema:
        type: integer
    RateLimit-Remaining:
      description: Requests left in the current minute.
      schema:
        type: integer
    RateLimit-Reset:
      description: Seconds until the counter resets.
      schema:
        type: integer
    Retry-After:
      description: Seconds to wait before repeating the request.
      schema:
        type: integer
    Idempotent-Replayed:
      description: true when the response is the stored one for a repeated Idempotency-Key.
      schema:
        type: string
        const: 'true'
  responses:
    RateLimited:
      description: Too many requests for this API key. Wait for Retry-After and repeat.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Error:
      description: An error. type is the family and code is the cause.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
        Idempotent-Replayed:
          $ref: '#/components/headers/Idempotent-Replayed'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        The API key, created in Settings › API, in the header Authorization:
        Bearer <key>. The default.
    ApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: The same key, in the x-api-key header. Still accepted.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.