Generating Product Codes

Generating Product Codes

This guide uses the {version} product family endpoints. The base URL for all requests is https://DOMAIN_PREFIX.retail.lightspeed.app/api/{version}/.

Every product in a family must have at least one product code.

Codes are not generated automatically during product or family creation. If you do not already have codes to use, generate them first.

Send a POST request to /products/generate_product_codes.

Each entry in codes requests a count of generated codes, with an optional prefix.

When prefix is omitted, numeric codes are generated from your configured SKU sequence.

Request payload:

{
  "codes": [{ "count": 2 }, { "prefix": "shirt", "count": 2 }]
}

Response payload:

{
  "data": [{ "codes": ["1001", "1002"] }, { "codes": ["shirt", "shirt1"] }]
}

NOTE: A single request may generate up to 200 codes in total.