---
title: "Create/Update absences."
method: POST
path: "/employee_absence/upsert"
tags: ["Time Tracking|Absence"]
---

# Create/Update absences.

`POST /employee_absence/upsert`

This method can be used to create and update absences.

An attempt is made to locate an existing absence based on the selected primary key. If one is found, it will be
adjusted. Otherwise, a new absence will be created. If the `deleteMissing` flag is activated, all records not
included in the request will be deleted. If the `dryRun` option is enabled, no actual changes will occur. It is
important to note that absences could affect the employees' time account.

## Request body

- StandardEmployeeAbsenceUpsertRequest
  - `records` object[] — The records.
    - `keyField` string — This parameter specifies the name of the unique key used to distinctly assign each dataset in the API. | Value | Description | |----------------|-----------------------------| | id | The internal employee ID | | importKey | The external record ID |
    - `data` EmployeeAbsenceUpsertRequestRecordData
      - `importSource` string — External data source from which this absence originates. (max. 20 characters)
      - `importKey` string — External ID of the respective data source. (max. 64 characters)
      - `id` integer — The internal id for the absence.
      - `employee` integer — The internal id for the employee.
      - `employeeReference` string — The employee personal number (Used if employee not provided).
      - `type` integer — The internal id of the absence type.
      - `typeExternalId` string — The external id of the absence type (Used if type not provided).
      - `date` string — Represents a date. (ISO 8601) ICU-Format: yyyy-MM-dd
      - `halfDay` boolean — Is this a half day absence.
  - `deleteMissing` boolean — Do you want to delete all absences missing from this request?
  - `deleteImportSource` string — The data source from which the missing absences can be deleted. (Standard is "*API")
  - `dryRun` boolean — Simulate the operation. (No records will be created or changed) This Parameter is optional.

## Response `200`

Success Response:

- StandardEmployeeAbsenceUpsertResponse
  - `createdAbsences` object[] — The created absences.
    - `id` integer — The internal id of the absence.
    - `employeeId` integer — The internal id of the employee.
    - `employeeReference` string — The employee personal number.
    - `name` string — The employee name.
    - `date` string — Represents a date. (ISO 8601) ICU-Format: yyyy-MM-dd
    - `absenceType` string — The absence type.
    - `absenceTypeId` integer — The internal id of the absence.
    - `absenceExternalId` string — The external id of the absence.
    - `halfDay` boolean — Is it only a half day absence.
    - `actualDuration` integer — The actual duration of the absence. If a absence is a full day absence the duration represents the target worktime on that day.
    - `externalId` string — External-ID of the absence type.
    - `updatedAt` string — Represents a date. (ISO 8601) ICU-Format: yyyy-MM-dd
  - `updatedAbsences` object[] — The changed absences.
    - `id` integer — The internal id of the absence.
    - `employeeId` integer — The internal id of the employee.
    - `employeeReference` string — The employee personal number.
    - `name` string — The employee name.
    - `date` string — Represents a date. (ISO 8601) ICU-Format: yyyy-MM-dd
    - `absenceType` string — The absence type.
    - `absenceTypeId` integer — The internal id of the absence.
    - `absenceExternalId` string — The external id of the absence.
    - `halfDay` boolean — Is it only a half day absence.
    - `actualDuration` integer — The actual duration of the absence. If a absence is a full day absence the duration represents the target worktime on that day.
    - `externalId` string — External-ID of the absence type.
    - `updatedAt` string — Represents a date. (ISO 8601) ICU-Format: yyyy-MM-dd
  - `deletedAbsencecs` object[] — The deleted absences.
    - `id` integer — The internal id of the absence.
    - `employeeId` integer — The internal id of the employee.
    - `employeeReference` string — The employee personal number.
    - `name` string — The employee name.
    - `date` string — Represents a date. (ISO 8601) ICU-Format: yyyy-MM-dd
    - `absenceType` string — The absence type.
    - `absenceTypeId` integer — The internal id of the absence.
    - `absenceExternalId` string — The external id of the absence.
    - `halfDay` boolean — Is it only a half day absence.
    - `actualDuration` integer — The actual duration of the absence. If a absence is a full day absence the duration represents the target worktime on that day.
    - `externalId` string — External-ID of the absence type.
    - `updatedAt` string — Represents a date. (ISO 8601) ICU-Format: yyyy-MM-dd

---

[API](https://skmtc.net/geocapture/apis/geocapture-api.md) · [All operations](https://skmtc.net/geocapture/apis/geocapture-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/geocapture/geocapture-api/versions/15839b24c497/schema)
