Accountflow Developer prod

Webhooks

Signed, at-least-once events for changes in your organization.

An event names what happened to which resource; fetch the resource's current state through the API. Payloads never carry entity bodies.

Delivery

Property Behaviour
At-least-once An event can arrive more than once. Dedupe on the event id; answer duplicates with 2xx.
Unordered Events can arrive out of order. Fetch the resource; don't rebuild state from event order.
Timeout Answer 2xx within 10 seconds; acknowledge first, process later. A timeout is a failure. Bridge reads at most 64 KiB of your response.
Retries A non-2xx or a timeout is retried, with jitter, 2m, 10m, 30m, 1h, 3h, 8h and 11h after the failed attempt: 8 attempts over about 24 hours. Then the delivery is DEAD.
Auto-disable After 3 consecutive dead deliveries the endpoint is DISABLED with a reason. Its queued deliveries are cancelled, and events are not held while it is disabled.
Re-enable Only a PATCH that changes url re-enables an endpoint, and it re-runs the handshake. A PATCH with the same url does neither.
Deleted endpoint Its queued deliveries are cancelled.
Suspended or revoked API client Its endpoints get nothing, and their queued deliveries are cancelled (lastError cancelled: api client inactive). Nothing is held for reactivation. The endpoint's status doesn't change.
Terminated organization For 90 days it is read-only and its events are still delivered. After that, its events and those of the organizations below it reach no endpoint, and queued ones are cancelled (lastError cancelled: organization out of reach). The same holds for a deactivated or deleted organization. A parent organization's endpoint keeps hearing the rest of its subtree.

GET /organizations/{organizationId}/webhooks/{webhookId}/deliveries is the delivery log: one row per event and endpoint (not per attempt), with status (PENDING, DELIVERED, DEAD), attempts, lastStatusCode, lastError, the exact payload and deliveredAt. A cancelled delivery is DEAD with a lastError starting cancelled: and no lastStatusCode.

Event payload

{
  "id": "9a3f6d0e-8c2b-4d51-b1a7-2f4e5d6c7b8a",
  "type": "reconciliation.created",
  "occurredAt": "2026-08-20T12:34:56.789Z",
  "data": {
    "resourceType": "reconciliation",
    "resourceId": "c2d3e4f5-…",
    "companyId": "b1c2d3e4-…",
    "organizationId": "a0b1c2d3-…"
  }
}

What raises an event

Writes through /v1 by an API client (companies, access policies, webhook endpoints, documents, reconciliation groups, imports and corrections) and the jobs they start.

Facts Accountflow records, whoever caused them (the app, its users, automation, runs, ERP and bank fetches, the task service), announced a few seconds later. Each fact is announced once; a re-delivered one keeps its id.

Nothing else raises an event:

To follow anything else, read it on a schedule.

Event catalog

Events up to job.failed come from writes through /v1; the rest from facts Accountflow records. companyId "yes" means data.companyId is set.

