Skip to main content
POST
/
products
/
barcode
Generate Barcode
curl --request POST \
  --url https://staging-api.puppetvendors.com/products/barcode \
  --header 'x-access-token: <api-key>'

Documentation Index

Fetch the complete documentation index at: https://dev.puppetvendors.com/llms.txt

Use this file to discover all available pages before exploring further.

V2 Preview — This endpoint is part of the V2 API preview. Breaking changes may occur.

Overview

Generate a unique barcode using the shop’s barcode configuration (type, prefix, and length). The barcode is validated for uniqueness against Shopify before being returned, so you can safely assign it to a variant without collisions. This endpoint requires the barcode feature to be enabled by the merchant in shop settings.

Use Cases

  • Auto-generate barcodes when creating new product variants
  • Replace missing barcodes on existing variants
  • Generate barcodes in bulk for inventory labeling

Required Scope

products:write

Request Body

No request body is required. The barcode format (type, prefix, length) is determined by the shop’s barcode configuration.

Response

200
{
  "success": true,
  "data": {
    "barcode": "PV10038472"
  }
}
400
{
  "success": false,
  "error": {
    "message": "Barcode generation is not enabled for this shop",
    "code": "FEATURE_DISABLED"
  }
}
409
{
  "success": false,
  "error": {
    "message": "Unable to generate a unique barcode after maximum retries",
    "code": "BARCODE_EXHAUSTED"
  }
}

Example

curl -X POST "https://staging-api.puppetvendors.com/products/barcode" \
  -H "x-access-token: YOUR_VENDOR_JWT"