Check Options

Given a set of service variants and a location, returns which variants have no coverage there and the different ways of grouping the covered ones into bundles: groups of variants that a single provid…

POST/api/integration/bundle/options

Request

cURL
curl -X POST "https://uat.integration.cl.sodtrack-shared.sodtrack.com/api/integration/bundle/options" \
  -H "Authorization: Bearer $SODTRACK_TOKEN" \
  -H "origin: <your-origin>"

Base URL: https://uat.integration.cl.sodtrack-shared.sodtrack.com · other environments

Headers

NameTypeDescription
originstring—

Responses

Check Options
{
  "serviceVariantsWithoutCoverage": [
    {
      "type": "variantId",
      "value": "52"
    }
  ],
  "groupingOptions": [
    [
      [
        {
          "type": "variantSku",
          "value": "SKU-INSTALLATION"
        },
        {
          "type": "variantSku",
          "value": "SKU-MAINTENANCE"
        }
      ],
      [
        {
          "type": "variantId",
          "value": "63"
        }
      ]
    ],
    [
      [
        {
          "type": "variantSku",
          "value": "SKU-INSTALLATION"
        },
        {
          "type": "variantId",
          "value": "63"
        }
      ],
      [
        {
          "type": "variantSku",
          "value": "SKU-MAINTENANCE"
        }
      ]
    ]
  ]
}

Error responses for this endpoint follow the shared error reference.

Purpose

Given a set of service variants and a location, returns which variants have no coverage there and the different ways of grouping the covered ones into bundles: groups of variants that a single provider can execute together, in the same visit.

Use it as the first step of a bundled booking: pick one grouping option, then use POST /api/integration/bundle/dates and POST /api/integration/bundle/times with the variants of each group to find when that group can be scheduled.

Each variant can carry its quantity and its addons. They extend the duration of the visit exactly as they do when the booking is created, so the grouping that checks providers' agendas accounts for the real duration of each group.

Variants are returned identified the same way they were requested (by id or by SKU), so the response can be matched directly against the request.


Field Definitions

🔐 Authentication

FieldTypeRequiredDescription
x-api-key (header)string✅External integration API key provided by Sodtrack.

🧩 Service variants

FieldTypeRequiredDescription
variantsarray✅Service variants to group. Between 1 and 10 items. The same type + value cannot be repeated.
variants[].typestring✅How the variant is identified. One of: "variantId", "variantSku".
variants[].valuestring✅Sodtrack variant id (positive integer as a string) when type is "variantId", or the variant SKU (exact match) when type is "variantSku".
variants[].quantitynumber❌Quantity of the variant. Minimum 1. Defaults to 1.
variants[].addonsarray❌Addons of the variant. The same type + value cannot be repeated within a variant.
variants[].addons[].typestring✅ when addon sentHow the addon is identified. One of: "addonId", "addonReference".
variants[].addons[].valuestring✅ when addon sentSodtrack addon id (positive integer as a string) when type is "addonId", or the addon reference when type is "addonReference".
variants[].addons[].quantitynumber✅ when addon sentQuantity of the addon. Minimum 1.

🏠 Location

FieldTypeRequiredDescription
addressIdnumber✅ when coordinates not sentId of an existing Sodtrack address.
coordinatesobject✅ when addressId not sentLocation of the visit.
coordinates.latnumber✅ when coordinates sentLatitude.
coordinates.lngnumber✅ when coordinates sentLongitude.

When both are sent, addressId is used.

📅 Search range and grouping

FieldTypeRequiredDescription
startDatestring❌First day considered when checking agendas (YYYY-MM-DD). Defaults to today.
quantityOfDaysnumber❌Number of days after startDate considered when checking agendas. Between 1 and 31. Defaults to 30.
groupingModestring❌How groups are built. One of: "all_maximal_by_coverage", "all_maximal_by_agenda", "fewest_visits". Defaults to "all_maximal_by_coverage". See Grouping modes.

Example Request

json
{
  "variants": [
    {
      "type": "variantSku",
      "value": "SKU-INSTALLATION",
      "quantity": 2,
      "addons": [
        { "type": "addonReference", "value": "ADDON-EXTRA-HOSE", "quantity": 1 }
      ]
    },
    { "type": "variantSku", "value": "SKU-MAINTENANCE" },
    { "type": "variantId", "value": "52" },
    { "type": "variantId", "value": "63", "quantity": 2 }
  ],
  "addressId": 17,
  "startDate": "2026-10-05",
  "quantityOfDays": 14,
  "groupingMode": "all_maximal_by_agenda"
}

