Claude Platform Docs

Unwrap

UnwrapWebhookEvent beta().webhooks().unwrap(unwrapParams)
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
UnwrapWebhookParams unwrapParams
String body

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

Headers headers

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

Optional<String> secret

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

Returns
class UnwrapWebhookEvent { type = "event"; id; createdAt; data; }
JsonValue type = "event"

Object type. Always event for webhook payloads.

String id

Unique event identifier for idempotency.

OffsetDateTime createdAt

RFC 3339 timestamp when the event occurred.

formatdate-time
One of the following:
Unwrap
package com.anthropic.example;

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.core.UnwrapWebhookParams;
import com.anthropic.models.beta.webhooks.UnwrapWebhookEvent;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        AnthropicClient client = AnthropicOkHttpClient.fromEnv();

        // `body` is the raw body of the incoming webhook request and `headers` are its HTTP headers as a `Headers` (`Headers.builder().put(name, value).build()`).
        UnwrapWebhookParams params = UnwrapWebhookParams.builder()
            .body(body)
            .headers(headers)
            .build();
        UnwrapWebhookEvent event = client.beta().webhooks().unwrap(params);
    }
}