---
title: "REST API"
source_url: https://support.lucanet.com/en/documentation/income-taxes/tax-administration/rest-api
language: en
last_updated: 2026-11-25
---
# Managing Users and Role Allocations via the REST API in Lucanet Tax Administration

## Overview

Via the REST API of Tax Administration, you can retrieve users, roles and role allocations from an external application and replace the role allocations of a user. This reference is intended for developers who implement such an integration. The API also returns the available contexts that you use to restrict a role allocation to units, reporting dimensions or module-specific areas.

The API belongs to Tax Administration. Separate interface descriptions cover the integrations with the Lucanet CFO Solution Platform, Tax Data Hub and VAT. This reference describes the following seven endpoints of Tax Administration:

| Method | Path | Function |
|---|---|---|
| GET | `/api/users` | Returns users with their master data. |
| GET | `/api/roles` | Returns roles with their identification data. |
| GET | `/api/role-allocations/users/{userId}` | Returns the role allocations of a user based on the user's ID. |
| GET | `/api/role-allocations/users` | Returns the role allocations of a user based on the user's e-mail address or user ID in the Lucanet CFO Solution Platform. |
| GET | `/api/role-allocations` | Returns an overview of the users with allocated roles. |
| GET | `/api/role-allocations/contexts` | Returns the available contexts and their technical values. |
| PUT | `/api/role-allocations/users/{userId}` | Replaces all role allocations of a user. |

## Base URL and Authentication in Tax Administration

The REST API of Tax Administration is accessible via the base URL of the Tax Administration service. Use the service URL provided for your environment and append the respective path `/api/...`. The browser URL of Tax Administration in the Lucanet CFO Solution Platform is not the base URL of the API. Do not add a general `/portal` prefix.

The following HTTP headers control the authentication and the data format of the Tax Administration API:

| Header | Description |
|---|---|
| `x-api-key: <api-token>` | Authenticates the request with an API token from Tax Administration. |
| `Authorization: Bearer <token>` | Authenticates the request alternatively with a supported bearer token. Tax Administration evaluates this header only if `x-api-key` is missing. |
| `Accept: application/json` | Requests a response in JSON format. |
| `Content-Type: application/json` | Identifies the JSON request body of the PUT call. |

