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:

MethodPathFunction
GET/api/usersReturns users with their master data.
GET/api/rolesReturns 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/usersReturns 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-allocationsReturns an overview of the users with allocated roles.
GET/api/role-allocations/contextsReturns the available contexts and their technical values.
PUT/api/role-allocations/users/{userId}Replaces all role allocations of a user.

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:

HeaderDescription
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/jsonRequests a response in JSON format.
Content-Type: application/jsonIdentifies the JSON request body of the PUT call.

For more information on generating an API token, see API Tokens in Tax Administration. 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
    
  

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:

EndpointRequired permission
GET /api/usersRead permission for Users or Role allocation
GET /api/rolesRead permission for Roles
GET endpoints under /api/role-allocationsRead 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.

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:

ParameterTypeDescription
userIdinteger/int64[]Filters by user IDs.
emailstring[]Filters by complete e-mail addresses, case-insensitive.
loginstring[]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:

FieldTypeDescription
userIdinteger/int64Identifies the user.
loginstringContains the login name.
emailstring or nullContains the e-mail address.
firstNamestring or nullContains the first name.
surNamestringContains the surname. The key is spelled exactly surName.
languagestring or nullContains the language code.
numberFormatstring or nullContains the number format.
phoneNumberstring or nullContains the phone number.
archivedbooleanMarks archived users with true.
platformUserIdstring or nullContains the ID of the assigned user of the Lucanet CFO Solution Platform when Tax Administration is used in the Lucanet CFO Solution Platform.
expirationDatestring or nullContains the expiration date in the format yyyy-MM-dd.

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:

ParameterTypeDescription
roleIdinteger/int64[]Filters by role IDs.
roleNamestring[]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:

FieldTypeDescription
roleIdinteger/int64Identifies the role.
roleNamestringContains the role name.
archivedbooleanMarks archived roles with true.
commentstring or nullContains the comment on the role.
lastModifiedstring or nullContains the time of the last change in the format yyyy-MM-dd HH:mm:ss.

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:

VariantCall and parameters
User IDGET /api/role-allocations/users/{userId} uses the numeric user ID in the path.
E-mail address or user ID in the Lucanet CFO Solution PlatformGET /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:

FieldTypeDescription
userIdinteger/int64Contains the ID of the user found.
allocationsarrayContains the role allocations with roleId, roleName and module-contexts.
moduleErrorsarrayContains 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.

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:

ParameterTypeDefault valueDescription
userIdinteger/int64[]No filterFilters by user IDs. Several values can be specified repeatedly or comma-separated.
roleIdinteger/int64[]No filterFilters by role IDs. For each user, the response contains only the roles that match the filter.
includeArchivedUsersbooleanfalseIncludes archived users if set to true.
includeSuperuserbooleanfalseIncludes 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:

FieldTypeDescription
userIdinteger/int64Identifies the user.
loginstringContains the login name.
archivedbooleanIndicates the archiving status.
rolesarrayContains the allocated roles, each with roleId and roleName.

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:

FieldDescription
modulesContains the fields moduleId, moduleName and the contexts array for each module.
modules[].contexts[].nameContains the technical context name for the type field of a role allocation.
modules[].contexts[].labelContains the localized label of the context.
modules[].contexts[].typeContains the display type Select, MultiSelect, Table or DetailTable. This field is not the context name for a PUT call.
modules[].contexts[].valuesContains the selectable values with value and label for Select and MultiSelect.
modules[].contexts[].columnsContains the column definitions with name, header and type for Table and DetailTable.
modules[].contexts[].rowsContains the selectable rows for Table and DetailTable, with the technical value value and the display values in cells, assigned by column name.
moduleErrorsContains 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.

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.

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.

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

FieldTypeDescription
allocationsarrayContains the complete desired set of role allocations.
allocations[].roleIdinteger/int64Identifies the role to be allocated. An additionally transmitted roleName is not relevant for the allocation; Tax Administration uses the role ID.
allocations[].module-contextsarrayContains the module contexts of an allocation. The JSON key contains a hyphen.
allocations[].module-contexts[].moduleIdstringIdentifies the module. Tax Administration matches the identifier case-insensitively.
allocations[].module-contexts[].contextsarrayContains the contexts of the module.
allocations[].module-contexts[].contexts[].typestringContains the technical context name from modules[].contexts[].name of the context query.
allocations[].module-contexts[].contexts[].valuesstring[]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
    
  

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:

FieldTypeDescription
moduleIdstringIdentifies the addressed module.
statusstringIndicates the result with SUCCESS or ERROR.
messagestringDescribes 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.

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:

CodeMeaning and further checks
200Confirms 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.
400Indicates 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.
401Indicates 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.
403Indicates missing permissions or the attempt to change your own role allocations via PUT.
404Indicates that the target user was not found in the single retrieval or the PUT call.
409Indicates 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.
500Indicates 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.

This content was generated using AI and reviewed by Lucanet subject matter experts before publication.