Products API

List products

GET /brand/products
Authorization: Bearer <token>
X-Organization-Id: <org_id>

Returns:

{
  "data": [
    {
      "id": "01KS...",
      "name": "Classic Crew T-Shirt",
      "sku": "NE-TSH-001",
      "gtin": "5701234567001",
      "categoryId": "textile_apparel",
      "subcategory": "t-shirt",
      "createdAt": 1716000000000,
      "materialCount": 3,
      "batchCount": 2
    }
  ]
}

Create product

POST /brand/products
Authorization: Bearer <token>
X-Organization-Id: <org_id>
Content-Type: application/json
 
{
  "name": "Classic Crew T-Shirt",
  "sku": "NE-TSH-001",
  "categoryId": "textile_apparel",
  "subcategory": "t-shirt",
  "gtin": "5701234567001",
  "ecommerceUrl": "https://example.com/products/crew-tee",
  "careInstructions": "Machine wash 30C",
  "expectedLifespan": "3 years",
  "recyclable": true,
  "recyclingInstructions": "Return to store for textile recycling",
  "materials": [
    {
      "materialType": "cotton_organic",
      "percentage": 95,
      "originCountry": "TR"
    },
    {
      "materialType": "elastane",
      "percentage": 5,
      "originCountry": "CN"
    }
  ]
}

Returns the created product with id.

Get product detail

GET /brand/products/:id
Authorization: Bearer <token>
X-Organization-Id: <org_id>

Returns the full product including materials array with supplier links.

Update product

PUT /brand/products/:id
Authorization: Bearer <token>
X-Organization-Id: <org_id>
Content-Type: application/json
 
{
  "name": "Updated Name",
  "materials": [...]
}

Partial updates are supported — only include the fields you want to change. Materials are replaced entirely (not merged).

Delete product

DELETE /brand/products/:id
Authorization: Bearer <token>
X-Organization-Id: <org_id>

Returns { "ok": true }. Cannot delete a product that has published DPPs.

Bulk import (CSV)

POST /brand/bulk/products
Authorization: Bearer <token>
X-Organization-Id: <org_id>
Content-Type: multipart/form-data
 
file: <csv-file>

Returns:

{
  "created": 12,
  "skipped": 2,
  "errors": [
    { "row": 5, "error": "Missing required field: name" }
  ]
}

See CSV Import for the expected CSV format.