1) Set metadata and headers during authorization
Include the optionalcustom_metadata and custom_headers objects in your call to POST /v1/agents/web/authorize_session (see REST API docs). Both fields must be plain JSON objects.
Next.js app/api/authorize/route.ts
2) Read the metadata in your webhook handler
Every webhook invocation now includes the metadata you provided:3) Inspect custom headers on receipt
Layercode prepends two headers to every webhook call:Content-Type: application/json and layercode-signature. Your custom headers are then appended.
webhook-handler.ts