Cancel Lead

This endpoint cancels an existing lead throug## General Description

PATCH/api/integration/lead/cancel

Request

cURL
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

NameTypeDescription
Originstring

Request body

application/json
{
    "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

FieldTypeRequiredDescription
leadExternalIntegrationLeadIdentifierRequestDTOYesLead identifier object. Supports lookup by lead ID or lead reference.
commentstringNoCancellation reason/comment persisted as lead cancel reason.
dynamicFormsCreateDynamicFormSnapshotFromExternalIntegrationRequestDTO[]NoOptional list of dynamic form answers to store as lead dynamic form snapshots on cancellation flow.

ExternalIntegrationLeadIdentifierRequestDTO

FieldTypeRequiredDescription
typeenumYesType of lead identifier. Must be one of: leadId or leadReference.
valuestringYesThe lead ID (if type is leadId) or lead reference (if type is leadReference).

CreateDynamicFormSnapshotFromExternalIntegrationRequestDTO

FieldTypeRequiredDescription
formReferencestringYesDynamic form reference configured in Sodtrack.
valuesCreateBookingDynamicFormFieldValueV2RequestDTO[]YesList of dynamic field answers for the form.

CreateBookingDynamicFormFieldValueV2RequestDTO

FieldTypeRequiredDescription
fieldReferencestringYesDynamic form field reference to answer.
valuestringYesValue to persist for the selected field.

Success Response

FieldTypeRequiredDescription
---200 OK. Lead cancellation operation completed.

Business Rules & Constraints

  • The lead must exist (leadId or leadReference lookup). If not found, the endpoint returns LEAD_NOT_FOUND.

  • comment is required and is used as the lead cancellation reason.

  • dynamicForms is 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

json
{
  "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
HTTP/1.1 200 OK

Example Error Response

json
{
  "statusCode": 400,
  "message": "LEAD_NOT_FOUND",
  "error": "Bad Request"
}