Kiosa API kiosa.ai

Connect a business from your app

The partner flow, using ordio as the example, from the button in your app to an active integration.

This guide describes the flow a partner such as ordio offers its customers. The restaurateur clicks a button in your app, consents in Kiosa, and your app then hands over access to your system. Prerequisite: Kiosa has approved you as a partner and your client may use integrations:write.

The flow#

  1. The restaurateur clicks "Connect with Kiosa" in your app.
  2. Your app starts the login at Kiosa as described in the Quickstart, with the scopes account:read integrations:read integrations:write.
  3. Kiosa asks for the Kiosa address (the business slug). If you already know it, pass login_hint=<slug>. The page then prefills the field.
  4. The restaurateur signs in. Only a user with the TENANT_ADMIN role may consent. The consent page shows your name, your verified domain, the scopes in plain language and the business.
  5. Kiosa redirects to your redirect_uri with a code. You exchange it for a token (with code_verifier).
  6. Your app hands access over to Kiosa using its own key, see below.
  7. Kiosa maps branches. If everything is unambiguous, the initial import starts by itself. Otherwise the status stays needs_mapping; see Map branches.

When the login fails#

CaseWhat happens
The restaurateur clicks "Cancel"Redirect to your redirect_uri with error=access_denied, state and iss
Malformed request after the client and redirect_uri have been verifiedRedirect with error = invalid_request (for example state or PKCE missing), unsupported_response_type, invalid_target or invalid_scope
Client not approved, redirect_uri does not match, or a parameter appears twiceError page at Kiosa, no redirect
The user is a member of the business but not an adminRedirect with error=access_denied and error_description=Only an admin of the business can connect partner apps.
The business has switched off partner appsRedirect with error=access_denied and error_description=The business has switched off partner apps.
The user does not belong to the business (other account)Error page at Kiosa so they can sign in with the right account; no redirect
Login or confirmation expiredError page at Kiosa, no redirect

Code against error, not against the text of error_description. Without a redirect the restaurateur stays on the Kiosa page. Offer a way to restart the connection in your app.

Hand over access#

The ordio key needs exactly these scopes: branches:read, shifts:read, absences:read and wages:read. Kiosa does not need employee master data (employees.base_data:read).

bash
curl -X PUT https://api.kiosa.ai/v1/integrations/ordio \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "<your-ordio-key>",
    "company_id": "<ordio-company-id>",
    "key_expires_at": "2027-06-30T00:00:00+02:00"
  }'

key_expires_at is optional. What Kiosa does:

  • Kiosa tests the key synchronously (up to 10 seconds) with one inexpensive read call per required scope. If a scope is missing, Kiosa answers 422 with the code missing_provider_scopes and a list of the missing scopes.
  • If the test takes longer, Kiosa answers 202 with the status testing. You then read the result with GET /v1/integrations/ordio. On a key rotation Kiosa keeps working with the previous key until the new one has passed the test. If the new key fails, the old one stays active and the response lists the issue.
  • The key is stored encrypted. Responses never show it, at most the last 4 characters.
  • Kiosa maps branches automatically when the names match unambiguously. The response contains the status and a mapping proposal.
  • Once the mapping is complete, the initial import starts with history from 1 January of the previous year.

The call is idempotent. Repeating a PUT with the same content does not start a second import; a PUT with a new key is a key rotation. If the company_id changes, all earlier branch mappings no longer apply.

  • If an import failed (issue import_failed), repeating the PUT with the same credentials resumes it where it stopped. Kiosa does not restart it on its own.
  • If another staff system is already active in Kiosa (for example gastromatic or e2n), the API never switches it off. ordio then stays inactive and the issue is other_staff_provider_active. Kiosa switches the business on request. After that, repeating the PUT with the same credentials starts the initial import.

Read the status#

bash
curl https://api.kiosa.ai/v1/integrations/ordio \
  -H "Authorization: Bearer $ACCESS_TOKEN"
StatusMeaning
not_connectedThere is no connection.
testingKiosa is still checking the key.
needs_mappingAt least one branch is not yet mapped to a location.
activeThe connection is running; the import has started or is active.
errorThe connection is disrupted; the response lists the open items.

The response also contains the time of the last import and the open items. If you passed key_expires_at, key_expires_soon appears once expiry is at most 30 days away, and key_expired from the moment of expiry. Without key_expires_at Kiosa cannot warn in advance. Kiosa does not notify you on its own (no webhooks): poll the status at intervals, for example once a day.

Disconnect#

bash
curl -X DELETE https://api.kiosa.ai/v1/integrations/ordio \
  -H "Authorization: Bearer $ACCESS_TOKEN"

Kiosa deletes the credentials and stops the import, including running jobs. Data that was already imported stays in the business. The restaurateur can also disconnect the integration in Kiosa. If you later connect the same ordio company again, Kiosa does not load the history a second time; new data arrives through the regular sync.

Important: Revoking OAuth access does not disconnect the integration. It keeps running with your key until you call DELETE /v1/integrations/ordio or the restaurateur disconnects it in Kiosa.

Who may do what#

  • Consent and every write call check live that the user is still TENANT_ADMIN.
  • The restaurateur can switch off partner apps for the business (Settings, Connected apps). All calls then answer 403.
  • You may only write providers listed in your approval. ordio may only write ordio.