Minimal request, by coordinates and with the default grouping mode:

json
{
  "variants": [
    { "type": "variantId", "value": "32" },
    { "type": "variantId", "value": "33" }
  ],
  "coordinates": { "lat": -33.42, "lng": -70.6 }
}

Response Example

201 Created

json
{
  "serviceVariantsWithoutCoverage": [],
  "groupingOptions": [
    [
      [
        { "type": "variantSku", "value": "SKU-INSTALLATION" },
        { "type": "variantSku", "value": "SKU-MAINTENANCE" },
        { "type": "variantId", "value": "63" }
      ],
      [
        { "type": "variantId", "value": "52" }
      ]
    ]
  ]
}

Response Fields

FieldTypeDescription
serviceVariantsWithoutCoveragearrayRequested variants that no provider executes at the location. They are not part of any group.
serviceVariantsWithoutCoverage[].typestringIdentification type, as sent in the request.
serviceVariantsWithoutCoverage[].valuestringIdentification value, as sent in the request.
groupingOptionsarrayAlternative ways of grouping the covered variants. Each option is an array of groups; each group is an array of variants. Empty when no variant has coverage.
groupingOptions[][]arrayOne group: variants that one provider can execute together in a single visit. A group with a single variant is a visit for that variant alone.
groupingOptions[][][].typestringIdentification type, as sent in the request.
groupingOptions[][][].valuestringIdentification value, as sent in the request.

Error Responses

HTTP StatusErrorDescription
400 Bad RequestValidation message, e.g. variants should not be empty, quantityOfDays must not be greater than 31A field is missing, has an invalid value, or a variant or addon is repeated.
400 Bad RequestNO_VARIANT_FOUND_FOR_ID / NO_VARIANT_FOUND_FOR_SKUA variant could not be found by its id or SKU.
400 Bad RequestVARIANT_ID_IS_NOT_A_VALID_POSITIVE_INTEGERA "variantId" value is not a positive integer.
400 Bad RequestADDON_ID_IS_NOT_A_VALID_POSITIVE_INTEGERAn "addonId" value is not a positive integer.
400 Bad Request`NO_ACTIVE_ADDON_OPERATION_FOUND_FOR: ADDON_{IDSKU}: {value} VARIANT_ID: {variantId}`
400 Bad RequestNO_COVERAGE_FOR_ADDON: {addonId} (Reference: {reference})The addon is not offered at the location.
401 Unauthorized—The API key is missing or invalid.
404 Not FoundADDRESS_NOT_FOUNDaddressId does not match an existing address.
500 Internal Server Error—Unexpected server error. Contact Sodtrack support.

Business Rules & Constraints

Coverage

A variant has coverage at the location when at least one provider executes it there. Variants without coverage are listed in serviceVariantsWithoutCoverage and never appear in groupingOptions. Every covered variant appears exactly once in every option.

Grouping modes

ModeBehavior
all_maximal_by_coverage (default)Returns every option in which no group can be merged with another. A group only needs one provider that executes all of its variants at the location; agendas are not checked, so startDate and quantityOfDays are not used.
all_maximal_by_agendaSame as above, but a group of two or more variants also needs one provider with free time to execute all of them back to back on the same day, within the search range and the variants' operating hours.
fewest_visitsReturns a single option: the one with the fewest groups, checking agendas as all_maximal_by_agenda. Ties go to the option with the biggest groups first.

Each group is checked on its own: two groups of the same option may rely on the same provider on the same day.

Duration of a group

Each variant counts as one visit of variant duration × quantity, plus addon duration × addon quantity for each of its addons, the same duration the booking gets when it is created. A group needs the sum of the durations of its variants. Higher quantities or more addons can therefore split variants that would otherwise be grouped together.

Identification

  • A variant can be identified by id or by SKU, and both can be mixed in the same request.

  • If two entries identify the same variant (for example its id and its SKU), the first one is used and the variant is evaluated once.

  • Variants and addons are always returned with the same type and value sent in the request.

Addons

Each addon must be offered for its variant and must be offered at the location. Otherwise the request is rejected (see Error Responses); addons are never silently ignored.

Scope

Availability is computed for bookings without origin address, without products with a promised delivery date and with automatic provider assignment. When the booking is created with any of them, the travel time from the origin, the delivery date of the products or the chosen provider may change which groups are actually feasible.