Skip to main content

Create Product Barcode

Create a barcode for a product.

Endpointโ€‹

POST /v1/barcodes/products

Required Scopeโ€‹

products:write

Request Bodyโ€‹

FieldTypeRequiredDescription
product_idintegerYesThe product ID to assign the barcode to
barcode_valuestringYesThe barcode value (must be unique)
barcode_typestringYesThe barcode type (e.g., qr, code128)

Available Barcode Typesโ€‹

ValueDescription
qrQR Code (2D)
code128Code 128
code39Code 39
ean13EAN-13
ean8EAN-8
upcaUPC-A

Request Exampleโ€‹

curl -X POST "https://app.equipdash.com/api/v1/barcodes/products" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"product_id": 123,
"barcode_value": "BIKE-MTN-001",
"barcode_type": "code128"
}'

Responseโ€‹

{
"data": {
"id": 1,
"barcode_value": "BIKE-MTN-001",
"barcode_type": "code128",
"barcode_type_label": "Code 128",
"is_auto_generated": false,
"entity_type": "product",
"entity_id": 123,
"entity": {
"type": "product",
"id": 123,
"name": "Mountain Bike",
"sku": "MTB-2024"
},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
},
"meta": {
"request_id": "req_abc123",
"timestamp": "2024-01-15T12:00:00Z"
}
}

Error Responsesโ€‹

Duplicate Barcode Valueโ€‹

{
"error": {
"code": "validation_error",
"message": "The given data was invalid.",
"details": [
{
"field": "barcode_value",
"message": "This barcode value is already in use."
}
]
},
"meta": {
"request_id": "req_abc123"
}
}

Invalid Barcode Valueโ€‹

{
"error": {
"code": "validation_error",
"message": "The given data was invalid.",
"details": [
{
"field": "barcode_value",
"message": "Invalid barcode value for the specified type."
}
]
},
"meta": {
"request_id": "req_abc123"
}
}