Skip to main content

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 in currency.
  • Permissions: everything uses the products resource (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.
EndpointPermission
POST /api/v1/productsproducts:create
GET /api/v1/productsproducts:read
GET /api/v1/products/:idproducts:read
PATCH /api/v1/products/:idproducts:update
DELETE /api/v1/products/:idproducts:delete
GET /api/v1/products/:id/serial-numbersproducts:read
POST /api/v1/products/:id/serial-numbers/:serialNumber/retireproducts:update
POST /api/v1/products/:id/serial-numbers/:serialNumber/restoreproducts:update
DELETE /api/v1/products/:id/serial-numbers/:serialNumberproducts:update
POST /api/v1/product-categoriesproducts:create
GET /api/v1/product-categoriesproducts:read
PATCH /api/v1/product-categories/:idproducts:update
DELETE /api/v1/product-categories/:idproducts: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"
}
FieldTypeDescription
idstringProduct id or SKU.
namestringName. Unique in the account, ignoring case and repeated spaces ("Red helmet" = "red helmet").
skustring | nullIdentifies 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.
descriptionstring | nullFree description.
categoryobject | nullCategory of the account: { id, name }. null = no category.
costinteger ≥ 0Cost in minor units. 0 = no cost.
sellPriceinteger ≥ 0Sell 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.
taxRatenumber | nullTax 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).
currencystring ISO 4217Currency of the account (that of cost and sellPrice). Read-only.
minorUnitDecimalsintegerDecimals of the currency (COP = 2). Value of cost and sellPrice = amount / 10^minorUnitDecimals.
createdAt / updatedAtISO 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.

FieldTypeRequiredLimitsEditable later
namestringyes2–150; unique in the accountyes
skustringyes1–64; unique in the accountyes (never empty)
descriptionstring | nullnoMax 500yes
costintegeryes0 – 9007199254740991, minor units; 0 = no costyes
sellPriceintegeryes0 – 9007199254740991, minor units; 0 = no priceyes
taxRatenumberyes0–100, up to 2 decimals; 0 = no taxyes
categoryIdstring | nullnoA category of the account: its id or its nameyes
serialNumbersstring[]noMax 1000; each 1–64; EAS accounts onlyadded 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​

HTTPcodeWhen
400products.invalid_nameName shorter than 2 characters after trimming.
400products.sku_requiredSKU empty or only spaces.
400products.unit_serial_emptyA serial is empty after trimming. errors[].field: serialNumbers[i].
400products.unit_serial_duplicatedThe same serial twice in the list. errors[].field: serialNumbers[i] (the second occurrence).
404product_categories.not_foundNo category with that id or name in the account.
409products.code_existsA product with that SKU already exists in the account.
409products.name_existsA product with that name already exists in the account.
409products.unit_serial_existsThe serial is already registered in the account, on any product. errors[].field: serialNumbers[i].
409products.serials_not_supportedSerials were sent and the account is not EAS.
422validation.failedInvalid body: missing required field, limit exceeded, negative or decimal amount, unknown field.

List products​

GET /api/v1/products

Permission: products:read.

QueryTypeRequiredDefaultLimits / valuesWhat it does
pageintegerno1≥ 1Page.
pageSizeintegerno501–200Products per page.
sortByenumnocreatedAtcreatedAt, updatedAt, name, skuSort field. Anything else → 422.
sortOrderenumnodescasc, descDirection.
searchstringno—Max 100Case-insensitive "contains" on the name.
skustringno—Max 64Exact SKU, case-insensitive. Use it to get the id of a SKU.
categoryIdstringno—id or nameProducts in that category. If it does not exist in the account → empty page.
fromISO 8601no—valid datecreatedAt ≥ from (inclusive).
toISO 8601no—valid datecreatedAt 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 paramTypeDescription
idstringProduct 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 paramTypeDescription
idstringProduct id or SKU.

Every field is optional, but a field you send must carry a valid value. null is accepted only where stated.

FieldTypeLimitsAccepts null?
namestring2–150; unique in the accountno
skustring1–64; unique in the accountno
descriptionstring | nullMax 500yes: clears the description
costinteger0 – 9007199254740991no
sellPriceinteger0 – 9007199254740991no
taxRatenumber0–100, up to 2 decimalsno
categoryIdstring | nullA category of the account: its id or its nameyes: leaves the product without category
addSerialNumbersstring[]Max 1000; each 1–64; EAS accounts only—
removeSerialNumbersstring[]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 addSerialNumbers and removeSerialNumbers returns 400.
  • Changing the sku changes what devices receive in the planogram: coordinate it with the machines that already have the product loaded.

