Common Workflows

Step-by-step guides for common API tasks

Create a Product with Variants

A common workflow: create a product, then add options and variants for sizes and colors.

Step 1: Create the product:

curl -X POST https://yourshop.zeroshop.io/admin/api/products \
  -H "Authorization: Bearer zspat_..." \
  -H "Content-Type: application/json" \
  -d '{"name": "Classic Hoodie", "price": 5999, "product_type": "physical", "visible": true}'

# Note the product ID from the response (e.g., 42)

Step 2: Save options and variants (this creates Size and Color options plus all variant combinations):

curl -X PUT https://yourshop.zeroshop.io/admin/api/products/42/variants \
  -H "Authorization: Bearer zspat_..." \
  -H "Content-Type: application/json" \
  -d '{
    "options": [
      {"name": "Size", "values": ["S", "M", "L", "XL"]},
      {"name": "Color", "values": ["Black", "Navy"]}
    ],
    "variants": [
      {"options": {"Size": "S", "Color": "Black"}, "price": 5999, "sku": "HOODIE-S-BLK"},
      {"options": {"Size": "M", "Color": "Black"}, "price": 5999, "sku": "HOODIE-M-BLK"},
      {"options": {"Size": "L", "Color": "Black"}, "price": 5999, "sku": "HOODIE-L-BLK"},
      {"options": {"Size": "XL", "Color": "Black"}, "price": 6499, "sku": "HOODIE-XL-BLK"},
      {"options": {"Size": "S", "Color": "Navy"}, "price": 5999, "sku": "HOODIE-S-NAV"},
      {"options": {"Size": "M", "Color": "Navy"}, "price": 5999, "sku": "HOODIE-M-NAV"},
      {"options": {"Size": "L", "Color": "Navy"}, "price": 5999, "sku": "HOODIE-L-NAV"},
      {"options": {"Size": "XL", "Color": "Navy"}, "price": 6499, "sku": "HOODIE-XL-NAV"}
    ]
  }'

Process an Order

When a new order comes in, you typically update its status through these stages:

  1. Confirm payment: PATCH /admin/api/orders/{id}/payment-status with {"payment_status": "paid"}
  2. Start processing: PATCH /admin/api/orders/{id}/status with {"status": "processing"}
  3. Ship the order: PATCH /admin/api/orders/{id}/shipping with tracking info
  4. Mark delivered: PATCH /admin/api/orders/{id}/status with {"status": "delivered"}
# Mark as shipped with tracking
curl -X PATCH https://yourshop.zeroshop.io/admin/api/orders/123/shipping \
  -H "Authorization: Bearer zspat_..." \
  -H "Content-Type: application/json" \
  -d '{"tracking_number": "1Z999AA10123456784", "carrier": "UPS"}'

Bulk Import Products

To import many products, use idempotency keys to safely retry on failure. Assign a unique key to each row (e.g., csv-row-{n}) so retries don't create duplicates:

curl -X POST https://yourshop.zeroshop.io/admin/api/products \
  -H "Authorization: Bearer zspat_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: csv-row-1-2026-04-13" \
  -d '{"name": "Widget A", "price": 999}'

We value your privacy

We use cookies for essential site functionality and, with your consent, analytics to understand how our platform is used. No personal data is shared with third parties. See our Privacy Policy for details.