Skip to main content
End Close webhooks send an HTTPS POST to your server when something happens in End Close, such as a record being reconciled. Each delivery is a signed JSON event, so your systems can react without polling the API. Webhooks are a premium feature. To turn them on, contact End Close.

Set up a webhook endpoint

1

Build a handler

Add an HTTPS route to your app that accepts POST requests with a JSON body. Keep access to the raw request body, because you need the exact bytes to verify the signature.
2

Request access

Email founders@endclose.com with your endpoint URL and the events you want. End Close sets up the endpoint for you.
3

Store the signing secret

End Close gives you a signing secret for the endpoint. It’s shown once, so store it in a secrets manager or environment variable straight away.
4

Verify every delivery

Check the End-Close-Signature header on each request before you trust the payload, as described below.

Event payload

Every delivery has the same envelope. The data object holds the resource the event is about.
record.reconciled
See Webhook events for each event and when it fires.

Verify the signature

End Close signs every delivery with your endpoint’s signing secret and puts the result in the End-Close-Signature header:
Header
  • t is the time the delivery was signed, in Unix seconds.
  • v1 is the hex-encoded HMAC-SHA256 of the string <t>.<raw request body>, keyed with your signing secret.
To verify a delivery:
  1. Split the header on , and read the t and v1 values.
  2. Reject the request if t is more than 5 minutes from your server’s current time. This stops an attacker replaying an old delivery.
  3. Build the signed string: the t value, a period, then the raw request body exactly as received.
  4. Compute HMAC-SHA256 of that string with your signing secret and hex-encode it.
  5. Compare your result with v1 using a constant-time comparison. Reject the request if they differ.
Compute the signature over the raw body bytes. If your framework parses the JSON and you serialize it again, whitespace or key order can change and the signature won’t match.

Respond quickly

Return a 2xx status as soon as you’ve verified and stored the event. Do slow work, such as updating your ledger or calling other APIs, in a background job after you respond.

Retries and duplicate deliveries

When a delivery fails, End Close retries it with exponential backoff. Because of retries, your endpoint can receive the same event more than once. Make your handler idempotent: record each event’s id when you process it, and skip any event whose id you’ve already handled.

FAQ

Webhooks are a premium feature. Email founders@endclose.com with your endpoint URL and the events you want, and End Close sets up the endpoint and sends you its signing secret.
The most common cause is signing a re-serialized body instead of the raw bytes. Also check that you’re using the secret for this endpoint, that you include the t value and the period in the signed string, and that your server clock is accurate to within 5 minutes.
Yes. Retries mean a delivery can repeat. Deduplicate on the event id.

Webhook events

Every event End Close sends, with example payloads.

Records

The record object that record events carry.