# Webhooks ## View webhooks `stream.webhooks.get(WebhookGetParams**kwargs) -> WebhookGetResponse` **get** `/accounts/{account_id}/stream/webhook` Retrieves a list of webhooks. ### Parameters - `account_id: str` The account identifier tag. ### Returns - `class WebhookGetResponse: …` - `modified: Optional[datetime]` The date and time the webhook was last modified. - `notification_url: Optional[str]` The URL where webhooks will be sent. - `notification_url: Optional[str]` The URL where webhooks will be sent. - `secret: Optional[str]` The secret used to verify webhook signatures. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) webhook = client.stream.webhooks.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(webhook.modified) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "modified": "2014-01-02T02:20:00Z", "notification_url": "https://example.com", "notificationUrl": "https://example.com", "secret": "secret" } } ``` ## Create webhooks `stream.webhooks.update(WebhookUpdateParams**kwargs) -> WebhookUpdateResponse` **put** `/accounts/{account_id}/stream/webhook` Creates a webhook notification. ### Parameters - `account_id: str` The account identifier tag. - `notification_url: Optional[str]` The URL where webhooks will be sent. - `notification_url: Optional[str]` The URL where webhooks will be sent. ### Returns - `class WebhookUpdateResponse: …` - `modified: Optional[datetime]` The date and time the webhook was last modified. - `notification_url: Optional[str]` The URL where webhooks will be sent. - `notification_url: Optional[str]` The URL where webhooks will be sent. - `secret: Optional[str]` The secret used to verify webhook signatures. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) webhook = client.stream.webhooks.update( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(webhook.modified) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "modified": "2014-01-02T02:20:00Z", "notification_url": "https://example.com", "notificationUrl": "https://example.com", "secret": "secret" } } ``` ## Delete webhooks `stream.webhooks.delete(WebhookDeleteParams**kwargs) -> WebhookDeleteResponse` **delete** `/accounts/{account_id}/stream/webhook` Deletes a webhook. ### Parameters - `account_id: str` The account identifier tag. ### Returns - `str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) webhook = client.stream.webhooks.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(webhook) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": "ok" } ``` ## Domain Types ### Webhook Get Response - `class WebhookGetResponse: …` - `modified: Optional[datetime]` The date and time the webhook was last modified. - `notification_url: Optional[str]` The URL where webhooks will be sent. - `notification_url: Optional[str]` The URL where webhooks will be sent. - `secret: Optional[str]` The secret used to verify webhook signatures. ### Webhook Update Response - `class WebhookUpdateResponse: …` - `modified: Optional[datetime]` The date and time the webhook was last modified. - `notification_url: Optional[str]` The URL where webhooks will be sent. - `notification_url: Optional[str]` The URL where webhooks will be sent. - `secret: Optional[str]` The secret used to verify webhook signatures. ### Webhook Delete Response - `str`