Response 200: the updated product.

Errors​

HTTPcodeWhen
400http.bad_requestThe same serial in addSerialNumbers and removeSerialNumbers.
400products.invalid_nameName shorter than 2 characters after trimming.
400products.sku_requiredSKU empty or only spaces.
400products.unit_serial_empty / products.unit_serial_duplicatedAs on create; errors[].field: addSerialNumbers[i].
404products.not_foundThe product does not exist, was deleted or belongs to another account.
404product_categories.not_foundNo category with that id or name in the account.
404products.unit_not_foundA serial in removeSerialNumbers does not belong to this product.
409products.code_existsAnother product of the account already has that SKU.
409products.name_existsAnother product of the account already has that name.
409products.unit_serial_existsA serial in addSerialNumbers is already registered in the account.
409products.serials_not_supportedaddSerialNumbers on an account that is not EAS.
409products.unit_in_deviceA serial to remove is loaded in a compartment: take it out of the machine first.
409products.unit_in_ticketA serial to remove is in some ticket (used or not).
422validation.failedInvalid 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 (currentQty greater 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:

  1. Planograms: every selection holding the product becomes empty (no product or quantities). The selection itself is not deleted.
  2. EAS profiles: the product's lines are removed from profiles. The profile keeps its other lines.
  3. 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.

HTTPcodeWhen
404products.not_foundDoes not exist, already deleted or belongs to another account.
409products.in_useUnits 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 with PATCH (addSerialNumbers), and removed with PATCH (removeSerialNumbers) or with DELETE.
  • 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"
}
FieldTypeDescription
iduuidUnit id.
productobject | nullProduct it belongs to: { id, sku, name }.
serialNumberstringSerial.
statusenumAVAILABLE (in the warehouse), IN_DEVICE (loaded in a compartment), OUT (delivered, in the field), RETIRED (written off).
deviceobject | nullDevice where it is loaded (IN_DEVICE): { id, serial, name }.
selectionstring | nullCompartment where it is loaded.
createdAt / updatedAtISO 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).

QueryTypeRequiredDefaultLimits / values
pageintegerno1≥ 1
pageSizeintegerno501–200
sortByenumnoserialNumberserialNumber, createdAt, updatedAt
sortOrderenumnodescasc, desc
statusenumno— (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 paramTypeDescription
idstringProduct id or SKU.
serialNumberstringExact serial, URL-encoded.
ActionAllowed transitionsBlocked
retireAVAILABLE → RETIRED; RETIRED → RETIRED (no change)From IN_DEVICE or OUT → 409
restoreRETIRED → 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.

HTTPcodeWhen
404products.not_foundThe product does not exist or belongs to another account.
404products.unit_not_foundThe serial does not belong to this product.
409products.unit_status_lockedThe 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.

HTTPcodeWhen
404products.not_foundThe product does not exist or belongs to another account.
404products.unit_not_foundThe serial does not belong to this product.
409products.unit_in_deviceIt is loaded in a compartment: take it out of the machine first.
409products.unit_in_ticketSome 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"
}
FieldTypeDescription
iduuidCategory id.
namestring2–60 characters. Unique in the account, ignoring case and repeated spaces.
createdAt / updatedAtISO 8601 UTC

Create a category​

POST /api/v1/product-categories

Permission: products:create.

FieldTypeRequiredLimitsEditable later
namestringyes2–60; unique in the accountyes
{ "name": "Beverages" }

Response 201: the created category.

HTTPcodeWhen
400product_categories.invalid_nameShorter than 2 characters after trimming.
409product_categories.name_existsA category with that name already exists in the account.
422validation.failedInvalid body or unknown field.

List categories​

GET /api/v1/product-categories

Permission: products:read.

QueryTypeRequiredDefaultLimits / values
pageintegerno1≥ 1
pageSizeintegerno501–200
sortByenumnocreatedAtcreatedAt, updatedAt, name
sortOrderenumnodescasc, desc
searchstringno—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.

HTTPcodeWhen
400product_categories.invalid_nameShorter than 2 characters after trimming.
404product_categories.not_foundDoes not exist, was deleted or belongs to another account.
409product_categories.name_existsAnother category of the account already has that name.
422validation.failedname 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 sku or productId: 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).
ItemRule 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 with isReturn: 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 with DELETE …/serial-numbers/:serialNumber nor with removeSerialNumbers. 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.