Skip to main content
Skip to content
Fininvo

Developer docs

Authentication

How Fininvo API keys work: key anatomy, what a key is bound to, scopes for ERP, HRMS and Payroll, creating, rotating and revoking keys, and authentication errors.

On this page

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

Every request is authenticated with an API key sent as a bearer token:

Code
Authorization: Bearer fnv_live_a1b2c3d4e5f6_<secret>

Keys sent any other way are rejected. A key in the URL query string returns 400 because URLs end up in logs and browser history.

Key anatomy

Code
fnv_live_a1b2c3d4e5f6_Zk9...Qw
└──┬───┘ └────┬─────┘ └──┬───┘
 prefix    key id      secret
  • fnv_live_ identifies a Fininvo production key, so secret scanners can detect it.
  • The 12 character key id is not secret. It appears in the Developers page and in logs. Quote it to support.
  • The secret is shown once, at creation. Fininvo stores only a keyed hash of it.

What a key is bound to

BindingMeaning
AccountA key only ever sees data of the account that created it. This cannot be changed by any request parameter.
ProductERP, HRMS or Payroll. One product per key.
CompanyERP keys are bound to one company. A key created for "all companies" must send X-Fininvo-Company: <companyId> on each request.
ScopesThe list of things the key may do.
IP allowlistOptional list of IP addresses or CIDR ranges. When set, calls from anywhere else return 401.
ExpiryMandatory. Maximum 365 days.

Scopes

Scopes follow product.resource:action. Grant the smallest set that works.

ERP

ScopeAllows
erp.customers:readList and read customers
erp.customers:writeCreate and update customers
erp.items:readList and read items and stock levels
erp.invoices:readList and read invoices
erp.invoices:writeCreate draft invoices
erp.payments:readList and read received payments

HRMS

ScopeAllows
hr.employees:readEmployee directory fields and departments
hr.employees.sensitive:readAdds identity numbers, bank details, salary, date of birth and personal contact details. Only the account owner can grant it.
hr.attendance:readAttendance records
hr.attendance:writePush punches from devices
hr.leave:readLeave requests and balances

Payroll

ScopeAllows
payroll.runs:readProcessed payroll runs and the salary journal summary
payroll.payslips:readPayslips of processed runs. Only the account owner can grant it.

Payroll is read-only through the API. Runs are created, approved and paid by people in the Payroll product.

Shared

ScopeAllows
events:readList recent events for reconciliation (see Webhooks)

Write scopes are available only when write access is enabled for your account. Creating a key with a write scope asks for your password again, and your MFA code if MFA is on.

Scopes marked "Only the account owner can grant it" carry salary or identity data. Only the account owner can create, rotate or edit a key that holds one. Rotating a key with a write scope or an owner-only scope asks for your password (and MFA code) again, and so does adding entries to a key's IP allowlist or removing it.

Creating a key

  1. Settings → Developers → API keys → Create key.
  2. Name, scopes, expiry, optional IP allowlist.
  3. Copy the key and store it in your secret manager.
  4. Tick the confirmation that you have stored it. The dialog cannot be reopened.

Account owners receive an email whenever a key is created, rotated or revoked.

Lifecycle

Drawing diagram
stateDiagram-v2
    [*] --> Active: Created
    Active --> Active: Rotated / edited
    Active --> Suspended: Suspended by Fininvo
    Suspended --> Active: Reinstated
    Active --> Expired: Expiry date passed
    Active --> Revoked: Revoked
    Suspended --> Revoked: Revoked
    Expired --> [*]
    Revoked --> [*]

The full request check order is in Integration flows.

Rotating a key

Rotate before expiry, on a schedule, and whenever someone with access leaves.

  1. Open the key and choose Rotate.
  2. Pick an overlap of 0 to 24 hours. During the overlap both the old and the new secret work.
  3. Deploy the new secret.
  4. After the overlap the old secret stops working automatically.

Choose an overlap of 0 if you suspect the old secret has leaked.

You get reminder emails 14 days and 3 days before a key expires. An expired key returns 401 with code key_expired.

Revoking a key

Choose Revoke on the key. It stops working within seconds and cannot be restored. Create a new key if you need access again.

Fininvo may also suspend or revoke a key to protect your account, for example when a key is reported as leaked. You are emailed when that happens.

Checking a key

Shell
curl https://fininvo.com/api/v1/public/me -H "Authorization: Bearer $FININVO_API_KEY"

Returns the key name, product, scopes, company and current limits. Use it as a health check in your deployment.

Authentication errors

StatusCodeMeaning
401invalid_keyMissing, malformed or unknown key, or wrong secret
401key_revokedThe key was revoked
401key_suspendedThe key is suspended. Contact support.
401key_expiredPast its expiry date
401ip_not_allowedCaller IP is not in the key allowlist
401account_suspendedThe Fininvo account is suspended. Contact support.
400key_in_queryThe key was sent in the URL. Send it in the Authorization header.
403insufficient_scopeThe key lacks the scope named in details.requiredScope
403api_not_enabledAPI access is not on for this account or plan
429too_many_failed_attemptsToo many invalid keys from this IP. Wait 15 minutes.
503api_disabledThe API is temporarily switched off by Fininvo

Repeated invalid attempts from one IP address are blocked for 15 minutes, so do not retry a 401 in a loop. Fix the key first.