---
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');

// Replace these with the raw body and the HTTP headers of the incoming webhook request.
$body = '{"type":"event","id":"whe_0f1e2d3c4b5a69788796a5b4c3d2e1f0","created_at":"2026-03-15T10:00:00Z","data":{"type":"session.status_idled"}}';
$headers = [
  'webhook-id' => 'msg_0123456789',
  'webhook-timestamp' => '1773568800',
  'webhook-signature' => 'v1,ZmFrZS1zaWduYXR1cmU=',
];
$event = $client->beta->webhooks->unwrap($body, $headers);

var_dump($event);
```