Type resourceType companyId When
company.created company yes POST /organizations/{organizationId}/companies
company.updated company yes PATCH /companies/{companyId}
company.disabled company yes POST /companies/{companyId}/actions/disable
company.enabled company yes POST /companies/{companyId}/actions/enable
company.deleted company yes DELETE /companies/{companyId} (soft delete)
company.restored company yes POST /companies/{companyId}/actions/restore
access_policy.created access_policy — A policy was created.
access_policy.updated access_policy — A policy or its rules changed.
access_policy.archived access_policy — POST …/access-policies/{policyId}/actions/archive
access_policy.assigned access_policy — A user was assigned the policy.
access_policy.revoked access_policy — An assignment was revoked.
document.uploaded document yes POST /documents/{documentId}/actions/complete
document.renamed document yes PATCH /documents/{documentId}
document.deleted document yes DELETE /documents/{documentId}
document.restored document yes POST /documents/{documentId}/actions/restore
reconciliation.created reconciliation yes POST /companies/{companyId}/bank/reconciliations
reconciliation.deleted reconciliation yes DELETE /companies/{companyId}/reconciliations/{reconciliationGroupId}
webhook_endpoint.created webhook_endpoint — An endpoint was registered.
webhook_endpoint.updated webhook_endpoint — An endpoint was patched.
webhook_endpoint.deleted webhook_endpoint — An endpoint was deleted.
webhook_endpoint.secret_rotated webhook_endpoint — POST …/webhooks/{webhookId}/actions/rotate-secret
import.requested company yes An import was accepted (202). The resource is the company; list its imports with GET /companies/{companyId}/imports. The outcome is job.succeeded or job.failed for the import's jobId.
correction.requested company yes A deletion was accepted (202). As import.requested.
ledger.created company yes POST /companies/{companyId}/ledgers created the year's Api ledger. Its current says whether it became current; list with GET /companies/{companyId}/ledgers.
job.succeeded job — A job succeeded. GET /jobs/{jobId} names the import it ran (resource).
job.failed job — A job failed, including an import settled as FAILED because its job expired or crashed.
reconciliation_run.completed reconciliation_run yes A run ended SUCCEEDED or SKIPPED: scheduled, ordered in the app, or ordered with POST …/reconciliation-runs. Read it at GET /companies/{companyId}/reconciliation-runs/{runId} (runId is resourceId). Each period it approves raises its own approval.granted a moment later.
reconciliation_run.failed reconciliation_run yes A run ended FAILED: it failed, core refused it, or a run ordered here was not delivered (not_delivered) or not started within two hours (not_started). One terminal event per run, the first end seen. Rarely, a not_delivered run is run later and reads SUCCEEDED; act on what the run says.
erp_fetch.completed erp_fetch yes An ERP fetch finished, whoever ordered it, including an API import that changed a ledger. resourceId is the fetch's correlationId. Read GET /companies/{companyId}/data-freshness.
erp_fetch.failed erp_fetch yes An ERP fetch failed. recentFailures in data freshness names it.
import.completed company or organization yes, except organization imports An import made in the app finished: an import-center dataset, a trial balance, a migration from Accountflow 1.x (one event per dataset), or an organization import (companies, users). An API import raises job.succeeded instead. Read GET /companies/{companyId}/data-freshness.
import.failed company or organization as above Such an import failed.
bank_fetch.completed company yes The company's bank accounts were read. Read GET /companies/{companyId}/bank/accounts and the transactions.
bank_fetch.failed company yes The bank could not be read.
approval.granted approval yes An account period was approved: by a person, an approval policy, automation or a 1.x migration. resourceId is the approvalId. Read GET /companies/{companyId}/approvals?accountNumber=… or the account's reconciliation (approval.approvalId).
approval.revoked approval yes An approval was revoked.
task.changed task yes A task's status or evidence changed. Read GET /companies/{companyId}/tasks/{taskId} (taskId is resourceId).

Registration handshake

A new endpoint, or one whose url changed, is PENDING_VERIFICATION. Bridge POSTs a signed webhook.verification event (not a type you subscribe to):

{ "type": "webhook.verification", "data": { "challenge": "f1ac40a6c8e44f5b9e2d7a31b0c65d18" } }

Answer 2xx with the lowercase hex HMAC-SHA256(secret, challenge) anywhere in the body, keyed with the whole whsec_… secret. Echoing the challenge is not enough. Suggested:

{ "challengeResponse": "2aacbbe8c5fcbb8b1428b009fa873d65e747b56eab9fb0c432c152c4604aae20" }

That is the answer for secret whsec_testsecret and the challenge above. The endpoint then turns ACTIVE.

import hashlib, hmac, json

def answer_challenge(body: bytes, secret: str) -> bytes:
    challenge = json.loads(body)["data"]["challenge"]
    digest = hmac.new(secret.encode(), challenge.encode(), hashlib.sha256).hexdigest()
    return json.dumps({"challengeResponse": digest}).encode()

Signature verification

Every delivery carries:

Webhook-Signature: t=<unix-seconds>,v1=<hex-hmac-sha256>

v1 is the hex HMAC-SHA256(secret, "<t>" + "." + <raw request body>). The secret (whsec_…) is shown once, when you create the endpoint or rotate the secret.

  1. Parse t and v1.
  2. Reject if |now − t| exceeds your tolerance (5 minutes is a good default).
  3. Compute the HMAC over the raw body bytes, before any JSON parsing, and compare to v1 in constant time.

Test vector

Field Value
secret whsec_testsecret
t 1700000000
body {"id":"evt_00000000-0000-4000-8000-000000000001","type":"company.created"}
signature t=1700000000,v1=c9be8761917e51cda36abc9ae6eaa0d6cb5c4a0874f22dd6efb6c3655b6ff018
import hmac, hashlib, time

def verify(header: str, body: bytes, secret: str, tolerance_s: int = 300) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    t, v1 = int(parts["t"]), parts["v1"]
    if abs(time.time() - t) > tolerance_s:
        return False
    expected = hmac.new(secret.encode(), f"{t}.".encode() + body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, v1)

Endpoint requirements