Employee

When using the Zenegy API it is possible to set up CRUD operations for employee profiles in Zenegy.

Each profile consists of three parts: Base, Employment, and Salary Data. All three parts can be managed via the API. Please note that some endpoints handle all three parts simultaneously.

Retrieve employees

The API provides several endpoints to fetch employee data. For general data retrieval, we advise using the following two endpoints:

Get employees list

All employee profile bases can be retrieve as a list via the endpoint for get employee bases list.

Parameters required for employee list.
  • A valid CompanyId with Oauth access is needed for this request, read more about company access here .

It is possible to filter and sort the results in this endpoint, expand the section below to get parameter details.

Parameters have to be added to the request body.

Filter and sort parameters

Data filtering parameters

Name Description
skip The index(position) from which to start getting records
take Number of records to return
filterPhrase String to search employees by name, employee number or cpr
departmentUids List of department uids to filter only employees that are part of them
salaryPayoutPeriod Salary payout periods
types Employee types
salaryType Salary types
incomeType Income types
employeeSortBy Sorts employees by the system available options
filterBy Filters employees by their status

Sorting parameters

Name ID
EmployeeName 1
EmployeeNumber 2

Status filtering parameters

Name ID
All 0
Active 1
Pending 2
Resigned 3

Retrieve full employee details

If data is outside of what is present in the bases is needed, use the endpoint for get employee details.

Parameters required for employee details.
  • A valid CompanyId with Oauth access is needed for this request, read more about company access here .
  • A valid EmployeeUid of an employee profile in the specified company.

Some properties in the endpoints above can be retrieved via specific endpoints, so be sure to check if another endpoint might be better in cases where very specific pieces of data is needed.

Create and update employee/s

Before you proceed

Many properties on an employee are directly connected to Zenegy's logic for Global value sets and Global values, using create and update methods via the API without knowledge of this logic is not adviced.

Read more about Global values and sets.

The API has several endpoints for employee profile creation, making it possible to only create single profiles with simple data, bulk create profiles or create full detailed single profiles.

All endpoints have the same required properties for creation of a profile:

  • CPR number of employee.
  • Name of employee.
  • Employee's address.
  • Employee's Postal code.
  • Employee's city.
  • Employment date.
  • Seniority date.

Be aware that if an employee number is not present in the request, the system will automatically generate one using the CPR number. For example, a CPR of 0101991212 will become an employee number like 01-01-91-xxxx.

Create a single employee

To create a single employee profile use the endpoint post employee.

This endpoint can be used for creation of a simple and full employee depending on the values posted in the request.

Simple or full profile

Depending on the values posted in the request this endpoint can be used to create a simple or a full profile. A simple profile lacks some properties required for a payroll, while a full profile includes all necessary properties.

Full profile properties
Name Description GV/S
cpr CPR number, 10 charecters
name Name of Employee
address Address of Employee
city City of Employee address
postalNumber Postal Number of Employee adress
employmentDate Employment date of Employee
seniorityDate Seniority date of Employee
countryCode Country code, 2 characters
companyCvrNumber Company CVR
mobilePhone Must match this regex pattern @"^[+]?\d+\s?\d*$"
email Must match this regex pattern @"^\w+([-+.']\w+)@\w+([-.]\w+).\w+([-.]\w+)*$"
pNumber 10 characters, all digits
atpType ATP types
employeeLanguage Employee Language
salaryType Salary types
salaryMode Salary modes
incomeType Income types
tax Tax cards
revenueType Employee types
maternityType Maternity types
insuranceCategory Insurance category
benefitPackageAmountType Pension value types
holidayPaymentType Pension value types
benefitPackageType Benefit package types
benefitPackageTwoType Benefit package types

GV/S properties are directly connected to Global values and sets.

Ensure all parties using the service are aware of the missing properties when creating simple profiles.

Bulk create employee profiles

Bulk creation of employee profiles can be posted using the endpoint for post employees

When posting a valid request a response returns a list of the guid, employee number and second employee number for the created employees

Update Employee profile

Updating simple profiles

When updating a simple profile, it is advised to include all properties required for a full profile.

Full profile properties
Name Description GV/S
cpr CPR number, 10 charecters
name Name of Employee
address Address of Employee
city City of Employee address
postalNumber Postal Number of Employee adress
employmentDate Employment date of Employee
seniorityDate Seniority date of Employee
countryCode Country code, 2 characters
companyCvrNumber Company CVR
mobilePhone Must match this regex pattern @"^[+]?\d+\s?\d*$"
email Must match this regex pattern @"^\w+([-+.']\w+)@\w+([-.]\w+).\w+([-.]\w+)*$"
pNumber 10 characters, all digits
atpType ATP types
employeeLanguage Employee Language
salaryType Salary types
salaryMode Salary modes
incomeType Income types
tax Tax cards
revenueType Employee types
maternityType Maternity types
insuranceCategory Insurance category
benefitPackageAmountType Pension value types
holidayPaymentType Pension value types
benefitPackageType Benefit package types
benefitPackageTwoType Benefit package types

GV/S properties are directly connected to Global values and sets.

Each employee can be updated using the endpoint for patch.

