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

# Update a Webhook Subscription

> Replaces one webhook subscription owned by the authenticated API user. Destination URLs follow the same https and public-host rules as creation. `headers` cannot be changed by this endpoint; delete the subscription and create a new one to change them. Requires permission to change webhooks; other callers receive a 403. For security reasons, webhooks you create may start disabled, and editing or enabling them requires extra permissions. Contact Sela staff to enable your webhooks, or to grant your API user permission to edit and enable webhooks.



## OpenAPI

````yaml /Sela_API.yaml put /api/webhooks/{id}/
openapi: 3.0.3
info:
  title: Sela API
  version: 1.0.2
  description: >-
    Create and manage leads, configure outbound webhook subscriptions, and use
    customer-specific lead ingestion workflows. Unless an endpoint says
    otherwise, authenticate with `Authorization: Token <api-key>`.
servers:
  - url: https://api.trysela.com/
    description: Production API
security: []
tags:
  - name: Leads
    description: Create, retrieve, update, and schedule customer leads.
  - name: Call Control
    description: Pause or resume outbound calling for an API user.
  - name: Lead Types
    description: >-
      Discover lead categories and the public metadata fields accepted for each
      one.
  - name: Webhooks
    description: >-
      Manage subscriptions that deliver lead and call events to customer
      systems.
  - name: Lead Ingestion
    description: >-
      Submit provider-specific lead payloads through ingestion URLs configured
      by Sela.
  - name: File Ingestion
    description: Request temporary upload URLs for configured CSV ingestion sources.
paths:
  /api/webhooks/{id}/:
    put:
      tags:
        - Webhooks
      summary: Update a Webhook Subscription
      description: >-
        Replaces one webhook subscription owned by the authenticated API user.
        Destination URLs follow the same https and public-host rules as
        creation. `headers` cannot be changed by this endpoint; delete the
        subscription and create a new one to change them. Requires permission to
        change webhooks; other callers receive a 403. For security reasons,
        webhooks you create may start disabled, and editing or enabling them
        requires extra permissions. Contact Sela staff to enable your webhooks,
        or to grant your API user permission to edit and enable webhooks.
      operationId: webhooks_update
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          description: A unique integer value identifying this webhook.
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookRequest'
            examples:
              CRMWebhook:
                value:
                  url: https://crm.example.com/leads/{{id}}/events
                  trigger:
                    - LEAD_CREATED
                    - CALL_COMPLETE
                  method: POST
                  filter_condition: get('last_chat.is_contact', False)
                  is_enabled: true
                summary: CRM webhook
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/WebhookRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/WebhookRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Webhook'
              examples:
                WebhookSubscriptionUpdated:
                  value:
                    id: 42
                    url: https://crm.example.com/leads/{{id}}/events
                    trigger:
                      - LEAD_CREATED
                      - CALL_COMPLETE
                    method: POST
                    filter_condition: get('last_chat.is_contact', False)
                    is_enabled: true
                  summary: Webhook subscription updated
          description: Webhook subscription updated successfully.
        '400':
          description: >-
            The URL, triggers, filter expression, or method are invalid, or the
            caller may not enable this webhook.
        '401':
          description: API token is missing or invalid.
        '403':
          description: The API user does not have permission to change webhooks.
        '404':
          description: Webhook subscription not found.
      security:
        - tokenAuth: []
      x-codeSamples:
        - lang: curl
          label: CRMWebhook
          source: |-
            curl --request PUT \
              --url https://api.trysela.com/api/webhooks/<webhook-id>/ \
              --header 'Authorization: Token <api-key>' \
              --header 'Content-Type: application/json' \
              --data '{
                "url": "https://crm.example.com/leads/{{id}}/events",
                "trigger": [
                  "LEAD_CREATED",
                  "CALL_COMPLETE"
                ],
                "method": "POST",
                "filter_condition": "get('"'"'last_chat.is_contact'"'"', False)",
                "is_enabled": true
              }'
