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

# Webhook client

> Manage webhook endpoints with the Paubox Rust SDK.

The webhook methods are on the same `PauboxClient` you use to send email. They require the `email` feature (enabled by default).

```rust theme={null}
let client = PauboxClient::new("YOUR_API_KEY");
```

All methods are async and return `Result<T, PauboxError>`.

## List webhook endpoints

```rust theme={null}
let endpoints = client.list_webhook_endpoints().await?;
for ep in &endpoints {
    println!("{}: {} (active: {:?})", ep.id, ep.target_url, ep.active);
}
```

## Create a webhook endpoint

```rust theme={null}
let endpoint = client.create_webhook_endpoint(
    "https://example.com/webhooks/paubox",
    &["inbound_mail_received", "api_mail_log_delivered"],
    Some("whsec_abc123"), // signing_key
    None,                 // active (defaults to true)
).await?;
println!("Created: {}", endpoint.id);
```

## Get a webhook endpoint

```rust theme={null}
let endpoint = client.get_webhook_endpoint(42).await?;
```

## Update a webhook endpoint

```rust theme={null}
use paubox::webhooks::UpdateWebhookEndpoint;

let updated = client.update_webhook_endpoint(42, UpdateWebhookEndpoint {
    active: Some(false),
    ..Default::default()
}).await?;
```

## Delete a webhook endpoint

```rust theme={null}
client.delete_webhook_endpoint(42).await?;
```
