Skip to content

Authentication

The Gestix API uses two distinct authentication mechanisms depending on your use case.


Security Schemes

1. API Token Authentication (apiTokenAuth)

Used only with GET /helo to exchange a long-lived API Token for a short-lived session token.

  • Type: HTTP Bearer
  • Header: Authorization: Bearer <api-token>
  • Token format: API Token generated in Admin > Webshop API in the Gestix interface
GET /api/{account}/v4.0.0/helo/
Authorization: Bearer YOUR_API_TOKEN

2. Session Token Authentication (sessionAuth)

Used for all other protected endpoints after obtaining a session token from /helo or /auth.

  • Type: HTTP Bearer
  • Header: Authorization: Bearer <xa-token>
  • Token format: Short-lived session token (xa-token) returned by /helo or /auth
GET /api/{account}/v4.0.0/invoices/
Authorization: Bearer YOUR_SESSION_TOKEN

Trailing slash

Write GET paths with a trailing slash: /helo/, /invoices/, not /helo. Without the slash, a GET path returns 404. This was checked for every GET endpoint in v4.0.0; the POST and PUT paths are shown as before.


Authentication Flows

Flow A — API Token (server-to-server)

Recommended for automated integrations, scripts, and backend services.

1. Admin generates an API Token in Gestix → Admin > Webshop API
2. Client sends: GET /helo with Authorization: Bearer <api-token>
3. Server returns: { "xa-token": "..." }
4. Client uses xa-token for all subsequent requests
GET /api/03101176/v4.0.0/helo/
Authorization: Bearer eyJhbGciOi...
{
  "xa-token": "aaMDAwMDAwMDAwMDAxMzY4ODY5OTA4ICAgRlIwMDA3MTQwNjIxXX"
}

Flow B — Username & Password (user-facing applications)

Recommended for web apps or portals where the end user provides their Gestix credentials.

1. User provides username + password
2. Client sends: POST /auth?username=...&password=...
3. Server returns: { "xa-token": "..." }
4. Client uses xa-token for all subsequent requests

See POST /auth for details.


Generating an API Token

  1. Log into Gestix ERP as an administrator
  2. Navigate to Admin > Webshop API
  3. Select the user the integration acts as and generate the API Token
  4. Store it securely — treat it like a password

The screen calls it API Key

Admin > Webshop API names the API Token "API Key": generate it with 1. Generate API Key, for the user the integration acts as.

Regenerating the API Token

When a user already has a key, Admin > Webshop API offers Regenerate, after a confirmation. Give the new key to the applications that use the old one.

The screen shows a warning when the user's password or code changed after the key was generated: that key no longer works. Regenerate it and give the new key to the applications.

API versions and the API key

The API version is the part of the URL after the account, for example /api/{account}/v4.0.1/. From Gestix 7.2.08 the current version is v4.0.1. It differs from v4.0.0 only in how GET /helo checks the key:

Version GET /helo accepts After Regenerate Key removed in Admin > Webshop API
v4.0.1 Only the key currently stored for the user in Admin > Webshop API The previous key is refused at once (403) No key is accepted (403)
v4.0.0 and older Any key generated for the user, until the user's password or code changes The previous key keeps working The key keeps working

Every other endpoint behaves the same in v4.0.1 as in v4.0.0.

Moving from v4.0.0 to v4.0.1

  1. In Admin > Webshop API, select the integration's user and copy the API Key the screen shows now. A key you saved earlier works with v4.0.1 only if it is that key.
  2. Change the version in the integration's base URL from v4.0.0 to v4.0.1, and call GET /helo/ with that key.
  3. From then on, Regenerate revokes the previous key: give the new key to every application that uses it.

GET /status shows the version you called (called_api_version) and the current one (current_api_version).

Results follow the series privileges of the token's user

A request made with an API Token acts as the Gestix user the token belongs to. It returns only the document series and documents that this user's privilege profile allows; for a denied series, a list returns [] or fewer documents. Since Gestix 7.2 this applies to reads as well as to creating documents: up to Gestix 7.0, the REST API returned every series. If an integration gets an empty or short list, find the token's user in Admin > Webshop API and allow the series it needs in that user's privilege profile.

Keep your API Token secret

The API Token is long-lived. Do not commit it to source control or expose it in client-side code. If you suspect it has been compromised, Regenerate it and use v4.0.1: with v4.0.0 and older the previous key keeps working until the user's password changes.


Session Token Lifetime

The xa-token returned by /helo and /auth is short-lived. Your integration should handle token expiry by catching 403 responses and re-authenticating.


Nonce Requirement

Write operations (POST, PUT) require a nonce query parameter — see the Session Management page for details.