# How to Import Employees in CSV Format
## Overview

This guide explains how to import employees from an external system into the personnel ticket system using a specific CSV format.

The CSV file may also include **pensioners** who are eligible for personnel ticket rights.

---

## Before you start

To use this guide, you need to:

* Have your employee list available as a CSV file

---

## The CSV format

| Field Name               | Notes                                                                                                                             | Default Value |
|--------------------------|-----------------------------------------------------------------------------------------------------------------------------------|---------------|
| employeeNo               | Your internal employee number for this employee.                                                                                  |               |
| companyId                | Internal company ID in the personnel ticket system. This is different from your organisations ID in Enturs organisation registry. |               |
| employmentTypeId         | The type of employment. See Employment Types below.                                                                               |               |
| dateOfBirth              | In format "yyyy-MM-dd": "1974-11-23"                                                                                              |               |
| ssn                      | 5-digit ssn                                                                                                                       |               |
| firstName                | First name of employee                                                                                                            |               |
| surname                  | Surname of employee                                                                                                               |               |
| addressLine              | Street address of employee                                                                                                        |               |
| postalCode               | Postal code of employee                                                                                                           |               |
| abstainFromTicket        | Whether this employee has opted out. Valid values are true and false                                                              | false         |
| hireStartDate            | Date of hire. Format "yyyy-MM-dd", "1974-11-23"                                                                                   |               |
| payType                  | The pay category. See [Pay types](#pay-types) below.                                                                              |               |
| hireEndDate              | The day the employee no longer works for the company. Format "yyyy-MM-dd", "1974-11-23"                                           | ""            |
| hireEndCause             | The reason for end of hire. See [End Causes](#end-causes) below.                                                                  | ""            |
| disabilityGrade          | The percent disability. Sensitive personal data. Number from 0 to 100.                                                            | 0             |
| disabilityFromDate       | The day the disability is valid. Required if disabilityGrade > 0                                                                  | ""            |
| employmentPercentage     | Degree of employment. Number from 0 to 100.                                                                                       |               |
| employmentPercentageDate | Date the employment percentage is valid. Format "yyyy-MM-dd", "1974-11-23".                                                       | ""            |
| paidPercentage           | Percentage of pay.                                                                                                                |               |
| leaveFromDate            | If employee is on leave. Format "yyyy-MM-dd", "1974-11-23".                                                                       | ""            |
| isDeleted                | Whether employee is deleted in the pesonnel ticket system.                                                                        | false         |

Fields without a default value are required.

A header row is not required, but the fields must be in the order specified in the table.

### Employment types

| Id | Norwegian Notes                |
|----|--------------------------------|
| F  | Fast ansatt i stilling         |
| M  | Midlertidig tilsatt i stilling |
| T  | Tilkallingsvikar/sesong        |
| U  | Ukjent tjenesteforhold         |

### Categories

| Code | Value         |
|------|---------------|
| 1    | bronze ticket |
| 2    | silver ticket |

### Pay types

| Id | Norwegian Notes                    |
|----|------------------------------------|
| 1  | Ukjent                             |
| A  | Aktiv stilling                     |
| D  | Delvis omsorgspermisjon            |
| E  | Red. arbeidstid etter AML 46A      |
| F  | Fødselspermisjon                   |
| L  | Lånt ut til annen enhet            |
| M  | Permisjon for militær/siviltj      |
| N  | Permisjon for annen stilling i NSB |
| O  | Omsorgspermisjon uten lønn         |
| P  | Militær/siviltjeneste uten lønn    |
| R  | Studiepermisjon uten lønn          |
| S  | Studiepermisjon m/lønn             |
| T  | Tjenestegjøring i høyere stilling  |
| U  | Permisjon m/uførepensjon           |
| V  | Delvis uførepermisjon              |
| W  | Delvis overgang til AFP            |
| X  | Permisjon, annet u/lønn            |

### End causes

| Code | Norwegian Notes                               |
|------|-----------------------------------------------|
| A    | Overgang alderspensjon (kode 341)             |
| B    | Slutt v/overg til AS (kode 350)               |
| D    | Dødsfall (aksjonskode 320)                    |
| E    | Egen oppsigelse (kode 310+330)                |
| F    | Overgang AFP/FTP (kode 349)                   |
| I    | Oppsagt v/innskr. (kode 352)                  |
| M    | Mangler årsaksangivelse                       |
| O    | Slutt l/opplæring (kode 353)                  |
| S    | Særaldersgrense (kode 345)                    |
| T    | Dødsfall, tjenesteulykke (kode 321)           |
| U    | Uførepensjon/Oppsigelse ved sykdom (kode 361) |
| V    | Slutt 6 mnd lønn (kode 354)                   |
| X    | Slutt annen årsak (kode 350)                  |
| Y    | Ventelønn 30 års tjeneste                     |
| Z    | Avskjed (kode 351)                            |

---

## Importing employees

For importing employees, use

::endpoint[personnel-tickets/importMultipleEmployeesCsv]


### Request body

```json
{
  "importFile": "importFileName"
}
```

---

## Response and behavior

A list of **actually changed employees** is returned. The list may be empty if all uploaded employees already exist with the identical values 

The personnel ticket system calculates whether an employee is entitled to a personnel ticket and create the necessary ticket rights in the internal Entur systems for the users.

### Validation

* If **any birth date or SSN is invalid**:

  * ❌ Nothing will be imported
  * ❌ An error message will be returned
  * The error will include:

    * Invalid birth dates
    * Invalid SSNs

---

## Next steps
Guide: [How to Connect Profiles with Personnel Ticket Rights](/guides/personnel-ticket/3-connecting-user-profiles)
