---
title: Unwrap
url: https://platform.claude.com/docs/en/api/php/beta/webhooks/unwrap
---

# Unwrap

`$client->beta->webhooks->unwrap(string body, array<string,string | list<string>> headers, ?string secret): BetaWebhookEvent`

Verifies the webhook signature from the `webhook-id`, `webhook-timestamp` and `webhook-signature`
headers using your webhook signing key, then parses the payload into an event. Fails if the
signature is missing or invalid.

## Parameters

- `body: string`

  The body of the incoming webhook request, exactly as received: the signature is computed over these bytes.

- `headers: array<string,string | list<string>>`

  The HTTP headers of the incoming webhook request. Verification reads `webhook-id`, `webhook-timestamp` and `webhook-signature`.

- `secret: optional string`

  The webhook signing key. Defaults to the client's `webhookKey` option.

## Returns

- `class BetaWebhookEvent`

  - `"event" type`

    Object type. Always `event` for webhook payloads.

  - `string id`

    Unique event identifier for idempotency.

  - `\Datetime createdAt`

    RFC 3339 timestamp when the event occurred.

  - `BetaWebhookEventData data`

## Example

```php
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Anthropic\Client;

$client = new Client(apiKey: 'my-anthropic-api-key');

// $body is the raw body of the incoming webhook request and $headers are its HTTP headers.
$event = $client->beta->webhooks->unwrap($body, $headers);

var_dump($event);
```
