Skip to main content
Socket events are for the signed-in browser on an open connection. Webhooks are HTTPS posts to your server. The socket stops when the tab closes. Failed webhook deliveries are retried on a bounded schedule. Use the socket for live UI and webhooks for the record of the same action.

How it works

1

Register an endpoint

Create a webhook endpoint from the admin dashboard. Select a URL and the event types you want to receive. The dashboard displays your signing secret (whsec_...) — store it in your secrets manager immediately.
2

Receive events

AGG sends POST requests to your URL with a JSON payload and Webhook-Signature header.
3

Verify the signature

Use parseWebhookEvent from the SDK to verify the signature and parse the event in one call. This prevents spoofed requests.
4

Return 2xx

Verify and durably record the event, then respond promptly with a 2xx status. Process slow work asynchronously. Timeouts and non-2xx responses trigger the retry schedule below.

Event types

markets.resolved carries outcomes[] (label, winner, externalIdentifier, payoutPerShare, refundAtCost). It does not carry a singular outcome. Shapes are on the event reference.
Webhook payloads are intentionally minimal — they carry IDs and timestamps. Query the API for full details. accounts.created.email is populated when AGG has an email from magic-link or OAuth sign-in; otherwise it is null.

Delivery behavior

Deduplicate on the Webhook-Id header. It is the same value on every retry of a delivery. Failed deliveries retry after 5 seconds, 5 minutes, 30 minutes, 2 hours, 5 hours, 10 hours, and another 10 hours. Each delay starts after the preceding failure. After retries are exhausted, inspect the delivery and replay it after fixing your endpoint. Persistently failing endpoints can be disabled. Check endpoint status after an outage. Deliveries can be duplicated or arrive out of order, including for the same app. Use resource IDs to reconcile with current API state and deduplicate atomically.

Signature headers

Rotate and replay

Create, delete, pause, and resume endpoints, and change their URL or event types, in the admin dashboard. These two calls use x-app-api-key only. Send an empty JSON body. Rotate issues a new signing secret, returned once. You cannot read it back later.
Rotate webhook signing secret. Replay re-queues the endpoint’s failed deliveries from the last 7 days and returns { success }.
Replay failed deliveries.

Next steps

Verifying signatures

Verify webhook authenticity with the SDK or manually

Event reference

Full payload schemas for every event type