components:
  schemas:
    WebhookRequest:
      type: object
      properties:
        url:
          type: string
          format: uri
          minLength: 1
          description: >-
            Webhook URL. Must use https and point to a public internet host.
            Supports {{variable}} placeholders in the path and query, resolved
            from the webhook payload (e.g.
            https://api.example.com/leads/{{id}}/notify). Use dot notation for
            nested values (e.g. {{metadata.us_state}}).
          maxLength: 255
        trigger:
          type: array
          items:
            $ref: '#/components/schemas/TriggerEnum'
        method:
          nullable: true
          description: >-
            HTTP method to use when sending the webhook request. NULL or blank
            defaults to POST.


            * `GET` - GET

            * `POST` - POST

            * `PUT` - PUT

            * `PATCH` - PATCH
          oneOf:
            - $ref: '#/components/schemas/MethodEnum'
            - $ref: '#/components/schemas/BlankEnum'
            - $ref: '#/components/schemas/NullEnum'
        filter_condition:
          type: string
          nullable: true
          description: >-
            Optional filter expression that controls when the webhook fires. The
            expression is evaluated against the webhook payload - the same data
            sent in the request body. Leave blank to always fire. Use
            has('field') to check whether a field exists, get('path.to.value',
            default) for safe nested access, and comparison operators such as
            ==, !=, and, or. Examples: status == 'CLOSED', has('last_chat') and
            last_chat['is_contact'], get('last_chat.call_direction', '') ==
            'INBOUND'
        headers:
          type: object
          additionalProperties:
            type: string
          writeOnly: true
          description: >-
            Optional HTTP headers added to outbound webhook requests. Header
            values must be strings. Headers are accepted when creating a
            subscription but are never returned by the API.
        is_enabled:
          type: boolean
          description: >-
            Whether this webhook fires. Defaults to true for callers with
            permission to change webhooks and for Total Expert and Zapier
            destinations, and false otherwise; only in those cases may it be set
            to true.
      required:
        - url
    Webhook:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        url:
          type: string
          format: uri
          description: >-
            Webhook URL. Must use https and point to a public internet host.
            Supports {{variable}} placeholders in the path and query, resolved
            from the webhook payload (e.g.
            https://api.example.com/leads/{{id}}/notify). Use dot notation for
            nested values (e.g. {{metadata.us_state}}).
          maxLength: 255
        trigger:
          type: array
          items:
            $ref: '#/components/schemas/TriggerEnum'
        method:
          nullable: true
          description: >-
            HTTP method to use when sending the webhook request. NULL or blank
            defaults to POST.


            * `GET` - GET

            * `POST` - POST

            * `PUT` - PUT

            * `PATCH` - PATCH
          oneOf:
            - $ref: '#/components/schemas/MethodEnum'
            - $ref: '#/components/schemas/BlankEnum'
            - $ref: '#/components/schemas/NullEnum'
        filter_condition:
          type: string
          nullable: true
          description: >-
            Optional filter expression that controls when the webhook fires. The
            expression is evaluated against the webhook payload - the same data
            sent in the request body. Leave blank to always fire. Use
            has('field') to check whether a field exists, get('path.to.value',
            default) for safe nested access, and comparison operators such as
            ==, !=, and, or. Examples: status == 'CLOSED', has('last_chat') and
            last_chat['is_contact'], get('last_chat.call_direction', '') ==
            'INBOUND'
        is_enabled:
          type: boolean
          description: >-
            Whether this webhook fires. Defaults to true for callers with
            permission to change webhooks and for Total Expert and Zapier
            destinations, and false otherwise; only in those cases may it be set
            to true.
      required:
        - id
        - url
    TriggerEnum:
      type: string
      enum:
        - LEAD_CREATED
        - LEAD_UPDATED
        - LEAD_CLOSED
        - LEAD_CLOSED_INCOMPLETE
        - LEAD_LOST
        - LEAD_SCHEDULE_COMPLETED
        - LEAD_LATE_CALLBACK
        - LEAD_OUT_OF_TERRITORY
        - LEAD_BAD_NUMBER
        - LEAD_CANCELLED
        - LEAD_CALLBACK_TO_TRANSFER
        - LEAD_BEFORE_REENGAGEMENT
        - LEAD_REENGAGEMENT
        - LEAD_FIRST_INBOUND
        - CALL_COMPLETE
        - BEFORE_CALLING
        - CALL_FAILED
        - CALL_ENDED
        - RECORDING_AVAILABLE
        - CALL_TRANSFER_INITIATED
        - SMS_COMPLETE
        - SMS_DNC
        - CALL_DNC
    MethodEnum:
      enum:
        - GET
        - POST
        - PUT
        - PATCH
      type: string
      description: |-
        * `GET` - GET
        * `POST` - POST
        * `PUT` - PUT
        * `PATCH` - PATCH
    BlankEnum:
      enum:
        - ''
    NullEnum:
      enum:
        - null
  securitySchemes:
    tokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: |-
        Token-based authentication. Format: `Token <your_token>`

        Example: `Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b`

````

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