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

# Managing Webhooks

> List, create, update, and delete webhook endpoints with the Lettr Go SDK to receive real-time email event notifications.

Webhooks deliver real-time notifications when emails are delivered, opened, clicked, bounced, or marked as spam. The `client.Webhooks` service manages your endpoints.

For the event payload format and signature verification, see [Webhooks](/learn/webhooks/introduction).

```go theme={null}
import lettr "github.com/lettr-com/lettr-go"

client := lettr.NewClient("your-api-key")
```

## List Webhooks

```go theme={null}
webhooks, err := client.Webhooks.List(ctx)
```

<Card title="API Reference" icon="book" href="/api-reference/webhooks/list-webhooks">
  GET /webhooks
</Card>

## Create a Webhook

```go theme={null}
// Receive all events
created, err := client.Webhooks.Create(ctx, &lettr.CreateWebhookRequest{
    Name:       "My Webhook",
    URL:        "https://example.com/webhook",
    AuthType:   "none",
    EventsMode: "all",
})

// Receive selected events with basic auth.
// Event names use the namespaced form — see the lettr.Event* constants.
created, err = client.Webhooks.Create(ctx, &lettr.CreateWebhookRequest{
    Name:         "Delivery Webhook",
    URL:          "https://example.com/webhook",
    AuthType:     "basic",
    AuthUsername: "user",
    AuthPassword: "pass",
    EventsMode:   "selected",
    Events: []string{
        lettr.EventMessageDelivery,
        lettr.EventMessageBounce,
        lettr.EventMessageSpamComplaint,
    },
})
```

<Card title="API Reference" icon="book" href="/api-reference/webhooks/create-webhook">
  POST /webhooks
</Card>

## Get a Webhook

```go theme={null}
webhook, err := client.Webhooks.Get(ctx, "webhook-id")
```

<Card title="API Reference" icon="book" href="/api-reference/webhooks/get-webhook">
  GET /webhooks/{webhook}
</Card>

## Update a Webhook

Set only the fields you want to change. Optional booleans like `Active` are pointers:

```go theme={null}
active := false
updated, err := client.Webhooks.Update(ctx, "webhook-id", &lettr.UpdateWebhookRequest{
    Name:   "Renamed Webhook",
    URL:    "https://example.com/new-webhook",
    Active: &active,
})
```

<Card title="API Reference" icon="book" href="/api-reference/webhooks/update-webhook">
  PATCH /webhooks/{webhook}
</Card>

## Delete a Webhook

```go theme={null}
_, err = client.Webhooks.Delete(ctx, "webhook-id")
```

<Card title="API Reference" icon="book" href="/api-reference/webhooks/delete-webhook">
  DELETE /webhooks/{webhook}
</Card>

## What's Next

<CardGroup cols={2}>
  <Card title="Webhook Events" icon="bell" href="/learn/webhooks/introduction">
    Event types and payload format
  </Card>

  <Card title="Webhook Authorization" icon="shield-check" href="/learn/webhooks/authorization">
    Verify webhook authenticity
  </Card>
</CardGroup>
