Skip to main content

Create Inventory Barcode

Create a barcode for an inventory item. This is typically used for item-level tracking where each physical item has its own unique barcode.

Endpointโ€‹

POST /v1/barcodes/inventory

Required Scopeโ€‹

products:write

Request Bodyโ€‹

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

Request Exampleโ€‹

curl -X POST "https://app.equipdash.com/api/v1/barcodes/inventory" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"inventory_id": 456,
"barcode_value": "INV-MTB-001-A",
"barcode_type": "qr"
}'

Responseโ€‹

{
"data": {
"id": 2,
"barcode_value": "INV-MTB-001-A",
"barcode_type": "qr",
"barcode_type_label": "QR Code",
"is_auto_generated": false,
"entity_type": "inventory",
"entity_id": 456,
"entity": {
"type": "inventory",
"id": 456,
"identifier": "MTB-001",
"product_id": 123,
"product_name": "Mountain Bike",
"variation_id": null
},
"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"
}
}

Use Case: Bulk Barcode Assignmentโ€‹

To assign barcodes to multiple inventory items:

# Get list of inventory items without barcodes
ITEMS=$(curl -s "https://app.equipdash.com/api/v1/products/123/inventory" \
-H "Authorization: Bearer YOUR_API_KEY")

# Create barcode for each item
for ITEM_ID in $(echo $ITEMS | jq '.data.items[].id'); do
curl -X POST "https://app.equipdash.com/api/v1/barcodes/inventory" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"inventory_id\": $ITEM_ID,
\"barcode_value\": \"INV-$(date +%s)-$ITEM_ID\",
\"barcode_type\": \"qr\"
}"
done