Create Incident
Creates a new incident in Sodtrack and associates it with a booking, a lead, or a work order.
/api/integration/incidentRequest
curl -X POST "https://dev.integration.cl.sodtrack-shared.sodtrack.com/api/integration/incident" \
-H "Authorization: Bearer $SODTRACK_TOKEN"Base URL: https://dev.integration.cl.sodtrack-shared.sodtrack.com · other environments
Responses
{
"id": 71,
"entityType": "lead",
"entityId": 278,
"incidentStatus": {
"id": 1,
"name": "Create",
"description": "Created status",
"isFinalStatus": false,
"isInitialStatus": true,
"bookingStatusUpdate": ""
},
"reference": "INC-EXT-2026-001"
}Error responses for this endpoint follow the shared error reference.
Purpose
Creates a new incident in Sodtrack and associates it with a booking, a lead, or a work order.
The target entity is identified by entityType (booking, lead, or work_order) and by entity (using entityId or entityReference). The incident requires a description and an incident reason (by ID; reference is not yet supported). You can optionally set the reporter, creator, and accountable users, an external reference, and dynamic forms data.
Incidents are used to track issues, complaints, or follow-ups. Only booking, lead and work_order are supported for creation.
Field Definitions
📋 Request body
| Field | Type | Required | Description |
|---|---|---|---|
entityType | string | ✅ | Entity type the incident is associated with: "booking", "lead" or "work_order". |
entity | object | ✅ | Entity identifier: how to find the booking, lead, or work order (by ID or reference). |
description | string | ✅ | Description of the incident. |
incidentReason | object | ✅ | Incident reason identifier. Only reasonId is supported; reasonReference is not yet supported. |
reporterUser | object | ❌ | User who reported the incident. If provided and not resolved, the request fails. |
creatorUser | object | ❌ | User who created the incident. If provided and not resolved, the request fails. |
accountableUser | object | ❌ | User accountable for resolving the incident. Optional. |
reference | string | ❌ | External reference for the incident. |
dynamicForms | array[object] | ❌ | Optional form data (if configured for incident creation). See Dynamic forms below. |
📝 Dynamic forms
| Field | Type | Required | Description |
|---|---|---|---|
dynamicForms | array[object] | ❌ | List of form snapshots to submit. |
dynamicForms[].formReference | string | ✅ when form sent | Identifier of the form (must match a form configured for the incident creation flow). |
dynamicForms[].values | array[object] | ✅ when form sent | List of field values for this form. |
dynamicForms[].values[].fieldReference | string | ✅ | Identifier of the form field (must match a field in the form). |
dynamicForms[].values[].value | string | ✅ | Submitted value for the field. Numbers are accepted and converted to string. |
🔗 Entity identifier
| Field | Type | Required | Description |
|---|---|---|---|
entity.type | string | ✅ | How the entity is identified: "entityId" or "entityReference". |
entity.value | string | ✅ | The entity ID (if type is entityId) or the entity reference (if type is entityReference) for the selected entityType (booking, lead, or work order). Must be non-empty. |
📌 Incident reason identifier
| Field | Type | Required | Description |
|---|---|---|---|
incidentReason.type | string | ✅ | Must be "reasonId". "reasonReference" is not yet supported. |
incidentReason.value | string | ✅ | Numeric ID of the incident reason (must exist in Sodtrack). |
👤 User information (reporter, creator, accountable)
| Field | Type | Required | Description |
|---|---|---|---|
type | string | ✅ when user object sent | User identifier type: "userId", "userEmail", or "userReference". |
value | string | ✅ when user object sent | The user ID, email, or reference according to type. |
Example Request (booking by reference)
{
"entityType": "booking",
"entity": {
"type": "entityReference",
"value": "BOOK-REF-001"
},
"description": "Técnico no llevó el equipo correcto.",
"incidentReason": {
"type": "reasonId",
"value": "2"
},
"reporterUser": {
"type": "userEmail",
"value": "soporte@example.com"
},
"creatorUser": {
"type": "userReference",
"value": "USER-EXT-001"
},
"reference": "INC-EXT-2025-001"
}
Example Request (lead by reference)
{
"entityType": "lead",
"entity": {
"type": "entityReference",
"value": "LEAD-EXT-342"
},
"description": "Queja por demora en agendamiento.",
"incidentReason": {
"type": "reasonId",
"value": "2"
},
"reporterUser": {
"type": "userEmail",
"value": "soporte@example.com"
},
"creatorUser": {
"type": "userEmail",
"value": "soporte@example.com"
},
"reference": "INC-LEAD-001",
"dynamicForms": [
{
"formReference": "incident_creation_form",
"values": [
{
"fieldReference": "incident_creation_form_field_1",
"value": "Yes"
}
]
}
]
}
Example Request (work order by reference)
{
"entityType": "work_order",
"entity": {
"type": "entityReference",
"value": "WO-EXT-778"
},
"description": "Repuesto incorrecto enviado en la orden de trabajo.",
"incidentReason": {
"type": "reasonId",
"value": "3"
},
"reporterUser": {
"type": "userEmail",
"value": "soporte@example.com"
},
"reference": "INC-WO-001"
}
Example Request (minimal)
{
"entityType": "booking",
"entity": {
"type": "entityId",
"value": "12345"
},
"description": "Incidente reportado por integración.",
"incidentReason": {
"type": "reasonId",
"value": "1"
}
}
Response Example
{
"id": 100,
"entityType": "booking",
"entityId": 12345,
"bookingId": 12345,
"incidentStatus": {
"id": 1,
"name": "Open",
"description": "Incident is open",
"isFinalStatus": false,
"isInitialStatus": true,
"bookingStatusUpdate": ""
},
"reference": "INC-EXT-001"
}
When entityType is "work_order", the response carries the work order id in entityId and omits bookingId:
{
"id": 101,
"entityType": "work_order",
"entityId": 778,
"incidentStatus": {
"id": 1,
"name": "Open",
"description": "Incident is open",
"isFinalStatus": false,
"isInitialStatus": true,
"bookingStatusUpdate": ""
},
"reference": "INC-WO-001"
}
Response Fields
| Field | Type | Description |
|---|---|---|
id | number | Unique Sodtrack incident ID. |
entityType | string | Entity type: "booking", "lead", or "work_order". |
entityId | number | Entity ID (booking id, lead id, or work order id). |
bookingId | number | Present only when entityType is "booking". |
incidentStatus | object | Initial incident status (id, name, description, isFinalStatus, isInitialStatus, bookingStatusUpdate). |
reference | string | External reference if provided in the request. |
*Error Responses *
| HTTP Status | Error | Description |
|---|---|---|
400 Bad Request | ENTITY_IDENTIFIER_REQUIRED | entity.value is missing or empty. |
400 Bad Request | ENTITY_TYPE_NOT_SUPPORTED | entityType is not supported for creation. Only booking, lead, and work_order are supported. |
400 Bad Request | BOOKING_NOT_FOUND_FOR_ID | No booking found for the given entity ID. |
400 Bad Request | BOOKING_NOT_FOUND_FOR_REFERENCE | No booking found for the given entity reference. |
400 Bad Request | MULTIPLE_BOOKINGS_FOUND_FOR_REFERENCE | More than one booking shares the given reference. |
400 Bad Request | LEAD_NOT_FOUND_FOR_ID | No lead found for the given entity ID. |
400 Bad Request | LEAD_NOT_FOUND_FOR_REFERENCE | No lead found for the given entity reference. |
400 Bad Request | INVALID_WORK_ORDER_ID | entity.value is not a number when resolving a work order by ID. |
400 Bad Request | WORK_ORDER_NOT_FOUND_FOR_ID | No work order found for the given entity ID. |
400 Bad Request | WORK_ORDER_NOT_FOUND_FOR_REFERENCE | No work order found for the given entity reference. |
400 Bad Request | INVALID_REPORTER_USER | reporterUser was provided but could not be resolved. |
400 Bad Request | INVALID_CREATOR_USER | creatorUser was provided but could not be resolved. |
400 Bad Request | INVALID_USER_TYPE | Invalid user identifier type. |
400 Bad Request | INVALID_INCIDENT_REASON_ID | Reason id must be a number. |
400 Bad Request | INCIDENT_REASON_NOT_FOUND | The incident reason ID does not exist in Sodtrack. |
400 Bad Request | INCIDENT_REASON_REFERENCE_NOT_SUPPORTED | Resolution by reasonReference is not yet supported. Use reasonId. |
400 Bad Request | INVALID_INCIDENT_REASON_TYPE | Invalid incident reason identifier type. |
400 Bad Request | InvalidParameters | One or more required fields are missing or invalid. |
401 Unauthorized | — | Authentication token missing or expired. |
403 Forbidden | — | The API key or origin is not authorized. |
500 Internal Server Error | — | Unexpected server error. Contact Sodtrack support. |
Business Rules & Constraints
Entity identification
- entityType and entity are required. Supported values for creation are
booking,lead, andwork_order. The enum may also includeproject; it is not supported for this endpoint and returnsENTITY_TYPE_NOT_SUPPORTED. - entity.value must be non-empty (after trim). Otherwise the request fails with
ENTITY_IDENTIFIER_REQUIRED.
Booking resolution
When entityType is booking:
- entity.type = entityId:
valueis the booking ID. The booking must exist; otherwise the API returnsBOOKING_NOT_FOUND_FOR_ID. - entity.type = entityReference:
valueis the booking reference. No match returnsBOOKING_NOT_FOUND_FOR_REFERENCE; multiple matches returnMULTIPLE_BOOKINGS_FOUND_FOR_REFERENCE.
Lead resolution
When entityType is lead:
- entity.type = entityId:
valueis the lead ID. The lead must exist; otherwise the API returnsLEAD_NOT_FOUND_FOR_ID. - entity.type = entityReference:
valueis the lead reference. The lead must exist; otherwise the API returnsLEAD_NOT_FOUND_FOR_REFERENCE.
Work order resolution
When entityType is work_order:
- entity.type = entityId:
valueis the work order ID and must be numeric; a non-numeric value returnsINVALID_WORK_ORDER_ID. The work order must exist; otherwise the API returnsWORK_ORDER_NOT_FOUND_FOR_ID. - entity.type = entityReference:
valueis the work order external reference. No match returnsWORK_ORDER_NOT_FOUND_FOR_REFERENCE.
User resolution
- reporterUser and creatorUser are optional and can be sent as
null. When either is provided with a non-null value, it must resolve to an existing user by the given identifier (userId,userEmail, oruserReference). If the user cannot be resolved, the request fails withINVALID_REPORTER_USERorINVALID_CREATOR_USERrespectively. - accountableUser is optional. When provided, it is resolved if possible; if it cannot be resolved, the incident may be created without an accountable user (behavior may depend on configuration).
- Invalid user identifier type returns
INVALID_USER_TYPE.
Incident reason
- incidentReason is required. Only type = reasonId is supported; reasonReference is not yet supported and returns
INCIDENT_REASON_REFERENCE_NOT_SUPPORTED. - value must be a valid numeric reason ID that exists in Sodtrack. Invalid number returns
INVALID_INCIDENT_REASON_ID; non-existent reason returnsINCIDENT_REASON_NOT_FOUND.
Data and format
- Dynamic form data (when provided) is validated and stored for the incident according to the incident creation flow configuration.
- All timestamps in responses follow ISO 8601 format (UTC) where applicable.