The endpoint uses JSON patch format to update an employee, the body of the request should be specified with only the properies that need to be changed.

When a patch request is executed the response will not return any information. This also includes patching Global value properties. Patching a global value will not update the data on the profile, and no error will be returned.

Json request example:

Copy
Copied
[
    {
        "value": "value",
        "path": "/Property",
        "op": "replace",
    }
]
Parameters required for Patch
  • A valid CompanyId with Oauth access is needed for this request, read more about company access here. .
  • A valid EmployeeUid of an employee profile in the specified company.

Delete employees

Deletion of employee profiles can be done via the endpoint for delete employee.

Only employees who has yet to be a part of a payroll run can be deleted. Employees that has been in a payroll run should be handled as a resignation

Deleted data cannot be restored.

Parameters required for deletion
  • A valid CompanyId with Oauth access is needed for this request, read more about company access here. .
  • A valid EmployeeUid of an employee profile in the specified company.

Tax cards

All employee tax cards for a company can be read via the endpoint for company tax card messages.

Specific employee profile tax card can be read via the endpoint for employee tax card.

The response from the company-wide endpoint is filtered using OData, and the request query can be adjusted using specific filtering parameters.

Filtering parameters
Name Description
Id id
Uid Uid
CreatedOn Created on
ValidFrom Valid from
TaxPercentage Tax percentage
TypeOfCard Type of tax card response
Status Employee Tax message status
FairDeductionMainCard Day deduction
UgefradragMainCard Seven day deduction
FourteenDayDeductionMainCard Fourteen day deduction
MonthlyDeductionMainCard Monthly deduction
FreeCardDeduction Free card deduction

API request example using odata filter

Copy
Copied
http://localhost:55500/api/companies/0551578b-e0a0-4943-8fa6-8ad6d29c33d0/employees/4aefcbc9-9314-4e3e-b3e7-ea8357173ba1/taxcards?$filter=TypeOfCard eq '1'
Parameters required for tax cards
  • A valid CompanyId with Oauth access is needed for this request, read more about company access here. .
  • A valid EmployeeUid of an employee profile in the specified company.

Enum definitions

Employee types
Name ID
Employee 1
Consultant 2
Salary types
Name ID Description
Fixed 1 Fixed paid
TimePaidWithHoliday 2 Hourly paid with holiday pay
TimePaidWithoutHoliday 3 Hourly paid without holiday pay
CasualWorker 4 Casual worker
Salary modes
Name ID Description
Hourly 0 Hourly paid employee - normal salary mode
Fixed 1 Hourly paid employee - fixed salary mode
Combined 2 Hourly paid employee - combined mode
Income types
Name ID Description
AIncomeReceiver 0 A-income recipient/salaried (code 00)
OtherPersonalIncome 4 Other personal income/unsalaried (code 04)
BIncomeReceiver 5 B-income recipient/unsalaried (code 05)
ScientistIncomeReceiver 8 § 48 e (tax scheme for foreign researchers et al) (code 08)
TaxFreeIncome 9 Tax-free income (code 09)
OtherPersonalIncomeWithoutWithholding 24 A-income recipient/Salaried without wage withholding (code 24)
Salary payout periods
Name ID Description
Monthly 1 Monthly salary (paid in advance)
FourteenDays 2 Biweekly pay is used for employees who are paid every 14 days
Backward 4 Monthly salary (paid in arrears)
ATP types
Name ID Description
A 0 Almindelig (A)
None 1 None
Employee Language
Name ID Description
da 0 Danish
en 1 English
Maternity types
Name ID Description
None 0 None
BarselDk 1 Barsel.dk (Standard)
DaBarsel 2 DA Maternity
BarselDkPartial 3 Barsel.dk - Partial member
Other 4 Other foundation
Insurance category
Name ID Description
Other 0 Production staff and all other employee types that can not be placed in the following five job categories
Office 1 Administrative work without physical contact and without driving
SalesAndService 2 Sellers and other employees with physical customer contact, with or without driving
Management 3 Leaders or managers and supervisors without any kind of repercussions or production work
InternalService 4 People who perform internal service in their own business. eg. canteens, cleaning, storage and maintenance inside and outside
Driver 5 Employees engaged in driving with goods, animals or people
None 6 Empty insurance category
Pension value types
Name ID Description
Percentage 0 Percentage
Fixed 1 Set amount per payroll
Benefit package types
Name ID Description
None 0 None
Saving 1 Money is colleced in an account
Payment 2 Money is straight transferred
Tax cards
Name ID Description
None 0 None
Main 1 Primary tax card
Secondary 2 Secondary tax card
NoTax 4 No tax card (55% is automatically deducted in tax at source)
Type of tax card response
Name ID Description
None 0 None
GrossPullCard 1 Gross tax card
Motherboard 2 Primary tax card
Frikort 3 Tax exemption card
Secondary 4 Secondary tax card
MotherboardWithSeparatePercent 6 Primary tax card with separate tax rate
SecondaryWithSeparatePercent 7 Secondary tax card with separate tax rate
Employee tax message status
Name ID
Pending 0
Completed 1
Error 2