# Webhooks ## View webhooks `client.stream.webhooks.get(WebhookGetParamsparams, RequestOptionsoptions?): WebhookGetResponse` **get** `/accounts/{account_id}/stream/webhook` Retrieves a list of webhooks. ### Parameters - `params: WebhookGetParams` - `account_id: string` The account identifier tag. ### Returns - `WebhookGetResponse = unknown` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const webhook = await client.stream.webhooks.get({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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": {} } ``` ## Create webhooks `client.stream.webhooks.update(WebhookUpdateParamsparams, RequestOptionsoptions?): WebhookUpdateResponse` **put** `/accounts/{account_id}/stream/webhook` Creates a webhook notification. ### Parameters - `params: WebhookUpdateParams` - `account_id: string` Path param: The account identifier tag. - `notificationUrl: string` Body param: The URL where webhooks will be sent. ### Returns - `WebhookUpdateResponse = unknown` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const webhook = await client.stream.webhooks.update({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', notificationUrl: 'https://example.com', }); console.log(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": {} } ``` ## Delete webhooks `client.stream.webhooks.delete(WebhookDeleteParamsparams, RequestOptionsoptions?): WebhookDeleteResponse` **delete** `/accounts/{account_id}/stream/webhook` Deletes a webhook. ### Parameters - `params: WebhookDeleteParams` - `account_id: string` The account identifier tag. ### Returns - `WebhookDeleteResponse = string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const webhook = await client.stream.webhooks.delete({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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 - `WebhookGetResponse = unknown` ### Webhook Update Response - `WebhookUpdateResponse = unknown` ### Webhook Delete Response - `WebhookDeleteResponse = string`