Update Component Price/Cost

Creates or updates the area-based pricing (price and cost per geographic area) of a component product in Sodtrack.

PATCH/api/integration/area-pricing

Request

cURL
curl -X PATCH "https://dev.integration.cl.sodtrack-shared.sodtrack.com/api/integration/area-pricing" \
  -H "Authorization: Bearer $SODTRACK_TOKEN" \
  -H "origin: <your-origin>"

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

Headers

NameTypeDescription
originstring

Responses

Update product area
{
  "id": 45,
  "entityType": "COMPONENT",
  "entityRefId": "163",
  "active": true,
  "itemsCount": 2,
  "items": [
    {
      "id": 101,
      "price": 100,
      "cost": 80,
      "areas": [
        {
          "id": 1,
          "name": "Nicaragua",
          "code": "NIC"
        }
      ]
    },
    {
      "id": 102,
      "price": 5000,
      "cost": 4000,
      "areas": [
        {
          "id": 7,
          "name": "Honduras",
          "code": "HN"
        },
        {
          "id": 8,
          "name": "Costa Rica",
          "code": "CR"
        }
      ]
    }
  ],
  "component": {
    "id": 163,
    "sku": "MOTO-REPUESTO-AREA-0001",
    "name": "Kit de servicio motocicleta"
  },
  "createdDate": "2026-06-05T05:10:23.362Z"
}

Error responses for this endpoint follow the shared error reference.

Purpose

Creates or updates the area-based pricing (price and cost per geographic area) of a component product in Sodtrack.

This endpoint works as an upsert: it locates (or creates) the pricing record of the referenced component and then applies each pricing group you send. Each group assigns a price and cost to a set of areas.

An area can only belong to one pricing group at a time. If an area you send is currently assigned to another group, Sodtrack moves it to the new group automatically (it is removed from its previous group; if that group is left empty it is deleted).

The whole request is validated before any change is applied, so a request that fails a business rule is rejected without leaving partial changes.


Field Definitions

🔐 Authentication

FieldTypeRequiredDescription
x-api-key (header)stringSodtrack integration API key. Requests with a missing/invalid key (or from an unauthorized network) are rejected.

🧩 Component

FieldTypeRequiredDescription
productobjectThe component whose pricing is being set. Must reference a product of type component.
product.typestringHow the component is identified. One of: "productSku", "productId".
product.valuestringThe component SKU (when type is "productSku") or the numeric component id (when type is "productId").

💲 Area pricing groups

FieldTypeRequiredDescription
areasarrayNon-empty list of pricing groups. Each group sets a price/cost for one set of areas.
areas[].typestringHow the areas in this group are identified. One of: "areaId", "areaReference".
areas[].valuesstring[]Non-empty list of area identifiers: area ids (when type is "areaId") or area reference codes (when type is "areaReference").
areas[].pricenumberSale price applied to those areas.
areas[].costnumberCost applied to those areas.

All areas within a single group must share the same currency. An area cannot appear in more than one group in the same request.


Example Request

json
{
  "product": {
    "type": "productSku",
    "value": "MOTO-REPUESTO-AREA-0001"
  },
  "areas": [
    { "type": "areaId", "values": ["1"], "price": 100, "cost": 80 },
    { "type": "areaReference", "values": ["HN", "CR"], "price": 5000, "cost": 4000 }
  ]
}

Response Example

json
{
  "id": 45,
  "entityType": "COMPONENT",
  "entityRefId": "163",
  "active": true,
  "itemsCount": 2,
  "items": [
    {
      "id": 101,
      "price": 100,
      "cost": 80,
      "areas": [{ "id": 1, "name": "Nicaragua", "code": "NIC" }]
    },
    {
      "id": 102,
      "price": 5000,
      "cost": 4000,
      "areas": [
        { "id": 7, "name": "Honduras", "code": "HN" },
        { "id": 8, "name": "Costa Rica", "code": "CR" }
      ]
    }
  ],
  "component": {
    "id": 163,
    "sku": "MOTO-REPUESTO-AREA-0001",
    "name": "Kit de servicio motocicleta"
  },
  "createdDate": "2026-06-05T05:10:23.362Z"
}

Response Fields

FieldTypeDescription
idnumberUnique Sodtrack identifier of the pricing record.
entityTypestringAlways "COMPONENT" for this endpoint.
entityRefIdstringThe component id this pricing belongs to.
activebooleanWhether the pricing record is active.
itemsCountnumberNumber of pricing groups currently configured.
items[].idnumberIdentifier of the pricing group.
items[].pricenumberPrice configured for the group's areas.
items[].costnumberCost configured for the group's areas.
items[].areas[]arrayResolved areas in the group (each includes its id, name, and reference code).
componentobjectThe component the pricing belongs to (id, sku, name).
createdDatestringISO date when the pricing record was created.

Error Responses

HTTP StatusErrorDescription
400 Bad RequestThe referenced product is not a component, the component lookup type is not supported, an area id is not numeric, an area reference is ambiguous, an area appears in more than one group, or a group mixes areas of different currencies.
401 UnauthorizedAPI key missing/invalid, or request not from an authorized network.
404 Not FoundThe component (by id/SKU) or a referenced area (by id/reference) was not found.
500 Internal Server ErrorUnexpected server error. Contact Sodtrack support.

Business Rules & Constraints

Upsert behavior

If the component has no pricing record yet, Sodtrack creates one. Each group in areas is then applied:

ScenarioBehavior
Group's exact area set already existsIts price/cost is updated (skipped if unchanged).
Group's area set is newA new pricing group is created.
An area is already in another groupThe area is moved to the new group; its previous group keeps its remaining areas (or is removed if left empty).

All-or-nothing validation

The request is fully validated before any write: components and areas must resolve, no area can be repeated across groups, and each group's areas must share one currency. If any check fails, the request is rejected and nothing is changed.

Area identification

  • areaId: each value must be a numeric, active area id.
  • areaReference: each value must match exactly one active area by its reference code (an ambiguous code is rejected).