Status: specification for Public API v1. Not live yet.
Diagrams of every flow an integration goes through, from getting access to handling a leaked key. Details for each step are in the linked pages.
- How an integration fits together
- Getting access
- Creating an API key
- What happens on every API call
- Lifecycle of an API key
- Rotating a key without downtime
- Writing safely with idempotency keys
- Handling rate limits and errors
- Setting up a webhook endpoint
- How a webhook is delivered
- Verifying a webhook on your server
- Lifecycle of a webhook endpoint
- Recommended sync pattern
- Example: online store to ERP
- Example: biometric device to HRMS
- Example: payroll to your accounting system
- If a key leaks
1. How an integration fits together
Your server calls the API to read and write. Fininvo calls your server with webhooks when something changes. Browsers and mobile apps never talk to the API directly.
flowchart LR
subgraph YOU["Your systems"]
APP["Your server or job"]
HOOK["Your webhook endpoint (HTTPS)"]
VAULT[("Secret manager: API key + webhook secret")]
FE["Your web or mobile front end"]
end
subgraph FININVO["Fininvo"]
API["Public API /api/v1/public"]
WH["Webhook sender"]
PROD["ERP / HRMS / Payroll"]
end
VAULT -.-> APP
VAULT -.-> HOOK
FE -->|"calls your own server only"| APP
APP -->|"HTTPS + Authorization: Bearer key"| API
API --> PROD
PROD -->|"something changed"| WH
WH -->|"signed HTTPS POST"| HOOK
HOOK -->|"fetch latest state"| API2. Getting access
flowchart TD
A["Account on a plan that includes the API (Growth and up)"] --> B{"API switched on for the account?"}
B -- No --> C["Developers page shows a locked state. Contact your account manager"]
B -- Yes --> D["Owner or admin opens Settings, then Developers"]
D --> E["Create an API key"]
E --> F["Store it in a secret manager"]
F --> G["Call GET /me to confirm"]
G --> H{"Need real-time updates?"}
H -- Yes --> I["Add a webhook endpoint"]
H -- No --> J["Poll with updatedSince"]
I --> K["Integration live"]
J --> KWhat each plan allows (calls per day, per minute, number of keys, webhook endpoints, write access) is shown on the pricing page and under Settings, then Subscription. See Errors and rate limits.
3. Creating an API key
sequenceDiagram
autonumber
actor Admin as Owner or admin
participant UI as Settings, Developers
participant FV as Fininvo
participant Mail as Account owners (email)
Admin->>UI: Create key (name, scopes, expiry, IP allowlist)
alt write scope selected
UI->>Admin: Ask for password (and MFA code if enabled)
Admin->>UI: Password / code
end
UI->>FV: Create request
FV->>FV: Check plan limits (keys allowed, write access)
FV->>FV: Generate key, store only a keyed hash
FV-->>UI: Full key (one time only)
UI-->>Admin: Show key with copy button
Admin->>Admin: Save key in secret manager
Admin->>UI: Tick "I have stored this key" and close
Note over UI: The key is discarded from the page.<br/>It can never be shown again.
FV--)Mail: "A new API key was created"4. What happens on every API call
Checks run in this order. The first one that fails decides the response.
flowchart TD
R["Request arrives"] --> H{"Authorization: Bearer fnv_live_... present and well formed?"}
H -- No --> E401a["401 invalid_key"]
H -- Yes --> IPB{"Caller IP blocked after repeated bad keys?"}
IPB -- Yes --> E429a["429 too_many_failed_attempts"]
IPB -- No --> K{"Key found and secret matches?"}
K -- No --> E401b["401 invalid_key (counts toward IP block)"]
K -- Yes --> S{"Key status"}
S -- Revoked --> E401c["401 key_revoked"]
S -- Suspended --> E401d["401 key_suspended"]
S -- Expired --> E401e["401 key_expired"]
S -- Active --> ON{"API on for Fininvo, this product and your account?"}
ON -- "Switched off by Fininvo" --> E503["503 api_disabled"]
ON -- "Not on your plan or account" --> E403a["403 api_not_enabled"]
ON -- Yes --> IP{"Key has an IP allowlist and caller is outside it?"}
IP -- Yes --> E401f["401 ip_not_allowed"]
IP -- No --> SC{"Key holds the scope this endpoint needs?"}
SC -- No --> E403b["403 insufficient_scope"]
SC -- Yes --> RL{"Within per-minute limit and daily quota?"}
RL -- No --> E429b["429 rate_limited or daily_quota_exceeded + Retry-After"]
RL -- Yes --> RO{"Write request while Fininvo is in read-only mode?"}
RO -- Yes --> E503b["503 writes_paused"]
RO -- No --> OK["Handled. 200 or 201 + X-Request-Id + rate-limit headers"]The account and company always come from the key itself. No header or parameter can point a key
at another account, and an id from another account answers 404.
5. Lifecycle of an API key
stateDiagram-v2
[*] --> Active: Created (secret shown once)
Active --> Active: Rotated (old secret works during overlap)
Active --> Active: Edited (name, IP allowlist, remove scopes)
Active --> Suspended: Suspended by Fininvo (suspicious use)
Suspended --> Active: Reinstated by Fininvo
Active --> Expired: Expiry date passed
Active --> Revoked: Revoked by you or by Fininvo
Suspended --> Revoked: Revoked
Expired --> [*]
Revoked --> [*]
note right of Active
Reminder emails 14 and 3 days
before expiry
end note
note right of Revoked
Permanent. Create a new key
to regain access.
end note6. Rotating a key without downtime
sequenceDiagram
autonumber
actor Admin as Owner or admin
participant FV as Fininvo
participant Vault as Your secret manager
participant App as Your servers
Admin->>FV: Rotate key, overlap 24 hours
FV-->>Admin: New secret (shown once)
Admin->>Vault: Store new secret
Note over FV: Old and new secret both accepted
App->>FV: Calls with old secret
FV-->>App: 200
Vault->>App: Deploy picks up new secret
App->>FV: Calls with new secret
FV-->>App: 200
Note over FV: Overlap ends
App->>FV: Anything still using old secret
FV-->>App: 401 invalid_keyIf you suspect the old secret leaked, rotate with 0 hours overlap, or revoke and create a new key.
7. Writing safely with idempotency keys
A timeout does not tell you whether the write happened. Retrying with the same
Idempotency-Key is always safe.
sequenceDiagram
autonumber
participant App as Your server
participant FV as Fininvo API
App->>App: Pick key "order-10458" and save it with your order
App->>FV: POST /erp/invoices (Idempotency-Key: order-10458)
FV->>FV: Draft invoice created
FV--xApp: Response lost (network timeout)
App->>FV: Retry: same body, same Idempotency-Key
FV->>FV: Key seen in the last 24 hours, same body
FV-->>App: 201 with the original invoice (nothing created twice)
App->>FV: POST with "order-10458" but a different body
FV-->>App: 409 idempotency_key_conflict8. Handling rate limits and errors
flowchart TD
C["Make the call"] --> S{"Status"}
S -- "2xx" --> OK["Use the result. Log X-Request-Id"]
S -- "400 / 404 / 409 / 422 / 423" --> FIX["Do not retry. Fix the request or data. Branch on error.code"]
S -- "401 / 403" --> KEY["Do not retry. Check key, scopes, plan. Alert a person"]
S -- "429" --> WAIT["Wait Retry-After seconds"] --> C
S -- "500 / 502 / 503 / 504" --> BO{"Retries left?"}
BO -- Yes --> SLEEP["Back off: 1s, 2s, 4s, 8s with jitter"] --> C
BO -- No --> ALERT["Give up, alert, keep the request for later"]9. Setting up a webhook endpoint
sequenceDiagram
autonumber
actor Admin as Owner or admin
participant FV as Fininvo
participant EP as Your endpoint
Admin->>FV: Add endpoint (https URL + events)
FV->>FV: URL must be https, port 443, public address
alt private, internal or http URL
FV-->>Admin: Refused
end
FV-->>Admin: Signing secret whsec_... (shown once)
Admin->>EP: Deploy secret and verification code
Admin->>FV: Send test
FV->>EP: Signed test event
alt endpoint answers 2xx
EP-->>FV: 200
FV-->>Admin: Endpoint active
else anything else
EP-->>FV: error or timeout
FV-->>Admin: Stays "pending verification"
end10. How a webhook is delivered
sequenceDiagram
autonumber
participant P as ERP / HRMS / Payroll
participant Q as Fininvo delivery queue
participant EP as Your endpoint
P->>P: Invoice paid (saved)
P->>Q: Event recorded, one delivery per subscribed endpoint
loop up to 8 attempts
Q->>EP: POST signed event (10 second timeout)
alt 2xx
EP-->>Q: 200
Note over Q: Delivered. Stop.
else error, timeout or redirect
EP-->>Q: failure
Note over Q: Wait, then retry:<br/>1m, 5m, 30m, 2h, 6h, 12h, 24h
end
end
Note over Q: After 8 failures: exhausted.<br/>Replay from the delivery log.<br/>3 days of failures: endpoint disabled, owners emailed.11. Verifying a webhook on your server
flowchart TD
IN["POST arrives"] --> RAW["Read the RAW body (before JSON parsing)"]
RAW --> HDR{"Fininvo-Signature header has t= and v1= ?"}
HDR -- No --> REJ["Respond 400 and stop"]
HDR -- Yes --> TS{"t within 5 minutes of your clock?"}
TS -- No --> REJ
TS -- Yes --> SIG["expected = HMAC-SHA256(secret, t + '.' + rawBody)"]
SIG --> CMP{"Constant-time match with any v1 value?"}
CMP -- No --> REJ
CMP -- Yes --> DUP{"Fininvo-Event-Id already processed?"}
DUP -- Yes --> ACK1["Respond 200, do nothing"]
DUP -- No --> QUEUE["Save event id, put work on your queue"]
QUEUE --> ACK2["Respond 200 within 10 seconds"]
ACK2 --> WORK["Worker processes later. For money, re-fetch from the API first"]Code for Node.js and Python is in Webhooks.
12. Lifecycle of a webhook endpoint
stateDiagram-v2
[*] --> PendingVerification: Added
PendingVerification --> Active: Test answered 2xx
Active --> Paused: Paused by you
Paused --> Active: Resumed
Active --> DisabledAuto: Failing for 3 days
DisabledAuto --> Active: Fixed and resumed
Active --> DisabledByFininvo: Disabled by Fininvo
DisabledByFininvo --> Active: Re-enabled by Fininvo
Active --> [*]: Deleted
Paused --> [*]: Deleted
DisabledAuto --> [*]: Deleted13. Recommended sync pattern
Webhooks are fast but at-least-once and unordered. A periodic reconciliation closes any gap.
flowchart LR
subgraph RT["Real time"]
W["Webhook arrives"] --> D{"Event id seen before?"}
D -- Yes --> X["Ignore"]
D -- No --> F["Fetch current record from the API"]
F --> U["Upsert in your system if updatedAt is newer"]
end
subgraph REC["Every 15 to 60 minutes"]
T["Read your last sync time"] --> L["GET list?updatedSince=lastSync, page through"]
L --> U2["Upsert if updatedAt is newer"]
U2 --> S["Save new last sync time"]
end14. Example: online store to ERP
sequenceDiagram
autonumber
actor Buyer
participant Shop as Your online store
participant Sync as Your sync service
participant FV as Fininvo ERP API
Buyer->>Shop: Places order 10458
Shop->>Sync: Order created
Sync->>FV: GET /erp/customers?search=email
alt not found
Sync->>FV: POST /erp/customers (Idempotency-Key: cust-email)
end
Sync->>FV: POST /erp/invoices draft (Idempotency-Key: order-10458)
FV-->>Sync: 201 draft invoice
Note over FV: Your team reviews and posts the invoice in Fininvo
FV--)Sync: Webhook erp.invoice.paid
Sync->>Shop: Mark order paid
loop every 15 minutes
Sync->>FV: GET /erp/stock-levels?updatedSince=...
Sync->>Shop: Update stock on product pages
end15. Example: biometric device to HRMS
sequenceDiagram
autonumber
participant Dev as Attendance device
participant GW as Your device gateway
participant FV as Fininvo HRMS API
Dev->>GW: Punches (employee code, time)
loop every 5 minutes
GW->>FV: POST /hr/attendance/punches (up to 500, UTC times)
FV-->>GW: accepted / duplicate / rejected with reasons
GW->>GW: Keep rejected ones for a person to check
end
Note over GW,FV: Network down? Keep punches and resend.<br/>Duplicates are ignored, so resending is safe.16. Example: payroll to your accounting system
sequenceDiagram
autonumber
actor PM as Payroll manager
participant FV as Fininvo Payroll
participant Int as Your integration
participant Acc as Your accounting system
PM->>FV: Finalize October payroll
FV--)Int: Webhook payroll.run.finalized (ids and status only)
Int->>FV: GET /payroll/runs/{id}/journal
FV-->>Int: Salary journal by component (from the processed run)
Int->>Acc: Post journal entry
Note over FV,Int: Payroll is read-only through the API.<br/>Runs are created and approved by people in Fininvo.17. If a key leaks
flowchart TD
L["Key may have leaked"] --> R["Revoke it now in Settings, Developers"]
R --> N["Create a new key with the same scopes"]
N --> D["Deploy the new key"]
D --> A["Check the key usage log for unknown IPs, hours or volume"]
A --> Q{"Anything unexpected?"}
Q -- Yes --> S["Email security@fininvo.com with the key id and findings"]
Q -- No --> C["Remove the key from where it leaked"]
S --> C
C --> P["Prevent it: secret manager, IP allowlist, secret scanning"]More in Security best practices.
