API: products, categories and serial numbers
General conventions in How the API works.
The catalog of the key's account. A product, category or serial number from another account does
not exist for the key: it returns 404.
- Money: integer in minor units of the account's currency (COP with 2 decimals:
150000= $1,500.00). The currency is not sent: it is the account's and is read incurrency. - Permissions: everything uses the
productsresource (read,create,update,delete). Categories and serial numbers have no permission of their own. - Serial numbers (physical units) are EAS only: they are used in lockers, where each compartment holds one unit. See Serial numbers.
| Endpoint | Permission |
|---|---|
POST /api/v1/products | products:create |
GET /api/v1/products | products:read |
GET /api/v1/products/:id | products:read |
PATCH /api/v1/products/:id | products:update |
DELETE /api/v1/products/:id | products:delete |
GET /api/v1/products/:id/serial-numbers | products:read |
POST /api/v1/products/:id/serial-numbers/:serialNumber/retire | products:update |
POST /api/v1/products/:id/serial-numbers/:serialNumber/restore | products:update |
DELETE /api/v1/products/:id/serial-numbers/:serialNumber | products:update |
POST /api/v1/product-categories | products:create |
GET /api/v1/product-categories | products:read |
PATCH /api/v1/product-categories/:id | products:update |
DELETE /api/v1/product-categories/:id | products:delete |
In /products/:id, :id is the product's id or SKU; in /product-categories/:id, the
category's id or name. categoryId in bodies and filters also accepts the name (see
References). A product without a SKU can only be referenced by id.
The product
{
"id": "01a1213b-c157-71a8-8d63-2aaea6939525",
"name": "Safety helmet",
"sku": "EPP-CAS",
"description": null,
"category": { "id": "01a1213b-c0de-724f-be8a-df6b67a58917", "name": "EPP" },
"cost": 1500000,
"sellPrice": 2200000,
"taxRate": 19,
"currency": "COP",
"minorUnitDecimals": 2,
"createdAt": "2026-10-09T15:15:26.679Z",
"updatedAt": "2026-10-09T15:15:26.679Z"
}
| Field | Type | Description |
|---|---|---|
id | string | Product id or SKU. |
name | string | Name. Unique in the account, ignoring case and repeated spaces ("Red helmet" = "red helmet"). |
sku | string | null | Identifies the product in the account: the device uses it in the planogram and in everything it reports. Unique in the account (exact). null only on old products without a SKU. |
description | string | null | Free description. |
category | object | null | Category of the account: { id, name }. null = no category. |
cost | integer ≥ 0 | Cost in minor units. 0 = no cost. |
sellPrice | integer ≥ 0 | Sell price in minor units. 0 = no price set (not "free"). In EAS it values the equipment delivered; in VENDING it is not what the machine charges, which charges the price it reports itself. |
taxRate | number | null | Tax percentage (0–100, up to 2 decimals). null only on products created in the app without tax; through the API a number is always written (0 = no tax). |
currency | string ISO 4217 | Currency of the account (that of cost and sellPrice). Read-only. |
minorUnitDecimals | integer | Decimals of the currency (COP = 2). Value of cost and sellPrice = amount / 10^minorUnitDecimals. |
createdAt / updatedAt | ISO 8601 UTC |
A product has no active/inactive state: it exists or it is deleted.
Create a product
POST /api/v1/products
Permission: products:create. Creates the product in the key's account, with its serial numbers
if you send them.
| Field | Type | Required | Limits | Editable later |
|---|---|---|---|---|
name | string | yes | 2–150; unique in the account | yes |
sku | string | yes | 1–64; unique in the account | yes (never empty) |
description | string | null | no | Max 500 | yes |
cost | integer | yes | 0 – 9007199254740991, minor units; 0 = no cost | yes |
sellPrice | integer | yes | 0 – 9007199254740991, minor units; 0 = no price | yes |
taxRate | number | yes | 0–100, up to 2 decimals; 0 = no tax | yes |
categoryId | string | null | no | A category of the account: its id or its name | yes |
serialNumbers | string[] | no | Max 1000; each 1–64; EAS accounts only | added and removed with PATCH |
cost, sellPrice and taxRate are required: a product with no price is created with 0, not
by omitting the field. The currency is not sent: sending currency, or any field not in the table,
returns 422 validation.failed.
curl -X POST https://back.inssacs.com/api/v1/products \
-H 'x-api-key: ics_a1b2c3d4_e5f6...' \
-H 'Content-Type: application/json' \
-d '{
"name": "Safety helmet",
"sku": "EPP-CAS",
"description": null,
"cost": 1500000,
"sellPrice": 2200000,
"taxRate": 19,
"categoryId": "01a1213b-c0de-724f-be8a-df6b67a58917",
"serialNumbers": ["CAS-0001", "CAS-0002"]
}'
All or nothing: the product and its serial numbers are created together. If one serial fails, the product is not created.
Response 201: the created product. Serials are read in
GET /products/:id/serial-numbers.
Errors
| HTTP | code | When |
|---|---|---|
| 400 | products.invalid_name | Name shorter than 2 characters after trimming. |
| 400 | products.sku_required | SKU empty or only spaces. |
| 400 | products.unit_serial_empty | A serial is empty after trimming. errors[].field: serialNumbers[i]. |
| 400 | products.unit_serial_duplicated | The same serial twice in the list. errors[].field: serialNumbers[i] (the second occurrence). |
| 404 | product_categories.not_found | No category with that id or name in the account. |
| 409 | products.code_exists | A product with that SKU already exists in the account. |
| 409 | products.name_exists | A product with that name already exists in the account. |
| 409 | products.unit_serial_exists | The serial is already registered in the account, on any product. errors[].field: serialNumbers[i]. |
| 409 | products.serials_not_supported | Serials were sent and the account is not EAS. |
| 422 | validation.failed | Invalid body: missing required field, limit exceeded, negative or decimal amount, unknown field. |
List products
GET /api/v1/products
Permission: products:read.
| Query | Type | Required | Default | Limits / values | What it does |
|---|---|---|---|---|---|
page | integer | no | 1 | ≥ 1 | Page. |
pageSize | integer | no | 50 | 1–200 | Products per page. |
sortBy | enum | no | createdAt | createdAt, updatedAt, name, sku | Sort field. Anything else → 422. |
sortOrder | enum | no | desc | asc, desc | Direction. |
search | string | no | — | Max 100 | Case-insensitive "contains" on the name. |
sku | string | no | — | Max 64 | Exact SKU, case-insensitive. Use it to get the id of a SKU. |
categoryId | string | no | — | id or name | Products in that category. If it does not exist in the account → empty page. |
from | ISO 8601 | no | — | valid date | createdAt ≥ from (inclusive). |
to | ISO 8601 | no | — | valid date | createdAt before to (exclusive). |
Sort ties are broken by id. Deleted products never appear.
curl 'https://back.inssacs.com/api/v1/products?sku=EPP-CAS' \
-H 'x-api-key: ics_a1b2c3d4_e5f6...'
Response 200
{
"data": [
{
"id": "01a1213b-c157-71a8-8d63-2aaea6939525",
"name": "Safety helmet",
"sku": "EPP-CAS",
"description": null,
"category": { "id": "01a1213b-c0de-724f-be8a-df6b67a58917", "name": "EPP" },
"cost": 1500000,
"sellPrice": 2200000,
"taxRate": 19,
"currency": "COP",
"minorUnitDecimals": 2,
"createdAt": "2026-10-09T15:15:26.679Z",
"updatedAt": "2026-10-09T15:15:26.679Z"
}
],
"pagination": { "page": 1, "pageSize": 50, "total": 1 }
}
Get a product
GET /api/v1/products/:id
Permission: products:read.
| Path param | Type | Description |
|---|---|---|
id | string | Product id or SKU. |
Response 200: the product. Error: 404 products.not_found (no product with that
id or SKU in the account).
Edit a product
PATCH /api/v1/products/:id
Permission: products:update. Partial edit; it also adds and removes serial numbers.
| Path param | Type | Description |
|---|---|---|
id | string | Product id or SKU. |
Every field is optional, but a field you send must carry a valid value. null is accepted only
where stated.
| Field | Type | Limits | Accepts null? |
|---|---|---|---|
name | string | 2–150; unique in the account | no |
sku | string | 1–64; unique in the account | no |
description | string | null | Max 500 | yes: clears the description |
cost | integer | 0 – 9007199254740991 | no |
sellPrice | integer | 0 – 9007199254740991 | no |
taxRate | number | 0–100, up to 2 decimals | no |
categoryId | string | null | A category of the account: its id or its name | yes: leaves the product without category |
addSerialNumbers | string[] | Max 1000; each 1–64; EAS accounts only | — |
removeSerialNumbers | string[] | Max 1000; serials of this product | — |
Only those fields. currency, id, createdAt, updatedAt or anything else returns
422 validation.failed.
{
"sellPrice": 2500000,
"addSerialNumbers": ["CAS-0003"],
"removeSerialNumbers": ["CAS-0002"]
}
- All or nothing: serials are removed first, then added, then the fields are edited. If any step fails, nothing changes.
- The same serial in both
addSerialNumbersandremoveSerialNumbersreturns400. - Changing the
skuchanges what devices receive in the planogram: coordinate it with the machines that already have the product loaded.
Response 200: the updated product.
Errors
| HTTP | code | When |
|---|---|---|
| 400 | http.bad_request | The same serial in addSerialNumbers and removeSerialNumbers. |
| 400 | products.invalid_name | Name shorter than 2 characters after trimming. |
| 400 | products.sku_required | SKU empty or only spaces. |
| 400 | products.unit_serial_empty / products.unit_serial_duplicated | As on create; errors[].field: addSerialNumbers[i]. |
| 404 | products.not_found | The product does not exist, was deleted or belongs to another account. |
| 404 | product_categories.not_found | No category with that id or name in the account. |
| 404 | products.unit_not_found | A serial in removeSerialNumbers does not belong to this product. |
| 409 | products.code_exists | Another product of the account already has that SKU. |
| 409 | products.name_exists | Another product of the account already has that name. |
| 409 | products.unit_serial_exists | A serial in addSerialNumbers is already registered in the account. |
| 409 | products.serials_not_supported | addSerialNumbers on an account that is not EAS. |
| 409 | products.unit_in_device | A serial to remove is loaded in a compartment: take it out of the machine first. |
| 409 | products.unit_in_ticket | A serial to remove is in some ticket (used or not). |
| 422 | validation.failed | Invalid body, null where not accepted, non-editable field. |
Delete a product
DELETE /api/v1/products/:id
Permission: products:delete. Path param id (id or SKU). Response 204 with no body.
What blocks it (409 products.in_use):
- The product has units loaded (
currentQtygreater than 0) in a selection of a locker or a return module. Take them out of the machine first. - The product is in active or inactive (not expired) tickets with unused items. Remove those items or cancel the tickets.
In VENDING loaded units do not block: the selection is emptied automatically.
What deleting does, all together:
- Planograms: every selection holding the product becomes empty (no product or quantities). The selection itself is not deleted.
- EAS profiles: the product's lines are removed from profiles. The profile keeps its other lines.
- The product disappears from lists and by id (
404), and its SKU and name become free.
History is kept (deliveries, returns, selection movements), each with its own copy of the product and serial. The product's serial numbers are not deleted, but they stop being visible and stay taken in the account.
| HTTP | code | When |
|---|---|---|
| 404 | products.not_found | Does not exist, already deleted or belongs to another account. |
| 409 | products.in_use | Units loaded in a locker or return module, or in current tickets with unused items. |
Serial numbers
Optional per product: a product is serialized if it has registered units. EAS accounts only (lockers, one unit per compartment), where they trace which unit went out and which came back.
- They are registered when creating the product (
serialNumbers) or withPATCH(addSerialNumbers), and removed withPATCH(removeSerialNumbers) or withDELETE. - A serial is unique in the account, not just in the product: a serial alone tells which product it belongs to.
- A new unit starts
AVAILABLE.
The unit
{
"id": "01a1213b-c160-773c-bbdf-712239fcc341",
"product": { "id": "01a1213b-c157-71a8-8d63-2aaea6939525", "sku": "EPP-CAS", "name": "Casco de seguridad" },
"serialNumber": "CAS-0001",
"status": "AVAILABLE",
"device": null,
"selection": null,
"createdAt": "2026-10-09T15:15:26.688Z",
"updatedAt": "2026-10-09T15:15:26.688Z"
}
| Field | Type | Description |
|---|---|---|
id | uuid | Unit id. |
product | object | null | Product it belongs to: { id, sku, name }. |
serialNumber | string | Serial. |
status | enum | AVAILABLE (in the warehouse), IN_DEVICE (loaded in a compartment), OUT (delivered, in the field), RETIRED (written off). |
device | object | null | Device where it is loaded (IN_DEVICE): { id, serial, name }. |
selection | string | null | Compartment where it is loaded. |
createdAt / updatedAt | ISO 8601 UTC |
IN_DEVICE and OUT are set by the devices (load, delivery, return). Through the API you can only
write off (RETIRED) or return to the warehouse (AVAILABLE) a unit that is neither in a
compartment nor in the field.
List serial numbers
GET /api/v1/products/:id/serial-numbers
Permission: products:read. Path param id (product id or SKU).
| Query | Type | Required | Default | Limits / values |
|---|---|---|---|---|
page | integer | no | 1 | ≥ 1 |
pageSize | integer | no | 50 | 1–200 |
sortBy | enum | no | serialNumber | serialNumber, createdAt, updatedAt |
sortOrder | enum | no | desc | asc, desc |
status | enum | no | — (all) | AVAILABLE, IN_DEVICE, OUT, RETIRED |
{
"data": [
{
"id": "01a1213b-c160-773c-bbdf-712239fcc341",
"product": { "id": "01a1213b-c157-71a8-8d63-2aaea6939525", "sku": "EPP-CAS", "name": "Casco de seguridad" },
"serialNumber": "CAS-0001",
"status": "IN_DEVICE",
"device": { "id": "00000000-0000-7000-8000-e30000000001", "serial": "LK20W000001", "name": "Locker Planta 1" },
"selection": "A1",
"createdAt": "2026-10-09T15:15:26.688Z",
"updatedAt": "2026-10-09T16:02:11.120Z"
}
],
"pagination": { "page": 1, "pageSize": 50, "total": 1 }
}
In a VENDING account the page is empty. Error: 404 products.not_found.
Write off and restore a unit
POST /api/v1/products/:id/serial-numbers/:serialNumber/retire
POST /api/v1/products/:id/serial-numbers/:serialNumber/restore
Permission: products:update. No body.
| Path param | Type | Description |
|---|---|---|
id | string | Product id or SKU. |
serialNumber | string | Exact serial, URL-encoded. |
| Action | Allowed transitions | Blocked |
|---|---|---|
retire | AVAILABLE → RETIRED; RETIRED → RETIRED (no change) | From IN_DEVICE or OUT → 409 |
restore | RETIRED → AVAILABLE; AVAILABLE → AVAILABLE (no change) | From IN_DEVICE or OUT → 409 |
A RETIRED unit can no longer go into new ticket withdrawals.
Response 200: the unit with its new status.
| HTTP | code | When |
|---|---|---|
| 404 | products.not_found | The product does not exist or belongs to another account. |
| 404 | products.unit_not_found | The serial does not belong to this product. |
| 409 | products.unit_status_locked | The unit is IN_DEVICE or OUT: that state is set by the devices. |
Delete a unit
DELETE /api/v1/products/:id/serial-numbers/:serialNumber
Permission: products:update (deleting a serial is editing the product). Path params as in
retire. Response 204 with no body.
History is not lost (deliveries and returns keep the serial) and the serial becomes free to be registered again in the account.
| HTTP | code | When |
|---|---|---|
| 404 | products.not_found | The product does not exist or belongs to another account. |
| 404 | products.unit_not_found | The serial does not belong to this product. |
| 409 | products.unit_in_device | It is loaded in a compartment: take it out of the machine first. |
| 409 | products.unit_in_ticket | Some ticket includes it (used or not). Use retire instead. |
Categories
Each account builds its own categories. They use the products permissions.
{
"id": "01a1213b-c0de-724f-be8a-df6b67a58917",
"name": "Beverages",
"createdAt": "2026-10-09T15:15:26.600Z",
"updatedAt": "2026-10-09T15:15:26.600Z"
}
| Field | Type | Description |
|---|---|---|
id | uuid | Category id. |
name | string | 2–60 characters. Unique in the account, ignoring case and repeated spaces. |
createdAt / updatedAt | ISO 8601 UTC |
Create a category
POST /api/v1/product-categories
Permission: products:create.
| Field | Type | Required | Limits | Editable later |
|---|---|---|---|---|
name | string | yes | 2–60; unique in the account | yes |
{ "name": "Beverages" }
Response 201: the created category.
| HTTP | code | When |
|---|---|---|
| 400 | product_categories.invalid_name | Shorter than 2 characters after trimming. |
| 409 | product_categories.name_exists | A category with that name already exists in the account. |
| 422 | validation.failed | Invalid body or unknown field. |
List categories
GET /api/v1/product-categories
Permission: products:read.
| Query | Type | Required | Default | Limits / values |
|---|---|---|---|---|
page | integer | no | 1 | ≥ 1 |
pageSize | integer | no | 50 | 1–200 |
sortBy | enum | no | createdAt | createdAt, updatedAt, name |
sortOrder | enum | no | desc | asc, desc |
search | string | no | — | Max 100. Case-insensitive "contains" on the name. |
{
"data": [
{
"id": "01a1213b-c0de-724f-be8a-df6b67a58917",
"name": "Beverages",
"createdAt": "2026-10-09T15:15:26.600Z",
"updatedAt": "2026-10-09T15:15:26.600Z"
}
],
"pagination": { "page": 1, "pageSize": 50, "total": 1 }
}
There is no GET by id. To count a category's products:
GET /api/v1/products?categoryId=…&pageSize=1 and read pagination.total.
Rename a category
PATCH /api/v1/product-categories/:id
Permission: products:update. Path param id (category id or name). name is the only field and is
required (2–60; unique in the account). Products are not touched.
{ "name": "Cold beverages" }
Response 200: the updated category.
| HTTP | code | When |
|---|---|---|
| 400 | product_categories.invalid_name | Shorter than 2 characters after trimming. |
| 404 | product_categories.not_found | Does not exist, was deleted or belongs to another account. |
| 409 | product_categories.name_exists | Another category of the account already has that name. |
| 422 | validation.failed | name missing or another field sent. |
Delete a category
DELETE /api/v1/product-categories/:id
Permission: products:delete. Path param id (category id or name). Response 204 with no body.
Nothing blocks it and it does not delete products: those using it are left without a category
(categoryId: null).
Error: 404 product_categories.not_found (does not exist, already deleted or belongs to another
account).
How tickets use products and serial numbers
Tickets (EAS accounts only) are credentials with a list of items to withdraw or
return at a locker. Each item is one unit and references the catalog with exactly one of
sku, productId or serialNumber:
- By
skuorproductId: any unit of that product. The product must exist in the account (400 tickets.item_product_not_found). - By
serialNumber: one specific unit; the serial identifies the product by itself. It cannot be repeated within the ticket (400 tickets.serial_duplicated).
| Item | Rule with serial numbers |
|---|---|
Withdrawal (isReturn: false) | The unit cannot be RETIRED or OUT, nor reserved in an unused withdrawal of another current ticket (409 tickets.serial_unavailable). |
Return (isReturn: true) | An IN_DEVICE unit cannot be returned: it is already in a compartment (409 tickets.serial_in_device). By sku/productId any unit of the product is valid: if it is serialized, the unit the locker reports when it receives it is recorded. |
Return rules as the app applies them:
isReturnable(withdrawals only): returnable withdrawal. What goes out must come back, and the return is linked to that delivery. Ignored withisReturn: true.isReusable: what comes back becomes available to be delivered again. It only applies to what comes back (a return or a returnable withdrawal); on a non-returnable withdrawal it is ignored.- These flags belong to the ticket item, not the product: the product stores no return rules. In profiles they live on each profile × product line (see profiles).
Effect on units:
- What lockers report moves the unit's state: a delivery sets it
OUT; a return or a compartment load,IN_DEVICE. - A unit included in any ticket cannot be deleted (
409 products.unit_in_ticket), neither withDELETE …/serial-numbers/:serialNumbernor withremoveSerialNumbers. It can be written off (retire), and then it no longer goes into new withdrawals. - A product in current tickets with unused items cannot be deleted (
409 products.in_use, see delete a product).
Errors common to every endpoint: 401 http.unauthorized, 403 http.forbidden (missing
permission), 422 validation.failed, 429 http.too_many_requests.