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

# Create webhook endpoint

> Register a new outbound webhook endpoint on Luma with luma.webhooks.create(), passing a URL and the event types you want delivered.

<Badge color="purple">SDK</Badge> `luma.webhooks.create(body: WebhookCreateParams): Promise<Webhook>`

Registers a new webhook endpoint with Luma.

<RequestExample>
  ```typescript Example theme={null}
  import { Luma } from "@alhwyn/luma";

  const luma = new Luma(process.env.LUMA_API_KEY!);

  const endpoint = await luma.webhooks.create({
    url: "https://myapp.com/api/luma-webhook",
    event_types: ["guest.updated", "guest.registered"],
  });

  // Save endpoint.secret as LUMA_WEBHOOK_SECRET
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "api_id": "whk-abc123",
    "url": "https://myapp.com/api/luma-webhook",
    "event_types": ["guest.updated", "guest.registered"],
    "secret": "whsec_..."
  }
  ```
</ResponseExample>

### Parameters

<ParamField path="body" type="WebhookCreateParams" required>
  Endpoint URL and event types to subscribe to. See the [official Luma API docs](https://docs.luma.com) for available fields.

  `event_types` also reads from `LUMA_WEBHOOK_EVENT_TYPES` via `webhookEventTypesFromEnv()`.
</ParamField>

### Test it

```typescript theme={null}
const endpoint = await luma.webhooks.create({
  url: "https://myapp.com/api/luma-webhook",
  event_types: ["guest.updated"],
});
console.log("Endpoint ID:", endpoint.api_id);
console.log("Save secret:", endpoint.secret);
```
