---
title: "Create/Update maintenances."
method: POST
path: "/maintenance/upsert"
tags: ["Maintenance|Maintenance"]
---

# Create/Update maintenances.

`POST /maintenance/upsert`

This method can be used to create and update maintenances.

An effort is made to locate an existing maintenance using the selected primary key. If found, it will be modified,
whereas if no maintenance is found, a new one is created. If the `deleteMissing` flag is set to true, all maintenances
absent from the request will be deleted. Please note that removed maintenances may not be reinstated. You can enable
the `dryRun` setting to simulate the action without altering any live data.

## Request body

- StandardMaintenanceUpsertRequest
  - `records` object[] — The records.
    - `keyField` string — This parameter specifier the name of the unique key used to distinctly assign each dataset in the API. | Value | Description | |-------|----------------------| | id | The internal maintenance id |
    - `data` MaintenanceUpsertRequestRecordData
      - `id` integer — The internal id of the maintenance.
      - `description` string — The name of the maintenance. (max. 255 characters)
      - `note` string — The description of the maintenance.
      - `maintenanceTypeId` integer — The internal id of the maintenance type.
      - `trackerId` integer — The internal of the vehicle for the maintenance. Only one of trackerId or toolId can be used.
      - `toolId` integer — The internal id of the tool for the maintenance. Only one of trackerId or toolId can be used.
      - `active` boolean — Wheather the maintenance shall be active or not.
      - `schedulerDefinition` MaintenanceUpsertRequestSchedulerDefinition
        - `type` string — The scheduler type. | Values | Description | | -------------------- | --------------------------------------------------------- | | performanceInterval | Schedules the maintenances based on performance intervals | | performanceTotal | Schedules the maintenances based on total performance | | dateScheduler | Schedules the maintenances based on a timed scheduler | | date | Schedules the maintenances on a fixed date |
        - `performanceType` string — The performance type. (Used for types performanceInterval or performanteTotal) | Values | Description | | -------- | ------------------------------ | | time | Performance on operating hours | | distance | Performance on driven distance in kilometers |
        - `performanceValue` integer — The performance value according to the performance type. (Used for types performanceInterval or performanteTotal)
        - `maxHits` integer — The amount of repeats for the maintenance (default NULL) (NULL = no limit). (Used for types performanceInterval, performanteTotal or dateScheduler)
        - `maxDaysAfterLastMaintenance` integer — The max amount of days after the last maintenance when the next one shall be scheduled. (Used for types performanceInterval or performanteTotal)
        - `lastMaintenanceValue` integer — The performance value according to the performance type from the last maintenance. (Used for types performanceInterval or performanteTotal)
        - `lastMaintenanceDate` string — Represents a date. (ISO 8601) ICU-Format: yyyy-MM-dd
        - `nextMaintenanceDate` string — Represents a date. (ISO 8601) ICU-Format: yyyy-MM-dd
        - `dateSchedulerDefinition` OrderCreateRepeatRequestSchedulerDefinition
          - `type` string — The scheduler type (See the examples for every type above). | Values | Description | | ------------------ | ------------------------------------------------------------------------------------- | | daily | Every 'd' days | | dailyEveryWorkday | Every workday | | weekly | Every 'w' weeks on weekdays 'wd' | | monthlyNthDay | Every 'm' months on the 'dm' day of the month | | monthlyNthWeekday | Every 'm' months on the 'o' occurrence of the day of the week 'wd' | | yearlyNthDay | Every 'y' years on the specified date 'dm'.'my' | | yearlyNthWeekday | Every 'y' years on the 'o' occurrence of the day of the week 'wd' in the month 'my' |
          - `intervalDays` integer — Every x days. (d)
          - `weekdays` integer[] — Only on following weekdays: 1 = Monday, 7 = Sunday. (wd)
          - `intervalWeeks` integer — Every x weeks. (w)
          - `day` integer — Day of month. (dm)
          - `intervalMonths` integer — Every x months. (m)
          - `occurrence` integer — Every x specified weekday: 1 = first, 4 = fourth, 5 = last. (o)
          - `month` integer — Month of the year: 1 = January, 12 = December. (my)
          - `intervalYears` integer — Every x years. (y)
  - `dryRun` boolean — Simulate the operation. (No records will be created or changed) This Parameter is optional.

## Response `200`

Success Response:

