Claude Platform Docs

Unwrap

client.beta.webhooks.unwrap(body, options): BetaWebhookEvent
Function

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.

options: { headers: Record<string, string>, key?: string}
headers: Record<string, string>

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

key?: string

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

Returns
interface BetaWebhookEvent { type: "event"; id; created_at; data }
type: "event"

Object type. Always event for webhook payloads.

id: string

Unique event identifier for idempotency.

created_at: string

RFC 3339 timestamp when the event occurred.

formatdate-time
One of the following:
Unwrap
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: process.env["ANTHROPIC_API_KEY"] // This is the default and can be omitted
});

// `body` is the raw body of the incoming webhook request and `headers` are its HTTP headers.
const event = client.beta.webhooks.unwrap(body, { headers });

console.log(event);