Skip to main content
POST
Generate Barcode
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
400
409

Example