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

# Webhooks

> SDK reference for the Webhooks resource (TypeScript & Python)

## Create Webhook

`POST /v1/webhooks` — createWebhook

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Webhooks } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Webhooks.createWebhook({
    body: {
      url: 'https://your-app.example.com/anchor/webhooks',
      subscribed_events: ['task.completed']
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.webhooks.create_webhook(
      url="https://your-app.example.com/anchor/webhooks",
      subscribed_events=["task.completed"],
  )
  print(result)
  ```
</CodeGroup>

## List Webhooks

`GET /v1/webhooks` — listWebhooks

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Webhooks } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Webhooks.listWebhooks();
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.webhooks.list_webhooks()
  print(result)
  ```
</CodeGroup>

## Get Webhook

`GET /v1/webhooks/{id}` — getWebhook

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Webhooks } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Webhooks.getWebhook({
    path: {
      id: 'your-id'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.webhooks.get_webhook(
      "your-id",
  )
  print(result)
  ```
</CodeGroup>

## Update Webhook

`PATCH /v1/webhooks/{id}` — updateWebhook

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Webhooks } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Webhooks.updateWebhook({
    path: {
      id: 'your-id'
    },
    body: {}
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.webhooks.update_webhook(
      "your-id",
  )
  print(result)
  ```
</CodeGroup>

## Delete Webhook

`DELETE /v1/webhooks/{id}` — deleteWebhook

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Webhooks } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Webhooks.deleteWebhook({
    path: {
      id: 'your-id'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.webhooks.delete_webhook(
      "your-id",
  )
  print(result)
  ```
</CodeGroup>

## Rotate Webhook Signing Secret

`POST /v1/webhooks/{id}/rotate-secret` — rotateWebhookSecret

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Webhooks } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Webhooks.rotateWebhookSecret({
    path: {
      id: 'your-id'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.webhooks.rotate_webhook_secret(
      "your-id",
  )
  print(result)
  ```
</CodeGroup>

## Send Test Event

`POST /v1/webhooks/{id}/test` — sendWebhookTestEvent

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Webhooks } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Webhooks.sendWebhookTestEvent({
    path: {
      id: 'your-id'
    },
    body: {
      event_type: 'task.completed'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.webhooks.send_webhook_test_event(
      "your-id",
      event_type="task.completed",
  )
  print(result)
  ```
</CodeGroup>

## List Webhook Deliveries

`GET /v1/webhooks/{id}/events` — listWebhookEvents

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Webhooks } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Webhooks.listWebhookEvents({
    path: {
      id: 'your-id'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.webhooks.list_webhook_events(
      "your-id",
  )
  print(result)
  ```
</CodeGroup>