For more information on generating an API token, see [API Tokens in Tax Administration](https://support.lucanet.com/en/documentation/income-taxes/tax-administration/api-tokens/.md). Keep the token secure. For an integration with a module JWT, you need a valid token signed with HS256 that contains the claims `iss`, `exp` and `sub`. In this token, `iss` is the client ID and `sub` is the user ID of the calling user. Alternatively, Tax Administration accepts the access token of a user.

The following schema shows a read call. Replace *base-url* and *api-token* with the values of your environment:

```http
GET https://<base-url>/api/users
x-api-key: <api-token>
Accept: application/json
```

## Permissions for the REST API in Tax Administration

Tax Administration checks the permissions of the calling user with every API call. A valid token does not replace the required permissions. Read requests require read permissions; the PUT call requires write permissions.

The following table assigns the endpoints to the required permissions in Tax Administration:

| Endpoint | Required permission |
|---|---|
| `GET /api/users` | Read permission for **Users** or **Role allocation** |
| `GET /api/roles` | Read permission for **Roles** |
| GET endpoints under `/api/role-allocations` | Read permission for **Role allocation** |
| `PUT /api/role-allocations/users/{userId}` | Write permission for **Role allocation** |

The calling user cannot change their own role allocations via the PUT endpoint.

## Retrieving Users via the REST API in Tax Administration

With `GET /api/users`, you retrieve the user master data from Tax Administration. Without a filter, Tax Administration returns all users, including archived users, but no template users.

The following optional query parameters are available for the user query:

| Parameter | Type | Description |
|---|---|---|
| `userId` | `integer/int64[]` | Filters by user IDs. |
| `email` | `string[]` | Filters by complete e-mail addresses, case-insensitive. |
| `login` | `string[]` | Filters by complete login names, case-insensitive. |

You can specify each filter several times or with comma-separated values. Tax Administration combines several values of the same parameter with OR and different parameters with AND. The query does not support pagination.

The response contains the `users` array. If there are no matches, this array is empty. Each user object contains the following fields:

| Field | Type | Description |
|---|---|---|
| `userId` | `integer/int64` | Identifies the user. |
| `login` | `string` | Contains the login name. |
| `email` | `string` or `null` | Contains the e-mail address. |
| `firstName` | `string` or `null` | Contains the first name. |
| `surName` | `string` | Contains the surname. The key is spelled exactly `surName`. |
| `language` | `string` or `null` | Contains the language code. |
| `numberFormat` | `string` or `null` | Contains the number format. |
| `phoneNumber` | `string` or `null` | Contains the phone number. |
| `archived` | `boolean` | Marks archived users with `true`. |
| `platformUserId` | `string` or `null` | Contains the ID of the assigned user of the Lucanet CFO Solution Platform when Tax Administration is used in the Lucanet CFO Solution Platform. |
| `expirationDate` | `string` or `null` | Contains the expiration date in the format `yyyy-MM-dd`. |

## Retrieving Roles via the REST API in Tax Administration

With `GET /api/roles`, you retrieve the roles from Tax Administration. The response contains identification data and the archiving status, but not the individual permissions of a role. The response also includes archived roles.

The following optional query parameters are available for the role query:

| Parameter | Type | Description |
|---|---|---|
| `roleId` | `integer/int64[]` | Filters by role IDs. |
| `roleName` | `string[]` | Filters by complete role names, case-insensitive. |

You can repeat the parameters or specify comma-separated values. Tax Administration combines several values of the same parameter with OR and different parameters with AND.

The response contains the `roles` array. If there are no matches, this array is empty. Each role object contains the following fields:

| Field | Type | Description |
|---|---|---|
| `roleId` | `integer/int64` | Identifies the role. |
| `roleName` | `string` | Contains the role name. |
| `archived` | `boolean` | Marks archived roles with `true`. |
| `comment` | `string` or `null` | Contains the comment on the role. |
| `lastModified` | `string` or `null` | Contains the time of the last change in the format `yyyy-MM-dd HH:mm:ss`. |

## Retrieving the Role Allocations of a User in Tax Administration

Tax Administration provides two GET endpoints for retrieving the role allocations of a single user. Both endpoints return the same response format, including the allocated contexts.

The following variants determine the target user:

| Variant | Call and parameters |
|---|---|
| User ID | `GET /api/role-allocations/users/{userId}` uses the numeric user ID in the path. |
| E-mail address or user ID in the Lucanet CFO Solution Platform | `GET /api/role-allocations/users` requires exactly one of the query parameters `email` or `platformUserId`. The `email` parameter requires a complete address and is case-insensitive. `platformUserId` is intended for using Tax Administration in the Lucanet CFO Solution Platform. |

For both variants, the optional parameter `includeModuleContexts` controls whether Tax Administration retrieves additional contexts from the connected modules. The default value is `true`. With `false`, Tax Administration returns only its own data and does not call the external modules; `moduleErrors` then remains empty.

Both variants also find archived users. Tax Administration excludes template users. If Tax Administration finds several users for an e-mail address or a user ID in the Lucanet CFO Solution Platform, Tax Administration responds with HTTP `409`. The `detailMessage` field names the user IDs found. If an e-mail address is used several times, determine the users with `GET /api/users?email=...` and then use the ID-based variant.

The response of a single retrieval contains the following fields:

| Field | Type | Description |
|---|---|---|
| `userId` | `integer/int64` | Contains the ID of the user found. |
| `allocations` | `array` | Contains the role allocations with `roleId`, `roleName` and `module-contexts`. |
| `moduleErrors` | `array` | Contains modules whose contexts Tax Administration could not retrieve completely. Each entry contains `moduleId`, the numeric HTTP status `status` and `message`. |

A non-empty `moduleErrors` array means that the context data of the listed modules is incomplete. Tax Administration can still respond with HTTP `200`. Therefore, always evaluate the response content in addition to the HTTP status.

## Retrieving an Overview of the Role Allocations in Tax Administration

With `GET /api/role-allocations`, you retrieve an overview of the users with at least one allocated role in Tax Administration. This endpoint returns role references without the context details of the individual allocations.

The overview supports the following optional query parameters:

| Parameter | Type | Default value | Description |
|---|---|---|---|
| `userId` | `integer/int64[]` | No filter | Filters by user IDs. Several values can be specified repeatedly or comma-separated. |
| `roleId` | `integer/int64[]` | No filter | Filters by role IDs. For each user, the response contains only the roles that match the filter. |
| `includeArchivedUsers` | `boolean` | `false` | Includes archived users if set to `true`. |
| `includeSuperuser` | `boolean` | `false` | Includes the superuser with the user ID `1` if set to `true`. |

Tax Administration combines several values of the same parameter with OR and different parameters with AND. Tax Administration excludes template users. The query does not support pagination.

The response contains the `users` array. Each user object contains the following fields:

| Field | Type | Description |
|---|---|---|
| `userId` | `integer/int64` | Identifies the user. |
| `login` | `string` | Contains the login name. |
| `archived` | `boolean` | Indicates the archiving status. |
| `roles` | `array` | Contains the allocated roles, each with `roleId` and `roleName`. |

## Determining the Available Role Contexts in Tax Administration

With `GET /api/role-allocations/contexts`, you determine the contexts that Tax Administration and the connected modules provide for role allocations. Use the returned technical keys for read and write operations; visible labels do not replace these keys.

The optional `Accept-Language` header controls the language of the labels. Tax Administration supports `de`, `en` and `fr`. Without a supported language, Tax Administration uses English. The `Content-Language` response header names the language used.

The response to the context query contains the following fields:

| Field | Description |
|---|---|
| `modules` | Contains the fields `moduleId`, `moduleName` and the `contexts` array for each module. |
| `modules[].contexts[].name` | Contains the technical context name for the `type` field of a role allocation. |
| `modules[].contexts[].label` | Contains the localized label of the context. |
| `modules[].contexts[].type` | Contains the display type `Select`, `MultiSelect`, `Table` or `DetailTable`. This field is not the context name for a PUT call. |
| `modules[].contexts[].values` | Contains the selectable values with `value` and `label` for `Select` and `MultiSelect`. |
| `modules[].contexts[].columns` | Contains the column definitions with `name`, `header` and `type` for `Table` and `DetailTable`. |
| `modules[].contexts[].rows` | Contains the selectable rows for `Table` and `DetailTable`, with the technical value `value` and the display values in `cells`, assigned by column name. |
| `moduleErrors` | Contains modules whose context definitions are missing, each with `moduleId`, numeric `status` and `message`. |

For a role allocation, take the module identifier from `moduleId`, the context name from `name` and the selected technical values from `values[].value` or `rows[].value`. The display type and the localized labels are intended for the display in your application.

The contexts of Tax Administration itself use the module identifier `Portal` and the context name `Units`. If reporting dimensions are available in the environment, the response also contains `ReportingDimensions`. Determine the permitted values via the context query. Values and available contexts of other modules depend on the environment.

A non-empty `moduleErrors` array indicates an incomplete context list, even with HTTP `200`. Do not treat missing context data as a reason to remove existing allocations.

## Replacing Role Allocations via the REST API in Tax Administration

With `PUT /api/role-allocations/users/{userId}`, you replace all role allocations of the specified user in Tax Administration. The request does not add a single allocation and does not merge with the roles saved so far.

> **Warning:** The PUT call replaces the complete set of role allocations. Tax Administration deletes every role allocation that the request body does not contain. With `{"allocations": []}`, you remove all role allocations of the target user. Read the existing state before a change and include all allocations that are to be retained.

To replace the role allocations of a user via the REST API of Tax Administration:

1. Determine the target user via `GET /api/users` and the roles via `GET /api/roles`.

2. Read the current allocations with `GET /api/role-allocations/users/{userId}`. Check `moduleErrors` before you use the response as a starting point.

3. If you change contexts, determine the valid technical values with `GET /api/role-allocations/contexts`.

4. Compile the complete desired set of allocations.

5. Send the JSON request body via PUT to `/api/role-allocations/users/{userId}`.

6. Check the HTTP status and every result in `moduleResults`.

### Request Body

The request body for replacing the role allocations contains the following fields:

| Field | Type | Description |
|---|---|---|
| `allocations` | `array` | Contains the complete desired set of role allocations. |
| `allocations[].roleId` | `integer/int64` | Identifies the role to be allocated. An additionally transmitted `roleName` is not relevant for the allocation; Tax Administration uses the role ID. |
| `allocations[].module-contexts` | `array` | Contains the module contexts of an allocation. The JSON key contains a hyphen. |
| `allocations[].module-contexts[].moduleId` | `string` | Identifies the module. Tax Administration matches the identifier case-insensitively. |
| `allocations[].module-contexts[].contexts` | `array` | Contains the contexts of the module. |
| `allocations[].module-contexts[].contexts[].type` | `string` | Contains the technical context name from `modules[].contexts[].name` of the context query. |
| `allocations[].module-contexts[].contexts[].values` | `string[]` | Contains the selected technical values from the context query. |

You cannot allocate archived roles in Tax Administration. If the request body contains the ID of an archived role, Tax Administration responds with HTTP `400`. Check the `archived` field in the response of `GET /api/roles` beforehand.

The following JSON shows only the structure of the request body. The role ID `7` is for illustration only. Replace the role ID and the placeholders based on the preceding GET responses; do not send the example unchanged:

```json
{
  "allocations": [
    {
      "roleId": 7,
      "module-contexts": [
        {
          "moduleId": "<moduleId from the context query>",
          "contexts": [
            {
              "type": "<name from the context query>",
              "values": ["<technical value from the context query>"]
            }
          ]
        }
      ]
    }
  ]
}
```

### Response and Partial Results

Tax Administration first saves its own role allocations and then distributes the context allocations to the connected modules. An error in one module does not roll back the allocations already saved in Tax Administration. The distribution to the other modules continues regardless of the individual module error.

The response contains the `moduleResults` array. For modules that support the distribution of role contexts, each entry contains the following fields:

| Field | Type | Description |
|---|---|---|
| `moduleId` | `string` | Identifies the addressed module. |
| `status` | `string` | Indicates the result with `SUCCESS` or `ERROR`. |
| `message` | `string` | Describes the module error for `ERROR`. For `SUCCESS`, the field is omitted. |

Even if a module returns the status `ERROR`, the HTTP response can be `200`. Check the result for each module and, in the case of a partial success, read the current state again before you send further changes. The PUT result `moduleResults` must be distinguished from the `moduleErrors` field of the GET responses.

## Handling REST API Errors in Tax Administration

Tax Administration uses HTTP status codes and structured response content to describe errors. For context queries and the distribution of role allocations, a successful HTTP response alone does not confirm complete success for all modules.

The following table describes the relevant status codes of the Tax Administration API:

| Code | Meaning and further checks |
|---|---|
| `200` | Confirms that the request has been processed. For single allocations and the context query, check `moduleErrors`; for PUT, check `moduleResults`. Empty result lists of a user or role query are not an error. |
| `400` | Indicates invalid parameters or an invalid request body. Check numeric IDs, Boolean values, the exclusive specification of `email` or `platformUserId` in the single retrieval, and role and module identifiers in the PUT call. |
| `401` | Indicates a failed authentication. Check the header used and the validity of the token. If `x-api-key` is present, Tax Administration does not use an additionally sent bearer token as a substitute. |
| `403` | Indicates missing permissions or the attempt to change your own role allocations via PUT. |
| `404` | Indicates that the target user was not found in the single retrieval or the PUT call. |
| `409` | Indicates several matching users in the single retrieval based on the e-mail address or user ID in the Lucanet CFO Solution Platform. Use a unique user ID. |
| `500` | Indicates a server-side error, for example when saving in Tax Administration. |

The structured error response contains `status`, `timestamp`, `message`, `detailMessage` and `contextId`. Evaluate `detailMessage` in particular to find the cause of the error, and specify the related `contextId` in a support request.
