Modules

Barcodes

Look up a scanned code and manage additional and box barcodes.

Overview

The primary barcode is the barcode field of a product and works for every company. With the Barcodes module a product can also have additional codes: the supplier code, an older one or the code of a box. A box code linked to a unit (Box = 12) adds that unit when scanned in the point of sale. GET /v1/products?barcode= matches all of them.

Requires the Barcodes module. An owner or admin turns it on in Settings > Modules. While it is off, every endpoint on this page returns 403 with type permission_error and code module_disabled.

Endpoints

MethodPathPermissionDescription
GET/v1/products/lookup?code=readProduct of a code with stock, reserved, available, latest movements and sales
GET/v1/products/{id}/barcodesreadAdditional barcodes of a product
POST/v1/products/{id}/barcodeswriteAdd a code (code, unit_conversion_id)
DELETE/v1/products/{id}/barcodes/{code_id}writeRemove a code

Look Up a Code

Bash
1curl "https://api.corebill.io/v1/products/lookup?code=7750012000035" \
2 -H "Authorization: Bearer sk_live_your_api_key"
TypeScript
1const found = await corebill.products.lookup('7750012000035')
2if (found.product) console.log(found.product.name, found.stock?.available)
3await corebill.products.createBarcode('itm_9f2c1a', { code: '7750012000042', unit_conversion_id: 'ucv_box12' })
  • matched says what the code was: barcode, extra (additional or box code) or item_code
  • product is null when no product has the code
  • stock is null when the Inventory module is off
  • sales_summary.weeks has the units sold per week in the last 12 weeks, oldest first