Authentication

AbraFlexi offers two basic REST API authentication methods, plus an advanced one for server-side solutions.

HTTP authentication

The simplest method — send a standard Authorization: Basic header with every request:

curl -u winstrom:winstrom \
  'https://demo.flexibee.eu:5434/c/demo/adresar.json?detail=custom:kod&limit=1'

If the header is missing, the server redirects to a login form, or returns 401 Authorization required. Credentials can also be sent directly in the URL: https://user:password@server:5434/c/company/evidence. The ?auth=http parameter forces HTTP auth even where SSO would otherwise be offered; ?auth=html forces the login form.

JSON authentication (login session)

Useful when making multiple requests and you don’t want to resend the password each time. Obtaining a token:

POST /login-logout/login.json

The request body can be raw JSON or application/x-www-form-urlencoded (fields username, password, optionally otp):

{
    "username": "novak",
    "password": "password",
    "otp": "123456"
}

otp is optional (one-time password, if two-factor login is required). This method only returns results as JSON.

Successful response:

{
    "success": true,
    "authSessionId": "00112233445566778899aabbccddeeff...",
    "refreshToken": "4f133f49-...:c42cf011-...",
    "csrfToken": "f30ad42d-..."
}

Failed response:

{
    "success": false,
    "errors": {"reason": "Wrong username or password was entered."},
    "messageCode": "..."
}

The obtained token can be passed on subsequent requests in three ways:

  • Cookie: authSessionId=00112233...

  • HTTP header: X-authSessionId: 00112233... (recommended)

  • URL parameter: ?authSessionId=00112233... (careful: in this case credentials get logged on the server)

To keep the token alive, periodically call GET /login-logout/session-keep-alive.js (recommended every ~60s, though once every 30 minutes should suffice). If you have a refreshToken, a new authSessionId can be obtained via GET /login-logout/check with that token sent as a cookie.

When the session expires, the server redirects requests to /login-logout/remote-logout and you must log in again.

Logging out a specific user:

POST /status/user/{username}/logout

A custom login form can be embedded on another site via a plain HTML form posting to /login-logout/login.html (supports a returnUrl parameter, and otp for two-factor login; not usable with SSO — OpenID or SAMLv2).

Note

Practical note: some HTTP clients (curl, Postman) require the application/x-www-form-urlencoded or multipart/form-data header for /login-logout/login.json, otherwise the request body may not be recognized correctly. In Postman, clear any credentials previously set on the Auth tab first.

Note

SSO via SAMLv2 and OpenID is available only on local installations, depends on licensing, and is configured at /admin/auth-settings.

Source: Authentication, Generating an authentication token (Czech).

Password reset

Two-step password reset:

PUT /password-reset/send-email

The body is JSON with a single email field. Requires an SMTP server to be configured; for security the API returns no error if the address matches no user. A reset token is sent to that address.

PUT /password-reset/set-password

JSON body: resetToken (token from the e-mail) and password (the new password, must meet the password strength requirements). If password is omitted, the request only validates the token: 200 = valid, 400 = invalid.

Two-factor authentication (2FA)

2FA can be managed via the REST API as well as in the UI. Source: podpora.flexibee.eu.

Warning

Enabled 2FA also applies to REST calls with HTTP authentication. Every request from that user must include the query parameter otp with the current one-time password — otherwise integrations stop working. Prefer not enabling 2FA on pure service accounts.

Status (also present in GET /u listings):

GET /u/{username}.xml   — look for <twoPhaseAuthEnabled>true|false</…>

Issue a QR code (PNG 400×400) and read the private key from the Secret response header:

GET /u/{username}/qrcode-2fa.png
# or Accept: image/png — without .png / Accept → 404
# already-active 2FA → 403

Enable / disable:

PUT /u/{username}/enable-2fa?secret={secret}&otp={otp-code}
PUT /u/{username}/disable-2fa?otp={otp-code}

An administrator with the Change User Passwords permission can disable another user’s 2FA without their OTP:

PUT /u/disable-2fa?username={username}

Server-side authorization (impersonation)

For trusted server-to-server integrations on a self-hosted install, create /etc/flexibee/server-auth.xml with a service account:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
  <comment>WinStrom server configuration</comment>
  <entry key="username">server-admin</entry>
  <entry key="password">password</entry>
</properties>

Warning

