Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Elevenlabs Elevenlabs python WebhooksClient

From Leeroopedia
Field Value
Sources src/elevenlabs/webhooks/client.py, src/elevenlabs/webhooks/raw_client.py
Domains Webhooks, Workspace Management
Last Updated 2026-02-15

Overview

The WebhooksClient provides methods for managing workspace webhooks in the ElevenLabs API. Webhooks allow external services to receive HTTP callbacks when specific events occur in the workspace. This client supports the full lifecycle of webhook management: listing existing webhooks, creating new ones with HMAC authentication, updating webhook settings (name and enabled/disabled state), and deleting webhooks.

The client is accessible via client.webhooks on an ElevenLabs instance. Both synchronous (WebhooksClient) and asynchronous (AsyncWebhooksClient) variants are provided. A raw response variant is available via the with_raw_response property, which returns HttpResponse objects containing both the parsed data and the underlying HTTP response.

API Endpoints

Method HTTP Endpoint
list() GET v1/workspace/webhooks
create() POST v1/workspace/webhooks
delete() DELETE v1/workspace/webhooks/{webhook_id}
update() PATCH v1/workspace/webhooks/{webhook_id}

Code Reference

Source Location

  • High-level client: src/elevenlabs/webhooks/client.py
  • Raw client: src/elevenlabs/webhooks/raw_client.py

Class Signatures

class WebhooksClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper): ...

class AsyncWebhooksClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper): ...

Import

The client is not typically imported directly. Instead, it is accessed through the main ElevenLabs client:

from elevenlabs import ElevenLabs

client = ElevenLabs(api_key="YOUR_API_KEY")
client.webhooks  # WebhooksClient instance

I/O Contract

list()

List all webhooks for a workspace.

Input Parameters:

Parameter Type Required Description
include_usages typing.Optional[bool] No Whether to include active usages of the webhook, only usable by admins
request_options typing.Optional[RequestOptions] No Request-specific configuration

Output:

Type Description
WorkspaceWebhookListResponseModel List of all workspace webhooks

create()

Create a new webhook for the workspace with the specified authentication type.

Input Parameters:

Parameter Type Required Description
settings WebhookHmacSettings Yes Webhook settings object containing auth_type and corresponding configuration (name, webhook_url)
request_options typing.Optional[RequestOptions] No Request-specific configuration

Output:

Type Description
WorkspaceCreateWebhookResponseModel Created webhook details

delete()

Delete the specified workspace webhook.

Input Parameters:

Parameter Type Required Description
webhook_id str Yes The unique ID for the webhook
request_options typing.Optional[RequestOptions] No Request-specific configuration

Output:

Type Description
DeleteWorkspaceWebhookResponseModel Deletion confirmation response

update()

Update the specified workspace webhook.

Input Parameters:

Parameter Type Required Description
webhook_id str Yes The unique ID for the webhook
is_disabled bool Yes Whether to disable or enable the webhook
name str Yes The display name of the webhook (used for display purposes only)
request_options typing.Optional[RequestOptions] No Request-specific configuration

Output:

Type Description
PatchWorkspaceWebhookResponseModel Updated webhook details

Error Handling

All methods may raise:

  • UnprocessableEntityError (HTTP 422) -- contains an HttpValidationError body with validation details.
  • ApiError -- for all other non-2xx HTTP status codes.

Usage Examples

List Webhooks

from elevenlabs import ElevenLabs

client = ElevenLabs(
    api_key="YOUR_API_KEY",
)
response = client.webhooks.list(
    include_usages=False,
)

Create a Webhook

from elevenlabs import ElevenLabs, WebhookHmacSettings

client = ElevenLabs(
    api_key="YOUR_API_KEY",
)
response = client.webhooks.create(
    settings=WebhookHmacSettings(
        name="name",
        webhook_url="webhook_url",
    ),
)

Delete a Webhook

from elevenlabs import ElevenLabs

client = ElevenLabs(
    api_key="YOUR_API_KEY",
)
response = client.webhooks.delete(
    webhook_id="G007vmtq9uWYl7SUW9zGS8GZZa1K",
)

Update a Webhook

from elevenlabs import ElevenLabs

client = ElevenLabs(
    api_key="YOUR_API_KEY",
)
response = client.webhooks.update(
    webhook_id="G007vmtq9uWYl7SUW9zGS8GZZa1K",
    is_disabled=True,
    name="My Callback Webhook",
)

Async Usage

import asyncio
from elevenlabs import AsyncElevenLabs, WebhookHmacSettings

client = AsyncElevenLabs(
    api_key="YOUR_API_KEY",
)

async def main() -> None:
    # List webhooks
    webhooks = await client.webhooks.list(include_usages=False)

    # Create a webhook
    created = await client.webhooks.create(
        settings=WebhookHmacSettings(
            name="name",
            webhook_url="webhook_url",
        ),
    )

    # Update a webhook
    updated = await client.webhooks.update(
        webhook_id="G007vmtq9uWYl7SUW9zGS8GZZa1K",
        is_disabled=True,
        name="My Callback Webhook",
    )

    # Delete a webhook
    deleted = await client.webhooks.delete(
        webhook_id="G007vmtq9uWYl7SUW9zGS8GZZa1K",
    )

asyncio.run(main())

Raw Response Access

from elevenlabs import ElevenLabs

client = ElevenLabs(api_key="YOUR_API_KEY")

# Access the raw HTTP response alongside parsed data
raw_response = client.webhooks.with_raw_response.list(include_usages=False)
print(raw_response.response.status_code)
print(raw_response.data)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment