Skip to main content
Each time an order, an application or an allocation changes state, or more of an order fills, we create an event. We send it to your webhook endpoint as an HTTPS POST, and you can also read it from GET /v1/events for 30 days. The format follows Standard Webhooks, so any Standard Webhooks library can verify our signatures.

Register your endpoint

An Administrator registers your endpoint in your partner portal, under Developers, then Webhooks; there’s no API for this. The portal shows its signing secret once, never again: store it in your secrets manager, and if you lose it, rotate it. If no one at your company can sign in to the portal, send us the URL, and we send its signing secret to your technical contact through a one-time link. The sandbox and live each have one endpoint, with its own secret. The URL must meet these rules: We check the address each time we connect, after the host name resolves. We use no proxy and follow no redirects. We send events from our server’s own IP address, which we give you with a signing secret we send, or when you ask us. You can allowlist it on your firewall, but you don’t have to: the signature proves an event came from us, and an allowlist adds to checking it, never replaces it. If we move servers, the address changes, and we email your technical contact at least seven days before. You receive events created after your endpoint is registered; earlier ones are in GET /v1/events. To move to a new URL, change it on the same page: your secret stays, and events still due go to the new URL. If saving the endpoint shows an error, reload the page before you try again: the endpoint may already be registered. If it is, and you never saw its secret, rotate the secret with no overlap.

What we send

Each event is a POST with a JSON body and these headers: The body is the event: the same object GET /v1/events lists, with object and id included. Here it is formatted for reading:
Event body

Event types

Every state after sending sends an event, including the outcome the create request already returned to you. There’s no event for sending itself, and none for a credit or a withdrawal entry in your wallet: read them in GET /v1/wallet/transfers. New event types can appear without notice. Ignore any type you don’t handle. See Versioning.

Account and partner controls

We can block one of your accounts, for example during a fraud review or under a court order, without pausing the rest of your integration. We tell you each time we change an account’s controls or your partner account’s own. The data of these two events is the controls as the change left them, with our reason and never the name of the person who made it. On an account, each control carries its own reason while it’s on, and null once it’s lifted:
account.restriction_changed data
partner.status_changed data
Cancels, estimates and reads still work on a blocked account, and your other accounts aren’t affected. To see an account’s controls as they stand now, with when each was set, read its restrictions from GET /v1/accounts/{account} or GET /v1/accounts. While your partner account is suspended or closed, we hold every event, these included, and send them in order once a suspension is lifted. A closed partner account’s events are not sent.

Security restrictions

We can restrict one symbol for every partner, for example ahead of a corporate action. We send every partner security.restriction_changed each time we restrict a symbol, move it from one restriction to the other, or lift it. The data is the symbol and its restriction as the change left it, with no reason:
security.restriction_changed data
Cancels and reads always work, and we don’t cancel your open orders in the symbol: cancel any you no longer want.

Verify each event

Check the signature before you trust an event. Anyone who learns your URL can send it a request.
1

Read the raw body

Use the body bytes exactly as they arrived. Parsing the JSON and writing it out again changes the bytes, and the signature won’t match.
2

Check the timestamp

Reject the event if webhook-timestamp is more than 5 minutes before or after your server’s clock: the Standard Webhooks libraries’ default, which stops an old event being replayed. We stamp each attempt when we send it, so a retry carries a fresh timestamp.
3

Build the signed content

Join the webhook-id header, the webhook-timestamp header and the raw body with a full stop between each: id.timestamp.body.
4

Compute the signature

Your secret starts with whsec_. Base64 decode the part after whsec_, and use the decoded bytes as the key, not the secret text itself. Compute an HMAC-SHA256 of the signed content with that key, and base64 encode the result.
5

Compare

Split webhook-signature on spaces. Accept the event if any entry is v1, followed by your value. Compare with a constant-time function, not ==.

Test your verification

Run your code against this example before your first real event. The secret is made up and signs nothing else. The event is the quickstart’s order, filled, with a made-up account code, its body on one line, exactly as we send it. Your code should accept it once you allow for the old timestamp.
Test vector

Respond

Return any 2xx status within 10 seconds. We read up to 64 KiB of your response and ignore what it says. Save the event and do the work after you respond, so a slow task doesn’t turn into a failed delivery:
Node.js

Retries

We send each new event within about 5 seconds of recording the change. We try each event on this schedule until one attempt succeeds: The tenth attempt, 27 hours and 51 minutes after the change, is the last. The hour after it allows for delays between attempts. Until then an event can still be delivered, such as by a paused endpoint’s probe. We stop sending an event 28 hours and 51 minutes after the change it describes. It stays in GET /v1/events. If your endpoint was down for longer, you can also ask us to send the events we stopped sending since a time you name. We send the same events again, with the same webhook-id, and a new 28 hours and 51 minutes of retries from when we start. While your endpoint is paused, each event’s own retry schedule doesn’t apply: each probe is the oldest event waiting. A pause doesn’t change when we stop sending an event. Delivery is at least once. You can receive the same event twice, and a retried event can arrive after a newer one. Use webhook-id to ignore duplicates, and compare version per object to ignore stale changes.

Catch up on missed events

GET /v1/events lists every event for 30 days, oldest first, whether or not your endpoint accepted it. Use it after downtime, or instead of a webhook endpoint.
  1. Call GET /v1/events without a cursor. Pass limit to set the page size, from 1 to 100. The default is 25.
  2. Process the events, then store the next_cursor from the response. If your first call returns no events, next_cursor is null, so call again without a cursor next time.
  3. Next time, pass that value as cursor. When there are no new events, you get an empty page and the same cursor back, so keep it for next time.
A cursor is a place in the list, not an event, so it never expires. From a cursor older than the 30 days, the list starts at the oldest event we still hold. If you poll instead of receiving webhooks, call GET /v1/events every 30 seconds.

Rotate your secret

An Administrator rotates your secret on the same page of your partner portal, and chooses how long the old secret keeps signing: up to 24 hours, or not at all. The portal shows the new secret once. During the overlap we sign every event with both secrets, so webhook-signature carries two entries, the new one first. Switch your server to the new secret before the overlap ends. Another rotation with an overlap can start only after the overlap ends. If your secret has leaked, rotate it with no overlap: the old secret stops signing at once, and so does any secret still in an overlap. See If a signing secret leaks. If no one at your company can sign in to the portal, ask us to rotate it. We rotate it with an overlap of 24 hours.

Test webhooks in the sandbox

The sandbox sends events the same way live does, under the same rules:
  • Your endpoint needs a public https URL that meets the rules. To receive events on your own machine, use a tunnelling service: it gives your local server a public HTTPS address and forwards requests to it.
  • Your sandbox endpoint has its own secret. Keep it apart from your live one.
To rehearse the failures your endpoint will meet in live: