Cancel Lead
This endpoint cancels an existing lead throug## General Description
/api/integration/lead/cancelRequest
curl -X PATCH "https://dev.integration.cl.sodtrack-shared.sodtrack.com/api/integration/lead/cancel" \
-H "Authorization: Bearer $SODTRACK_TOKEN" \
-H "Content-Type: application/json" \
-H "Origin: <your-origin>" \
-d '{
"lead": {
"type": "string", // one off: "leadId" or "leadReference",
"value": "string" // value of the leadId or leadReference
},
"comment": "string"
}'Base URL: https://dev.integration.cl.sodtrack-shared.sodtrack.com · other environments
Headers
| Name | Type | Description |
|---|---|---|
Origin | string | — |
Request body
{
"lead": {
"type": "string", // one off: "leadId" or "leadReference",
"value": "string" // value of the leadId or leadReference
},
"comment": "string"
}General Description
This endpoint cancels an existing lead throug## General Description
This endpoint cancels an existing lead through the Integration API. The lead is identified in the request body by either lead ID or lead reference.
In addition to the cancellation comment, the endpoint optionally accepts dynamic form answers in the same external integration format used in booking/lead flows (formReference + values[] with fieldReference and value).
Field Definitions
Request Body: ExternalIntegrationCancelLeadRequestDTO
| Field | Type | Required | Description |
|---|---|---|---|
lead | ExternalIntegrationLeadIdentifierRequestDTO | Yes | Lead identifier object. Supports lookup by lead ID or lead reference. |
comment | string | No | Cancellation reason/comment persisted as lead cancel reason. |
dynamicForms | CreateDynamicFormSnapshotFromExternalIntegrationRequestDTO[] | No | Optional list of dynamic form answers to store as lead dynamic form snapshots on cancellation flow. |
ExternalIntegrationLeadIdentifierRequestDTO
| Field | Type | Required | Description |
|---|---|---|---|
type | enum | Yes | Type of lead identifier. Must be one of: leadId or leadReference. |
value | string | Yes | The lead ID (if type is leadId) or lead reference (if type is leadReference). |
CreateDynamicFormSnapshotFromExternalIntegrationRequestDTO
| Field | Type | Required | Description |
|---|---|---|---|
formReference | string | Yes | Dynamic form reference configured in Sodtrack. |
values | CreateBookingDynamicFormFieldValueV2RequestDTO[] | Yes | List of dynamic field answers for the form. |
CreateBookingDynamicFormFieldValueV2RequestDTO
| Field | Type | Required | Description |
|---|---|---|---|
fieldReference | string | Yes | Dynamic form field reference to answer. |
value | string | Yes | Value to persist for the selected field. |
Success Response
| Field | Type | Required | Description |
|---|---|---|---|
| - | - | - | 200 OK. Lead cancellation operation completed. |
Business Rules & Constraints
-
The lead must exist (
leadIdorleadReferencelookup). If not found, the endpoint returnsLEAD_NOT_FOUND. -
commentis required and is used as the lead cancellation reason. -
dynamicFormsis optional. When present, each item is transformed into a dynamic form snapshot -
Dynamic form snapshot validation is executed before persistence. Invalid form references or invalid values for the fields, return validation/business errors (
400 Bad Request).
Example Request
{
"lead": {
"type": "leadReference",
"value": "LEAD-EXT-342"
},
"comment": "Customer canceled due to schedule conflict.",
"dynamicForms": [
{
"formReference": "lead-cancel-reasons-v1",
"values": [
{
"fieldReference": "cancel_reason",
"value": "customer_unavailable"
},
{
"fieldReference": "cancel_details",
"value": "Customer requested cancellation by phone."
}
]
}
]
}
Example Response
HTTP/1.1 200 OK
Example Error Response
{
"statusCode": 400,
"message": "LEAD_NOT_FOUND",
"error": "Bad Request"
}