Start Maintenance Plan
Starts the maintenance cycle of a product unit the customer already owns.
/api/integration/maintenance-plan/startRequest
curl -X POST "https://uat.integration.cl.sodtrack-shared.sodtrack.com/api/integration/maintenance-plan/start" \
-H "Authorization: Bearer $SODTRACK_TOKEN"Base URL: https://uat.integration.cl.sodtrack-shared.sodtrack.com Β· other environments
Responses
{
"productUnit": {
"id": 9871,
"serialNumber": "7788001122336"
},
"executions": [
{
"id": 5540,
"plan": {
"id": 31,
"name": "Mantenimiento semestral piscina"
},
"status": "PENDING",
"executionDate": "2026-10-01T00:00:00.000Z"
}
]
}Error responses for this endpoint follow the shared error reference.
Purpose
Starts the maintenance cycle of a product unit the customer already owns.
Use it right after registering the equipment with Add New Product Unit, or on any existing unit that is not under an active cycle yet. Sodtrack creates one execution (cycle) per maintenance plan that matches the unit's product and the execution variant you send, and schedules the first maintenance date for each one.
The unit is identified by productUnitId or productSerialNumber, and the service to be executed by variantId or variantSku. The first maintenance date is either the startDate you send or, when omitted, today plus the offset configured in the plan's rule.
This endpoint does not create a booking: it opens the cycle and sets the due date. The visit is created later by a daily job, once the due date is close enough (see From cycle to booking).
Field Definitions
π§ Product unit
| Field | Type | Required | Description |
|---|---|---|---|
productUnit | object | β | Selector of the unit whose cycle is being started. |
productUnit.type | string | β | How the unit is referenced. One of productUnitId, productSerialNumber. |
productUnit.value | string | β | Value matching productUnit.type: the Sodtrack product unit ID as a string, or its serial number (exact match). |
Prefer productUnitId. A serial number is only unique within a product, so a serial shared by units of different products is rejected as ambiguous rather than resolved at random.
π οΈ Execution variant
| Field | Type | Required | Description |
|---|---|---|---|
executionVariant | object | β | Service variant to be executed first β the maintenance service itself. |
executionVariant.type | string | β | How the variant is referenced. One of variantId, variantSku. |
executionVariant.value | string | β | Value matching executionVariant.type: the Sodtrack service variant ID as a string, or its SKU. |
The variant is resolved in Sodtrack before the cycle is created, and it also selects which plans and which rule apply. Only plans holding a rule for this exact variant are started.
π Schedule
| Field | Type | Required | Description |
|---|---|---|---|
startDate | string | β | Target date for the first maintenance, ISO 8601. When omitted, it is calculated as today plus the rule's configured offset. |
Example Request (by unit id and variant id)
{
"productUnit": {
"type": "productUnitId",
"value": "9871"
},
"executionVariant": {
"type": "variantId",
"value": "412"
}
}
Example Request (by serial number and SKU, with explicit date)
{
"productUnit": {
"type": "productSerialNumber",
"value": "7788001122336"
},
"executionVariant": {
"type": "variantSku",
"value": "SKU-VAR-MANT-001"
},
"startDate": "2026-10-01"
}
Response Example
200 OK
{
"productUnit": {
"id": 9871,
"serialNumber": "7788001122336"
},
"executions": [
{
"id": 5540,
"plan": {
"id": 31,
"name": "Mantenimiento semestral piscina"
},
"status": "PENDING",
"executionDate": "2026-10-01T00:00:00.000Z"
}
]
}
Response Fields
| Field | Type | Description |
|---|---|---|
productUnit | object | The unit the cycle was started for. |
productUnit.id | number | Sodtrack product unit ID. |
productUnit.serialNumber | string | Serial number of the unit (EAN-13). |
executions | array[object] | One entry per maintenance plan started. A product covered by two plans returns two entries, and therefore two future visits. |
executions[].id | number | Unique ID of the maintenance cycle created. |
executions[].plan | object | The maintenance plan this cycle belongs to. |
executions[].plan.id | number | Maintenance plan ID. |
executions[].plan.name | string | Maintenance plan name. |
executions[].status | string | Cycle status. Always PENDING on creation. Later values: IN_PROGRESS, COMPLETED, CANCELLED. |
executions[].executionDate | string | Date the first maintenance is due, ISO 8601. |
Error Responses
| HTTP Status | Error | Description |
|---|---|---|
400 Bad Request | Service variant not found: type={type}, value={value} | No service variant matches the given ID or SKU. |
400 Bad Request | PRODUCT_UNIT_NOT_EXISTS | No product unit matches the given ID or serial number. |
400 Bad Request | PRODUCT_UNIT_SERIAL_NUMBER_AMBIGUOUS | The serial number matches units of more than one product. Use productUnitId. |
400 Bad Request | PRODUCT_NOT_EXISTS | The unit has no catalog product associated, so no plan can be matched. |
400 Bad Request | MAINTENANCE_PLAN_EXECUTION_ALREADY_IN_PROGRESS | The unit already has an open cycle (PENDING or IN_PROGRESS) for this execution variant. |
400 Bad Request | MAINTENANCE_PLAN_NOT_EXISTS | No maintenance plan covers the unit's product for the given execution variant. |
400 Bad Request | MAINTENANCE_RULE_NOT_EXISTS | The plan exists but holds no rule for the given execution variant. |
400 Bad Request | (validation messages) | One or more fields are missing or invalid. The body carries message as an array of strings, one per failed validation. |
401 Unauthorized | β | Authentication token missing or expired. |
403 Forbidden | β | The API key or origin is not authorized. |
502 Bad Gateway | Error in startMaintenancePlan: {message} | The product module is unavailable or failed. Safe to retry. |
500 Internal Server Error | β | Unexpected server error. Contact Sodtrack support. |
A 4xx means nothing was created and the request must be corrected. A 502 means the call can be retried as-is.
Business Rules & Constraints
Plan matching
-
Plans are matched by the unit's product and the execution variant sent in the request. A plan for the same product but a different variant is not started.
-
One execution is created per matching plan. Two plans covering the same product produce two cycles and two future visits.
-
Within a plan, the rule applied is the one whose execution variant matches the request. When a self-perpetuating plan holds two such rules, the starting rule is used, not the one anchored to itself.
First maintenance date
-
When
startDateis sent, it is used as the due date of the first maintenance as-is. -
When
startDateis omitted, the due date is today plus the rule's offset, converted to days:DAYSas-is,WEEKSΓ 7,MONTHSΓ 30,YEARSΓ 365. Months and years are therefore approximations in days, not calendar months. -
The cycle is always created with status
PENDING.
From cycle to booking
-
A daily job runs at 11:00 and scans cycles in
PENDINGstatus. -
A booking is created when
executionDateminus the configured anticipation window (MAINTENANCE_PLAN_EXECUTION_ANTICIPATION_DAYS) is on or before today. With the window at0, the booking is created the day the maintenance is due. -
The booking is built with the unit's current customer and address, read at that moment β not with the ones the unit had when the cycle started. If the unit moves in between, the visit follows it.
-
A cycle with no
executionDateis skipped by the job.
One open cycle at a time
-
A unit cannot have two open cycles for the same execution variant. If one is
PENDINGorIN_PROGRESS, the request is rejected withMAINTENANCE_PLAN_EXECUTION_ALREADY_IN_PROGRESS. -
This endpoint does not close the previous cycle: unlike the flow triggered when a booking is completed, no service was executed here to justify closing it. Close or cancel the open cycle first.
-
The same unit can hold cycles for different execution variants at the same time.
Unit identification
-
productSerialNumberresolves only among units of type product, and must match exactly one unit across all products. -
Only units that already exist are accepted. To register equipment first, use Add New Product Unit.
Variant SKU availability
- Resolution by
variantSkudepends on the variant having its SKU loaded in Sodtrack. Most service variants currently have none, sovariantIdis the reliable selector unless the SKU was confirmed for your catalog.
Data and format
-
All identifiers are sent as strings inside the
{ type, value }selectors, even when they are numeric IDs. -
All timestamps follow the ISO 8601 format (UTC) where applicable.