Update Component Price/Cost
Creates or updates the area-based pricing (price and cost per geographic area) of a component product in Sodtrack.
/api/integration/area-pricingRequest
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
| Name | Type | Description |
|---|---|---|
origin | string | — |
Responses
{
"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
| Field | Type | Required | Description |
|---|---|---|---|
x-api-key (header) | string | ✅ | Sodtrack integration API key. Requests with a missing/invalid key (or from an unauthorized network) are rejected. |
🧩 Component
| Field | Type | Required | Description |
|---|---|---|---|
product | object | ✅ | The component whose pricing is being set. Must reference a product of type component. |
product.type | string | ✅ | How the component is identified. One of: "productSku", "productId". |
product.value | string | ✅ | The component SKU (when type is "productSku") or the numeric component id (when type is "productId"). |
💲 Area pricing groups
| Field | Type | Required | Description |
|---|---|---|---|
areas | array | ✅ | Non-empty list of pricing groups. Each group sets a price/cost for one set of areas. |
areas[].type | string | ✅ | How the areas in this group are identified. One of: "areaId", "areaReference". |
areas[].values | string[] | ✅ | Non-empty list of area identifiers: area ids (when type is "areaId") or area reference codes (when type is "areaReference"). |
areas[].price | number | ✅ | Sale price applied to those areas. |
areas[].cost | number | ✅ | Cost 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
{
"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
{
"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
| Field | Type | Description |
|---|---|---|
id | number | Unique Sodtrack identifier of the pricing record. |
entityType | string | Always "COMPONENT" for this endpoint. |
entityRefId | string | The component id this pricing belongs to. |
active | boolean | Whether the pricing record is active. |
itemsCount | number | Number of pricing groups currently configured. |
items[].id | number | Identifier of the pricing group. |
items[].price | number | Price configured for the group's areas. |
items[].cost | number | Cost configured for the group's areas. |
items[].areas[] | array | Resolved areas in the group (each includes its id, name, and reference code). |
component | object | The component the pricing belongs to (id, sku, name). |
createdDate | string | ISO date when the pricing record was created. |
Error Responses
| HTTP Status | Error | Description |
|---|---|---|
400 Bad Request | — | The 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 Unauthorized | — | API key missing/invalid, or request not from an authorized network. |
404 Not Found | — | The component (by id/SKU) or a referenced area (by id/reference) was not found. |
500 Internal Server Error | — | Unexpected 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:
| Scenario | Behavior |
|---|---|
| Group's exact area set already exists | Its price/cost is updated (skipped if unchanged). |
| Group's area set is new | A new pricing group is created. |
| An area is already in another group | The 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).