Skip to content

Partner apps ​

A partner app is an integration that acts for a customer company without anyone signed in. Fitor registers the app; each customer's administrator installs it in their own company; your service then mints a short-lived token per installation and calls the REST API with it.

The API is unstable

Everything on this page is subject to the warning on the API overview.

What an app is, and is not ​

  • An app acts as the company, never as a person. Its writes are recorded as the app, and a person leaving the company changes nothing about the installation.
  • One installation is one company. There is no token that reaches two companies. A partner with 40 customers holds 40 installations and mints 40 tokens.
  • Only the REST operations of the M2M API. A partner app token cannot call GraphQL, the /auth/v1/* routes, the bureau or group surfaces, or file downloads and exports.

1. Registration ​

There is no self-service. Contact [email protected]. Before registering an app Fitor checks your business ID in the Finnish business register (YTJ), and records your contact person and the signed partner terms. You receive:

client_idapp_ followed by 20 characters. Not secret.
client_secretfsk_…, shown to Fitor staff once and handed to you over a secure channel.
Setup addressThe https address you gave, where a customer's browser returns after installing.
Maximum accessThe roles your app may ever request (see Access).
Per-app ceilingRequests per minute across all your installations (see Limits).

Rotating the secret ​

Up to two secrets are live at once. Ask Fitor for a second one, deploy it, then ask Fitor to revoke the first. Both work until the first is revoked.

2. Installation ​

Send the customer's administrator to:

GET https://<fitor>/oauth/install?client_id=app_…&state=<your value>&roles=ROLE_BILLING_READ+ROLE_MASTERDATA_READ
Parameter
client_idYour app.
stateReturned to you unchanged. Use it to tie the answer to your own session.
rolesOptional, space-separated. Defaults to your app's maximum access.

The administrator signs in to Fitor as usual, chooses the company, and sees a consent screen naming your app, your company and each requested permission in plain words. They may untick any of them. Only an administrator of that company can install.

The browser then returns to your setup address:

OutcomeQuery parameters
Installedinstallation_id=<ULID>&tenant=<company id>&state=…
Declined, or the user is not an administratorerror=access_denied&state=…
A requested role is outside your app's maximumerror=invalid_scope&state=…
The app is suspendederror=unauthorized_client&state=…
The company's Fitor subscription does not include API integrationserror=api_integrations_not_entitled&state=…

Store installation_id. It is not a secret: another app's secret cannot spend it.

Installing again in the same company replaces the earlier installation. The company's administrators see every installation, its access and its last use under Settings › Installed apps, and can revoke it there at any time.

3. Minting a token ​

http
POST /oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id=app_…&client_secret=fsk_…&installation_id=01J…&scope=ROLE_BILLING_READ

scope is optional and narrows the token further (space-separated role names). The answer:

json
{ "access_token": "fit_…", "token_type": "Bearer", "expires_in": 3600, "scope": "ROLE_BILLING_READ" }

The token lasts one hour and there is no refresh token: mint a new one with your secret when it expires. Call the API with Authorization: Bearer fit_….

Access ​

Access is expressed as role names — the same roles a Fitor user holds, for example ROLE_BILLING_READ or ROLE_MASTERDATA_WRITE. A token holds the intersection of:

  1. your app's maximum access, set by Fitor at registration (never an administrator role);
  2. what the installing administrator could grant themselves, and left ticked;
  3. the scope you asked for when minting, if any.

If Fitor later narrows your app's maximum, the next token is narrowed too. Every API operation then checks the token's roles exactly as it checks a user's, so a read-only role cannot write. The OpenAPI specification (GET /docs.json) names the permission each operation needs.

Limits ​

LimitValueAnswer when exceeded
Each installation120 requests / minute429 with Retry-After, errorCode: RATE_LIMITED
All installations of your appThe per-app ceiling set at registration429 with Retry-After, errorCode: RATE_LIMITED
Minting, per app60 tokens / minute429 with Retry-After, error: slow_down
Wrong secrets, per app and address10 / 5 minutes429 with Retry-After, error: slow_down, for every request from that address
Wrong secrets, per app from all addresses100 / 5 minutes429 with Retry-After, error: slow_down, for a wrong secret only

Wrong secrets sent by someone else cannot lock you out: your correct secret is always accepted from any address that has not itself sent too many wrong ones.

One busy customer's sync cannot use another customer's allowance, but all of them share your app's ceiling.

Errors ​

When minting ​

OAuth error bodies ({"error": …, "error_description": …}); key on error.

errorStatusCause
invalid_request400client_id, client_secret or installation_id is missing.
invalid_client401Unknown, suspended or inactive app, or a wrong or revoked secret.
slow_down429Over the minting limit or a wrong-secret limit. Wait Retry-After seconds.
unauthorized_client400The client is not registered for this grant.
invalid_grant400The installation is unknown, revoked, belongs to another app, or the company is not active.
invalid_scope400scope names a role outside the installation's grant, or nothing usable is left.
api_integrations_not_entitled403The company's Fitor subscription does not include API integrations. A token minted earlier keeps working until it expires.

When calling the API ​

The usual error format; key on errorCode.

StatuserrorCodeCause
401—The token expired, the installation was revoked, or the app was suspended. Takes effect on the next request.
403PARTNER_APP_SURFACE_REFUSEDThe route is outside the M2M REST surface.
403ACCESS_DENIEDThe token's roles do not include what the operation needs.
429RATE_LIMITEDOver the per-installation limit or the per-app ceiling.

A 401 after revocation is final for that installation: ask the customer to install the app again. If Fitor suspends your app, every installation stops at once and each customer's administrators are told; nothing is deleted, and reinstatement restores them.

What Fitor records ​

Every token use is logged with the installation, route, time and result — never the request or response contents — and kept for two years. Every write your app causes is attributed to the app.