Since version 2026.5.0, impersonation under server authentication has been removed without replacement for security reasons. The X-FlexiBee-Authorization header, which let a session claim to be a specific user, no longer has any effect. Integrations that used it must log in as a real user account. Source: release notes 2026.5.0 (in Czech).

In older versions the X-FlexiBee-Authorization header can specify which user the request should be processed as (impersonation). This feature was planned to be superseded by SSL client-certificate authentication; SSL certificate import via the API is possible without a logged-in user using this server auth.

API access and user types

Source: release notes 2025.5.0 and 2025.9.1 (in Czech).

  • API calls are allowed only for users of type REST API and for users of type Normal and Read-only with the “API access” flag enabled.

  • Calls by a Normal/Read-only user without the flag are blocked from 1 July 2025. Until then the flag was switched on automatically if the licence included API access.

  • Enabling the flag, and creating a REST API user, requires API access to be purchased in the licence.

  • For new integrations the vendor recommends dedicated REST API users; their number is not limited.

  • A user of type AUTOMATIC (assigned to all non-blocked users after a backup restore) can, since 2025.9.1, only be used to log in through the application; API communication does not work.

  • lastLoginDate and lastApiDate are visible in /u.json?detail=full.

User management via /u

Since 2026.5.0 the /u endpoint for creating a user also accepts XML and JSON (previously only form data or URL parameters). /u/{userId} for editing also understands XML and can change permissions; it is functionally identical to /c/{company}/uzivatel/update.

A person’s password is held only on the person header and is applied the same way from the application and from the API. Via the API it can be cleared with an empty password property, and it can be set already when creating a new employee. The right to change other users’ passwords is governed solely by the Change password right.

Access rights and roles

The web interface (and REST API the same way) automatically enforces access rights defined on the user’s role:

  • A user might have no access to an evidence at all, or read-only access.

  • They might see/edit only some records (e.g. only their own department).

  • They might see/edit only some columns (e.g. without purchase prices).

  • The application license might not permit a feature at all.

If an import modifies fields the user has no rights to, those changes are silently ignored; if it would modify a whole record without rights, the whole operation is rejected with an error.

Roles themselves are accessible via the role evidence:

GET  /c/{company}/role                — list of roles
GET  /c/{company}/role/{ID}           — a role including all its permissions
PUT/POST /c/{company}/role            — create/update a role

A new (user-defined, standard=false) role must have kod, nazev and otecRole (base/parent role it inherits permissions from, unless explicitly overridden in the request). Standard (standard=true) roles are immutable; their permission ids have the form uuid:{roleCode}-{permissionKey}.

Example: set a specific permission on an existing role (issued invoices read-only, received invoices fully inaccessible):

{
  "winstrom": {
    "role": {
      "id": "code:ADMIN_COPY",
      "pristPrava": {
        "pristupove-pravo": [
          {"groupKey": "dDoklFak$$FAV", "typeK": "typPristPrav.pouzeCist"},
          {"groupKey": "dDoklFak$$FAP", "typeK": "typPristPrav.nepripustne"}
        ]
      }
    }
  }
}

typeK values: typPristPrav.plny (full access), nepripustne (no access), pouzeCist (read-only), upresneni (refined, via featureK sub-features — Pridavat/Menit/Mazat/Export/Import/ OteviratDetail/Sloupce/Kusovnik/Storno/SlevaZmenaCeny/Sumace/Sluzby/Vazby/ HromZmeny/NakupCena/…).

Users as an evidence

Users are a normal evidence (uzivatel); creating a new user additionally requires matching password/passwordAgain:

XML

JSON

<uzivatel>
  <id>code:einstein</id>
  <kod>einstein</kod>
  <jmeno>Albert</jmeno>
  <prijmeni>Einstein</prijmeni>
  <password>password</password>
  <passwordAgain>password</passwordAgain>
  <role>code:JENCIST</role>
</uzivatel>
{
    "winstrom": {
        "uzivatel": [
            {
                "id": "code:einstein",
                "kod": "einstein",
                "jmeno": "Albert",
                "prijmeni": "Einstein",
                "password": "password",
                "passwordAgain": "password",
                "role": "code:JENCIST"
            }
        ]
    }
}

Last login is tracked in lastLoginDate (regular users) / lastApiDate (API users), visible via GET /u.json?detail=full (the /u/ prefix = server-level, outside any specific company).