Skip to main content
Skip to content
Fininvo

Developer docs

Webhooks

Register Fininvo webhook endpoints, choose event types, verify signatures in Node.js and Python, and understand delivery, retries and the delivery log.

On this page

Status: specification for Public API v1. Not live yet.

A webhook is an HTTPS request Fininvo sends to your server when something happens, so you do not have to poll.

Registering an endpoint

  1. Settings → Developers → Webhooks → Add endpoint.
  2. Enter the URL. It must be https:// on port 443 and reachable from the public internet. Private, loopback and internal addresses are refused.
  3. Select the events you want. Subscribe only to what you use.
  4. Copy the signing secret (whsec_...). It is shown once.
  5. Choose Send test. The endpoint becomes active only after your server answers the test with a 2xx status.

The number of endpoints depends on your plan (1 on Growth, 5 on Business, 20 on Enterprise as standard). See Settings → Subscription for your limit.

Event types

ERP

TypeSent when
erp.invoice.createdAn invoice is created
erp.invoice.updatedAn invoice changes
erp.invoice.paidAn invoice is fully paid
erp.invoice.cancelledAn invoice is cancelled
erp.payment.receivedA customer payment is recorded
erp.customer.created, erp.customer.updatedA customer is created or changed
erp.item.created, erp.item.updatedAn item is created or changed

HRMS

TypeSent when
hr.employee.createdAn employee is added
hr.employee.updatedDirectory fields of an employee change
hr.employee.terminatedAn employee is marked as exited
hr.leave.requested, hr.leave.approved, hr.leave.rejectedA leave request changes state

Payroll

TypeSent when
payroll.run.finalizedA payroll run is finalized
payroll.payslip.publishedA payslip is published to an employee

New event types are added over time. Ignore types you do not recognise.

Payload

JSON
{
  "id": "evt_01JD8Z3K9Q...",
  "type": "erp.invoice.paid",
  "apiVersion": "v1",
  "createdAt": "2026-11-26T10:15:42Z",
  "data": {
    "object": {
      "id": "6f1c...",
      "number": "INV-2026-00412",
      "status": "PAID",
      "customerId": "9a77...",
      "currency": "INR",
      "total": "13000.00",
      "amountDue": "0.00",
      "updatedAt": "2026-11-26T10:15:41Z"
    }
  }
}

data.object has the same shape as the matching API resource.

Two deliberate limits:

  • Sensitive employee fields are never sent in webhooks, whatever scopes your keys have.
  • Payroll events are thin: they carry ids and status only. Fetch the details with the API, where your key scopes apply.
    • payroll.run.finalized: { "id", "status" } (status is FROZEN for a newly finalized run)
    • payroll.payslip.published: { "id", "runId", "employeeId", "status": "PUBLISHED" }. Publishing payslips again for the same run does not send the event a second time.

An endpoint can be limited to one company when you create it. Events of that company and account-wide events (items, HRMS, payroll) are sent to it; events of other companies are not.

Test event

Send test posts a signed event of type ping, with data.object = { "endpointId", "message" } and a Fininvo-Delivery-Id that starts with test_. It is not stored and is not listed by GET /events. Verify its signature like any other event.

Headers

HeaderValue
Fininvo-Signaturet=<unix seconds>,v1=<hex signature>
Fininvo-Event-IdSame as id in the body. Use it to deduplicate.
Fininvo-Event-TypeSame as type in the body
Fininvo-Delivery-IdUnique per delivery
Fininvo-Delivery-Attempt1 for the first try, then 2, 3 and so on
Fininvo-Replaytrue when the delivery was replayed by a person
User-AgentFininvo-Webhooks/1.0

Verifying the signature

Always verify before you trust a payload. Anyone can send a request to your URL; only Fininvo can produce a valid signature.

The signature is HMAC-SHA256(secret, t + "." + rawBody) in lowercase hex.

  1. Read the raw request body, before any JSON parsing or reformatting.
  2. Split the header on commas. Take t and every v1 value (there are two during a secret rotation).
  3. Compute the expected signature.
  4. Compare with a constant-time function against each v1.
  5. Reject if t is more than 5 minutes from your clock. This stops replayed requests.

Node.js

JavaScript
const crypto = require('crypto');