- StandardMaintenanceUpsertResponse
  - `createdMaintenances` object[] — The created maintenances.
    - `id` integer — The internal id of the maintenance.
    - `type` string — The maintenance type.
    - `description` string — The maintenance description.
    - `tracker` StandardMaintenanceBaseTrackerItem
      - `id` integer — The internal vehicle ID.
      - `identifier` string — The customer-specific ID. (max. 64 characters)
      - `inventoryNumber` string — The inventory number. (max. 128 characters)
      - `licenseNumber` string — The vehicle license plate. (max. 255 characters)
      - `identificationNumber` string — The vehicle identification number. (max. 24 characters)
      - `importSource` string — External data source from which this vehicle originates. (max. 64 characters)
      - `importKey` string — External ID from the respective data source. (max. 64 characters)
      - `name` string — The vehicle name. (max. 255 characters)
      - `description` string — The vehicle description.
      - `driverName` string — The driver name. (max. 255 characters)
      - `driverPhoneNumber` string — The driver phone number. (max. 255 characters)
      - `costCenter` string — The cost center. (max. 25 characters)
      - `serialNumber` string — The serial number of the vehicle.
      - `manufacturingDate` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
    - `tool` StandardToolBaseToolListItem
      - `id` integer — The internal id of the tool.
      - `name` string — The name of the tool.
      - `category` string — The name of the tool's category.
      - `serialNumber` string — The serial number of the tool.
      - `inventoryNumber` string — The inventory number of the tool.
      - `externalId` string — The external ID of the tool.
      - `status` string — The status of the tool.
      - `manufacturer` string — The name of the manufacturer of the tool.
      - `vehicleId` string — The id of the assigned locating device if it is a vehicle.
      - `beaconId` string — The id of the assigned locating device if it is a beacon.
      - `currentProject` StandardToolBaseProjectItem
        - `id` integer — The internal project ID.
        - `reference` string — The project number.
        - `importSource` string — External data source from which this project originated.
        - `importKey` string — External ID from the respective data source.
        - `name` string — The project name.
      - `multipleProjectsPossible` boolean — Indicates if multiple current projects were possible.
      - `currentProjectChangedAt` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
      - `createdAt` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
      - `licenseNumber` string — The license plate of the tool.
    - `previousDate` string — Represents a date. (ISO 8601) ICU-Format: yyyy-MM-dd
    - `nextDate` string — Represents a date. (ISO 8601) ICU-Format: yyyy-MM-dd
  - `updatedMaintenances` object[] — The changed maintenances.
    - `id` integer — The internal id of the maintenance.
    - `type` string — The maintenance type.
    - `description` string — The maintenance description.
    - `tracker` StandardMaintenanceBaseTrackerItem
      - `id` integer — The internal vehicle ID.
      - `identifier` string — The customer-specific ID. (max. 64 characters)
      - `inventoryNumber` string — The inventory number. (max. 128 characters)
      - `licenseNumber` string — The vehicle license plate. (max. 255 characters)
      - `identificationNumber` string — The vehicle identification number. (max. 24 characters)
      - `importSource` string — External data source from which this vehicle originates. (max. 64 characters)
      - `importKey` string — External ID from the respective data source. (max. 64 characters)
      - `name` string — The vehicle name. (max. 255 characters)
      - `description` string — The vehicle description.
      - `driverName` string — The driver name. (max. 255 characters)
      - `driverPhoneNumber` string — The driver phone number. (max. 255 characters)
      - `costCenter` string — The cost center. (max. 25 characters)
      - `serialNumber` string — The serial number of the vehicle.
      - `manufacturingDate` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
    - `tool` StandardToolBaseToolListItem
      - `id` integer — The internal id of the tool.
      - `name` string — The name of the tool.
      - `category` string — The name of the tool's category.
      - `serialNumber` string — The serial number of the tool.
      - `inventoryNumber` string — The inventory number of the tool.
      - `externalId` string — The external ID of the tool.
      - `status` string — The status of the tool.
      - `manufacturer` string — The name of the manufacturer of the tool.
      - `vehicleId` string — The id of the assigned locating device if it is a vehicle.
      - `beaconId` string — The id of the assigned locating device if it is a beacon.
      - `currentProject` StandardToolBaseProjectItem
        - `id` integer — The internal project ID.
        - `reference` string — The project number.
        - `importSource` string — External data source from which this project originated.
        - `importKey` string — External ID from the respective data source.
        - `name` string — The project name.
      - `multipleProjectsPossible` boolean — Indicates if multiple current projects were possible.
      - `currentProjectChangedAt` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
      - `createdAt` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
      - `licenseNumber` string — The license plate of the tool.
    - `previousDate` string — Represents a date. (ISO 8601) ICU-Format: yyyy-MM-dd
    - `nextDate` string — Represents a date. (ISO 8601) ICU-Format: yyyy-MM-dd
  - `deletedMaintenances` object[] — The deleted maintenances.
    - `id` integer — The internal id of the maintenance.
    - `type` string — The maintenance type.
    - `description` string — The maintenance description.
    - `tracker` StandardMaintenanceBaseTrackerItem
      - `id` integer — The internal vehicle ID.
      - `identifier` string — The customer-specific ID. (max. 64 characters)
      - `inventoryNumber` string — The inventory number. (max. 128 characters)
      - `licenseNumber` string — The vehicle license plate. (max. 255 characters)
      - `identificationNumber` string — The vehicle identification number. (max. 24 characters)
      - `importSource` string — External data source from which this vehicle originates. (max. 64 characters)
      - `importKey` string — External ID from the respective data source. (max. 64 characters)
      - `name` string — The vehicle name. (max. 255 characters)
      - `description` string — The vehicle description.
      - `driverName` string — The driver name. (max. 255 characters)
      - `driverPhoneNumber` string — The driver phone number. (max. 255 characters)
      - `costCenter` string — The cost center. (max. 25 characters)
      - `serialNumber` string — The serial number of the vehicle.
      - `manufacturingDate` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
    - `tool` StandardToolBaseToolListItem
      - `id` integer — The internal id of the tool.
      - `name` string — The name of the tool.
      - `category` string — The name of the tool's category.
      - `serialNumber` string — The serial number of the tool.
      - `inventoryNumber` string — The inventory number of the tool.
      - `externalId` string — The external ID of the tool.
      - `status` string — The status of the tool.
      - `manufacturer` string — The name of the manufacturer of the tool.
      - `vehicleId` string — The id of the assigned locating device if it is a vehicle.
      - `beaconId` string — The id of the assigned locating device if it is a beacon.
      - `currentProject` StandardToolBaseProjectItem
        - `id` integer — The internal project ID.
        - `reference` string — The project number.
        - `importSource` string — External data source from which this project originated.
        - `importKey` string — External ID from the respective data source.
        - `name` string — The project name.
      - `multipleProjectsPossible` boolean — Indicates if multiple current projects were possible.
      - `currentProjectChangedAt` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
      - `createdAt` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
      - `licenseNumber` string — The license plate of the tool.
    - `previousDate` string — Represents a date. (ISO 8601) ICU-Format: yyyy-MM-dd
    - `nextDate` 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/869b05603541/schema)
