API: profiles
General conventions in How the API works.
Consumption profiles of the key's account. The shape of a profile depends on the account's business line:
- VENDING account: the profile carries
vending(subsidy and reload) andlinesisnull. - EAS account: the profile carries
lines(one line per product) andvendingisnull.
Sending vending on an EAS account, or lines on a VENDING one, returns
400 profiles.policy_mismatch: it is not ignored.
| Endpoint | Permission |
|---|---|
POST /api/v1/profiles | profiles:create |
GET /api/v1/profiles | profiles:read |
GET /api/v1/profiles/:id | profiles:read |
PATCH /api/v1/profiles/:id | profiles:update |
POST /api/v1/profiles/:id/activate · /deactivate | profiles:update |
DELETE /api/v1/profiles/:id | profiles:delete |
:id is the profile's id or name. In bodies, allowedDeviceIds accepts ids or serials and
lines[].productId ids or SKUs (see References). Anything that does not
exist in the account returns 404.
The profile
EAS account profile:
{
"id": "01a1213c-2d4e-72a8-8c1c-1ba74ea70c6a",
"name": "PPE Operators",
"isActive": true,
"currency": "COP",
"minorUnitDecimals": 2,
"timezone": "America/Bogota",
"period": { "type": "PRESET", "value": "MONTHLY", "dates": null },
"nextReloadAt": "2026-11-01T05:00:00.000Z",
"consumptionSchedule": { "weekdays": [1, 2, 3, 4, 5], "includeDates": [], "excludeDates": ["2026-12-25"] },
"allowedDevices": [{ "id": "00000000-0000-7000-8000-e30000000001", "serial": "LK20W000001", "name": "Locker Planta 1" }],
"vending": null,
"lines": [
{
"product": { "id": "00000000-0000-7000-8000-e10000000002", "sku": "EPP-CAS", "name": "Casco de seguridad" },
"quantity": null,
"minutesBetweenDeliveries": 60,
"isReturnable": true,
"restrictDelivery": true,
"isReusable": true
}
],
"createdAt": "2026-10-09T15:15:54.319Z",
"updatedAt": "2026-10-09T15:15:54.319Z"
}
VENDING account profile:
{
"id": "01a1213c-2d4e-72a8-8c1c-2cb85fb81d7b",
"name": "Plant subsidy",
"isActive": true,
"currency": "COP",
"minorUnitDecimals": 2,
"timezone": "America/Bogota",
"period": { "type": "PRESET", "value": "MONTHLY", "dates": null },
"nextReloadAt": "2026-11-01T05:00:00.000Z",
"consumptionSchedule": null,
"allowedDevices": [],
"vending": {
"defaultReloadValue": 500000,
"maxBalance": 1000000,
"isCumulative": true,
"balanceResetDates": ["2026-12-31"]
},
"lines": null,
"createdAt": "2026-10-09T15:15:54.319Z",
"updatedAt": "2026-10-09T15:15:54.319Z"
}
| Field | Type | Description |
|---|---|---|
id | uuid | |
name | string | Unique in the account, ignoring case and repeated spaces. |
isActive | boolean | false = deactivated (reversible). |
currency | string ISO 4217 | The account's currency; applies to the vending amounts. Never changes. |
minorUnitDecimals | integer | Decimals of currency (COP = 2): real amount = amount / 10^minorUnitDecimals. |
timezone | string IANA | Defines the reload midnight and the consumption day. Cannot be edited. |
period.type | enum | PRESET or CUSTOM. |
period.value | enum | null | DAILY, WEEKLY, BIWEEKLY, MONTHLY, QUARTERLY, SEMIANNUAL, ANNUAL. Only with PRESET; null with CUSTOM. |
period.dates | string[] | null | Reload dates YYYY-MM-DD in the profile's time zone. Only with CUSTOM; null with PRESET. |
nextReloadAt | ISO 8601 UTC | null | Next reload, computed on read. null if a CUSTOM has no future dates left. |
consumptionSchedule | object | null | Days when consumption is allowed. null = no restriction. See rules. |
allowedDevices | object[] | Devices where it works: { id, serial, name }. [] = all the account's devices. |
vending | object | null | VENDING accounts only. |
vending.defaultReloadValue | integer | null | Subsidy loaded on each reload, in minor units. null = no automatic reload. |
vending.maxBalance | integer | null | Subsidy cap, in minor units. null = no cap. |
vending.isCumulative | boolean | true = the reload adds to the previous balance; false = it replaces it. |
vending.balanceResetDates | string[] | YYYY-MM-DD dates when the accumulated subsidy goes back to 0. Always [] if isCumulative is false. |
lines | object[] | null | EAS accounts only. One per product. |
lines[].product | object | Product of the account: { id, sku, name } (sku is null if it has none). |
lines[].quantity | integer | null | Deliveries per period (≥ 1). null = unlimited. |
lines[].minutesBetweenDeliveries | integer | null | Minimum minutes between deliveries (≥ 1). null = no frequency. Also applies with unlimited quantity. |
lines[].isReturnable | boolean | Returnable: the delivery stays pending return (frozen at delivery time). |
lines[].restrictDelivery | boolean | With a pending return of this product, blocks the next delivery. Always false if isReturnable is false. |
lines[].isReusable | boolean | What is returned can be delivered again. Always false if isReturnable is false. |
createdAt / updatedAt | ISO 8601 UTC |
Rules
- Period: marks when the EAS quota resets and when the VENDING reload runs, at midnight in
timezone. - VENDING reload: on each reload the subsidy becomes
defaultReloadValue(orbalance + defaultReloadValuewithisCumulative: true), capped bymaxBalance.defaultReloadValuecannot exceedmaxBalancewhen both have a value. WithisCumulative: true, on eachbalanceResetDatesdate the subsidy goes back to 0; withisCumulative: falsethose dates are discarded. - Consumption schedule (
consumptionSchedule):null= any day. With an object, a day is valid if its weekday is inweekdays(0 = Sunday … 6 = Saturday) or it is inincludeDates, and it is not inexcludeDates, all in the profile's time zone. An empty object ({}) blocks every day. - Devices (
allowedDeviceIds):[]= works on every device of the account. With at least one, only on those: a new device is not added automatically. - EAS lines: at least one,
productIdnot repeated, products of the account.restrictDeliveryandisReusablewithoutisReturnableare stored asfalse(not an error). - Not editable:
timezoneandcurrency. - Deleting requires that no user code has the profile assigned.
Create a profile
POST /api/v1/profiles
Permission: profiles:create.
| Field | Type | Required | Limits | Editable later |
|---|---|---|---|---|
name | string | yes | 2–100; unique in the account | yes |
timezone | string IANA | yes | A valid IANA zone (America/Bogota); no offsets or abbreviations | no |
period | object | yes | yes | |
period.type | enum | yes | PRESET, CUSTOM | yes |
period.value | enum | with PRESET | DAILY, WEEKLY, BIWEEKLY, MONTHLY, QUARTERLY, SEMIANNUAL, ANNUAL | yes |
period.dates | string[] | with CUSTOM | 1–366 dates YYYY-MM-DD | yes |
consumptionSchedule | object | null | no (default null) | yes | |
consumptionSchedule.weekdays | integer[] | no | Max 7, each 0–6 | yes |
consumptionSchedule.includeDates | string[] | no | Max 366, YYYY-MM-DD | yes |
consumptionSchedule.excludeDates | string[] | no | Max 366, YYYY-MM-DD | yes |
allowedDeviceIds | string[] | no (default []) | Max 5000, not repeated, devices of the account by id or serial | yes (replaces the list) |
vending | object | yes on VENDING; forbidden on EAS | yes (replaces the object) | |
vending.defaultReloadValue | integer | null | yes (the key, always) | 0 – 9007199254740991, minor units | yes |
vending.maxBalance | integer | null | yes (the key, always) | 0 – 9007199254740991, minor units | yes |
vending.isCumulative | boolean | no (default false) | yes | |
vending.balanceResetDates | string[] | no (default []) | Max 366, YYYY-MM-DD | yes |
lines | object[] | yes on EAS; forbidden on VENDING | 1–200, productId not repeated | yes (replaces the list) |
lines[].productId | string | yes | A product of the account: its id or its SKU | yes |
lines[].quantity | integer | null | yes (the key, always) | 1 – 2147483647; null = unlimited | yes |
lines[].minutesBetweenDeliveries | integer | null | no (default null) | 1 – 2147483647 | yes |
lines[].isReturnable | boolean | no (default false) | yes | |
lines[].restrictDelivery | boolean | no (default false) | Only with isReturnable | yes |
lines[].isReusable | boolean | no (default false) | Only with isReturnable | yes |
EAS account example:
{
"name": "PPE Operators",
"timezone": "America/Bogota",
"period": { "type": "PRESET", "value": "MONTHLY" },
"consumptionSchedule": { "weekdays": [1, 2, 3, 4, 5] },
"allowedDeviceIds": [],
"lines": [
{ "productId": "00000000-0000-7000-8000-e10000000002", "quantity": 2, "minutesBetweenDeliveries": 60 },
{ "productId": "00000000-0000-7000-8000-e10000000001", "quantity": null, "isReturnable": true, "restrictDelivery": true }
]
}
VENDING account example:
{
"name": "Plant subsidy",
"timezone": "America/Bogota",
"period": { "type": "PRESET", "value": "MONTHLY" },
"vending": {
"defaultReloadValue": 500000,
"maxBalance": 1000000,
"isCumulative": true,
"balanceResetDates": ["2026-12-31"]
}
}
Response 201: the created profile.
Errors
| HTTP | code | When |
|---|---|---|
| 400 | profiles.policy_mismatch | vending on an EAS account or lines on a VENDING one. |
| 400 | profiles.invalid_eas_policy | EAS account without lines. |
| 400 | profiles.invalid_vending_policy | VENDING account without vending, defaultReloadValue greater than maxBalance, or a balanceResetDates date that does not exist (e.g. February 30). |
| 400 | profiles.invalid_period | Invalid period (e.g. a date that does not exist). |
| 400 | profiles.invalid_consumption_schedule | A schedule date that does not exist. |
| 400 | profiles.device_not_found | An allowedDeviceIds entry is not a device of the account (neither by id nor by serial). |
| 404 | profiles.product_not_found | A lines[].productId is not a product of the account (neither by id nor by SKU). |
| 409 | profiles.name_exists | A profile with that name already exists in the account. |
| 422 | validation.failed | Invalid body, unknown field, productId repeated in lines, repeated allowedDeviceIds. |
List profiles
GET /api/v1/profiles
Permission: profiles: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 |
isActive | boolean | no | — (all) | true/false (also 1/0) |
search | string | no | — | Max 100. Case-insensitive "contains" on name. |
curl 'https://back.inssacs.com/api/v1/profiles?isActive=true&sortBy=name&sortOrder=asc' \
-H 'x-api-key: ics_a1b2c3d4_e5f6...'
Response 200:
{
"data": [
{
"id": "01a1213c-2d4e-72a8-8c1c-2cb85fb81d7b",
"name": "Plant subsidy",
"isActive": true,
"currency": "COP",
"minorUnitDecimals": 2,
"timezone": "America/Bogota",
"period": { "type": "PRESET", "value": "MONTHLY", "dates": null },
"nextReloadAt": "2026-11-01T05:00:00.000Z",
"consumptionSchedule": null,
"allowedDevices": [],
"vending": {
"defaultReloadValue": 500000,
"maxBalance": 1000000,
"isCumulative": true,
"balanceResetDates": ["2026-12-31"]
},
"lines": null,
"createdAt": "2026-10-09T15:15:54.319Z",
"updatedAt": "2026-10-09T15:15:54.319Z"
}
],
"pagination": { "page": 1, "pageSize": 50, "total": 1 }
}
Get a profile
GET /api/v1/profiles/:id
Permission: profiles:read.
| Path param | Type | Description |
|---|---|---|
id | string | Profile id or name. |
Response 200: the profile. Error: 404 profiles.not_found (does not exist, was
deleted or belongs to another account).
Edit a profile
PATCH /api/v1/profiles/:id
Permission: profiles:update. Path param id (id or name). Partial edit.
Accepts the create fields except timezone: name, period, consumptionSchedule,
allowedDeviceIds, vending (VENDING only) and lines (EAS only). Sending timezone, currency or
any other field returns 422 validation.failed.
- Only what you send changes.
consumptionSchedule: nullremoves the day restriction.allowedDeviceIds,linesandvendingreplace the whole value. Invending, what you do not send goes back to its default (isCumulative: false,balanceResetDates: []) and both amount keys are required.vendingandlinesdo not acceptnull.
{
"name": "PPE Operators night shift",
"consumptionSchedule": null,
"lines": [
{ "productId": "00000000-0000-7000-8000-e10000000002", "quantity": 3, "minutesBetweenDeliveries": 120 }
]
}
Response 200: the updated profile.
Errors: those of create (except invalid_eas_policy and invalid_vending_policy for a missing
policy) plus 404 profiles.not_found (does not exist, was deleted or belongs to another account).
Activate and deactivate a profile
POST /api/v1/profiles/:id/activate
POST /api/v1/profiles/:id/deactivate
Permission: profiles:update. Path param id (id or name). No body. Idempotent and reversible:
deactivating deletes nothing.
Response 200: the profile with the new isActive. Error: 404 profiles.not_found.
Delete a profile
DELETE /api/v1/profiles/:id
Permission: profiles:delete. Path param id (id or name). Response 204 with no body.
Permanent: afterwards the profile returns 404. It cannot be deleted while any user code has it
assigned: first change those codes' profile with
PATCH /users/:id/codes/:codeId. To find them:
GET /api/v1/users?profileId=….
| HTTP | code | When |
|---|---|---|
| 404 | profiles.not_found | Does not exist, already deleted or belongs to another account. |
| 409 | profiles.in_use | User codes have the profile assigned. |
Errors common to every endpoint: 404 (no profile with that id or name in the account), 401 http.unauthorized,
403 http.forbidden (missing permission), 429 http.too_many_requests.