---
title: "Create tracker cost settings."
method: POST
path: "/tracker_cost_setting/upsert"
tags: ["Cost control|Tracker cost setting"]
---

# Create tracker cost settings.

`POST /tracker_cost_setting/upsert`

This endpoint enables you to create new tracker cost settings.

## Request body

- StandardCostDistributionHistoryUpsertRequest
  - `records` object[] — The tracker cost setting data.
    - `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 tracker cost setting ID |
    - `data` CostDistributionHistoryUpsertRequestRecordData
      - `trackerId` integer — The internal id of the tracker if the setting is meant to be for a tracker.
      - `trackerCategoryId` integer — The internal id of the tracker category if the setting is meant to be for a tracker category.
      - `costTypeSource` string — The source for the cost type. | Value | Description | |------|-------------| | COST_TYPE | cost type is defined at this entry | | VEHICLE_CATEGORY | cost type is defined at the tracker category | The value "VEHICLE_CATEGORY" can only be set if a trackerId is given. This will link the settings cost type to the one of the trackers category. If a trackerId is given the value can also be set to "COST_TYPE". This will set the cost type for this specific tracker. In that case a costTypeId/costTypeReference also has to be given. For a tracker category this value is obsolete.
      - `costTypeId` integer — The internal cost type id for this setting. Value is needed for settings if a trackerCategoryId is given or the costTypeSource is set to "COST_TYPE". Either costTypeId or costTypeReference can be supplied.
      - `costTypeReference` integer — The cost type reference for this setting. Value is needed for settings if a trackerCategoryId is given or the costTypeSource is set to "COST_TYPE". Either costTypeId or costTypeReference can be supplied.
      - `costDistribution` string — The cost distribution. | Value | Description | |--------------------------|-----------------------------------------| | VEHICLE_CATEGORY | Take the value of the tracker category | | LOGISTICS | Distribute as a logistics vehicle. Supply fields | || costDistributionLogisticsKmToProject, costDistributionLogisticsKm and costDistributionLogisticsOperatingHour | | MACHINE | Distribute as a machine vehicle. Supply fields costDistributionMachineHour, | || costDistributionMachineDay and costDistributionMachineTransportDay |
      - `logisticsKmDistribution` string — The distribution of costs to projects for the day. Only supply if costDistribution = LOGISTICS. | Value | Description | |--------------------------|-----------------------------------------| | DURATION | Distribution according to the duration of the stops at the projects | | AMOUNT | Distribution equally for each project | | DRIVE | Distribute costs by project approached |
      - `logisticsKmRate` number — The costs per kilometer. Only supply if costDistribution = LOGISTICS.
      - `logisticsHourlyRate` number — The costs per operating hour. Only supply if costDistribution = LOGISTICS.
      - `logisticsDailyRate` number — The costs per day. Only supply if costDistribution = LOGISTICS.
      - `machineHourlyRate` number — The costs per operating hour. Only supply if costDistribution = MACHINE.
      - `machineDailyRate` number — A fixed cost amount per day. Only supply if costDistribution = MACHINE.
      - `machineTransportDayDistribution` string — The cost distribution for transport days. Only supply if costDistribution = MACHINE. | Value | Description | |--------------------------|-----------------------------------------| | IGNORE | transport days will be ignored | | FULL_DAY | Destination gets full costs | | HALF_DAY | Costs will be split between start and destination |
      - `automaticBooking` boolean — This value indicates whether this setting should be used to create automatic bookings. Can be set to false if this setting is supposed to be used for form data bookings.
      - `fallbackProjectId` integer — This project will be used for cost bookings that have no assigned project.
      - `releaseOnInactivity` boolean — This setting will prevent empty bookings for days where this tracker has no events.
      - `operatingHourSource` string — The source for the operating hours. Only supply if costDistribution = LOGISTICS. | Value | Description | |------|-------------| | SHIFT_TIME | time from the first till the last event for the day | | DRIVE_TIME | Sum of the movement events |
      - `minDuration` number — The minimum duration (in s) for an event to be used for the calculation.
      - `minDistance` number — The minimum distance (in m) for an event to be used for the calculation. Only supply if costDistribution = LOGISTICS.
      - `from` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
  - `startCostCalculation` boolean — If true a cost calculation will be started from the start date of this setting on.
  - `dryRun` boolean — Simulate the operation. (No records will be created or changed) This Parameter is optional.

## Response `200`

Success Response:

- StandardCostDistributionHistoryUpsertResponse
  - `createdTrackerCostSettings` object[] — The created tracker cost settings.
    - `id` integer — The internal id of the tracker cost setting.
    - `tracker` StandardCostDistributionHistoryBaseTrackerItem
      - `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
    - `trackerCategory` StandardTrackerCategoryBaseTrackerCategoryListItem
      - `id` integer — The internal id of the tracker category.
      - `name` string — The name of the tracker category.
      - `description` string — The description of the tracker category.
      - `externalId` string — The external ID of the tracker category.
      - `costCenter` string — The cost center of the tracker category.
      - `createdAt` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
    - `costTypeSource` string — The source of the cost type.
    - `costType` string — The cost type.
    - `costDistribution` string — The cost distribution.
    - `logisticsKmDistribution` string — The distribution of costs to projects for the day.
    - `logisticsKmRate` number — The costs per kilometer.
    - `logisticsHourlyRate` number — The costs per operating hour.
    - `logisticsDailyRate` number — A fixed cost amount per day.
    - `machineHourlyRate` number — The costs per operating hour.
    - `machineDailyRate` number — A fixed cost amount per day.
    - `machineTransportDayDistribution` string — The cost distribution for transport days.
    - `from` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
    - `to` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx

---

[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)