function verifyFininvoSignature(rawBody, header, secret, toleranceSeconds = 300) {
  let timestamp = null;
  const signatures = [];
  for (const part of String(header || '').split(',')) {
    const [key, value] = part.trim().split('=');
    if (key === 't') timestamp = value;
    if (key === 'v1') signatures.push(value);
  }
  if (!timestamp || signatures.length === 0) return false;
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > toleranceSeconds) return false;

  const expected = crypto
    .createHmac('sha256', secret)
    .update(`${timestamp}.${rawBody}`)
    .digest('hex');
  const expectedBuf = Buffer.from(expected, 'hex');

  return signatures.some((sig) => {
    const sigBuf = Buffer.from(sig, 'hex');
    return sigBuf.length === expectedBuf.length && crypto.timingSafeEqual(sigBuf, expectedBuf);
  });
}

// Express: keep the raw body
app.post('/webhooks/fininvo', express.raw({ type: 'application/json' }), (req, res) => {
  const ok = verifyFininvoSignature(
    req.body.toString('utf8'),
    req.get('Fininvo-Signature'),
    process.env.FININVO_WEBHOOK_SECRET,
  );
  if (!ok) return res.status(400).send('invalid signature');

  const event = JSON.parse(req.body.toString('utf8'));
  queue.add(event);            // do the work later
  res.status(200).send('ok');  // answer fast
});

Python

Python
import hashlib, hmac, time

def verify_fininvo_signature(raw_body: bytes, header: str, secret: str, tolerance: int = 300) -> bool:
    timestamp, signatures = None, []
    for part in (header or "").split(","):
        key, _, value = part.strip().partition("=")
        if key == "t":
            timestamp = value
        elif key == "v1":
            signatures.append(value)
    if not timestamp or not signatures:
        return False
    if abs(time.time() - int(timestamp)) > tolerance:
        return False
    expected = hmac.new(
        secret.encode(), timestamp.encode() + b"." + raw_body, hashlib.sha256
    ).hexdigest()
    return any(hmac.compare_digest(expected, s) for s in signatures)

Responding

  • Return any 2xx within 10 seconds. Do the real work after you respond, from a queue.
  • Anything else, a timeout or a redirect counts as a failure. Redirects are never followed.
  • The response body is ignored. Only the first 1 KB is kept in the delivery log.

Delivery flow

Drawing diagram
sequenceDiagram
    participant FV as Fininvo
    participant EP as Your endpoint
    FV->>EP: POST signed event
    alt 2xx within 10 seconds
        EP-->>FV: 200
    else error, timeout or redirect
        EP-->>FV: failure
        Note over FV: Retry on the schedule below
    end

Endpoint setup, verification and state diagrams: Integration flows.

Retries

A failed delivery is retried up to 8 times in total:

AttemptDelay after the previous failure
21 minute
35 minutes
430 minutes
52 hours
66 hours
712 hours
824 hours

After the last attempt the delivery is marked exhausted. You can replay it from the delivery log.

If an endpoint fails continuously for 3 days it is disabled automatically and the account owners are emailed. Fix the endpoint, then choose Resume.

Build for these guarantees

  • At least once. The same event can arrive more than once. Deduplicate on Fininvo-Event-Id.
  • No ordering. A retry can arrive after a newer event. Compare updatedAt on the object, or fetch the current state from the API.
  • Rarely, an event can be missed. Run a periodic reconciliation with GET /events?since=... or with updatedSince on the list endpoints. Events are kept for 30 days. GET /events needs the events:read scope, returns the same envelope as a webhook body, oldest first, and lists only the event types of your key's product whose read scope the key holds (for example erp.invoices:read for erp.invoice.*). Filters: type, since, page, limit (at most 100).
  • Events are recorded from the moment API or webhook access is switched on for your account.

Rotating the signing secret

Choose Rotate secret on the endpoint. For 24 hours every delivery carries two v1 signatures, one per secret, so you can deploy the new secret without dropping events. The verification code above already accepts either.

Delivery log

Each endpoint shows its deliveries for the last 30 days with status, response code, duration and attempt count. From there you can replay a delivery or send a test event.

Troubleshooting

SymptomLikely cause
Endpoint stays in "pending verification"Test ping did not get a 2xx. Check your server logs and firewall.
URL refused when savingNot https, a non-standard port, or it resolves to a private address
Signature never matchesYou are hashing parsed JSON instead of the raw body, or using the wrong secret
Signature fails only sometimesServer clock drift. Sync with NTP.
DuplicatesExpected. Deduplicate on the event id.