{
  "name": "SmartInvent External API",
  "version": "v1",
  "description": "API for third-party suppliers to generate EPC labels and upload shipment data",
  "endpoints": {
    "supplier": [
      {
        "method": "GET",
        "path": "/v1/products",
        "description": "List products available for the supplier (filtered by allowedTags)"
      },
      {
        "method": "GET",
        "path": "/v1/labels",
        "description": "List label batches created by the supplier"
      },
      {
        "method": "POST",
        "path": "/v1/labels",
        "description": "Create a new batch of EPC labels",
        "body": {
          "productId": "string (required) - Product type code",
          "quantity": "number (required) - Number of labels (1-8000)",
          "size": "string (optional) - Product size",
          "templateId": "string (optional) - ZPL template ID"
        }
      },
      {
        "method": "GET",
        "path": "/v1/labels/{batchId}",
        "description": "Get a specific label batch with ZPL data"
      },
      {
        "method": "POST",
        "path": "/v1/shipments/upload",
        "description": "Upload a CSV file with shipment data and EPC codes",
        "contentType": "text/csv",
        "body": "CSV with columns: purchaseOrderNumber, devoldOrderNumber, customerOrderNumber, receiverGln, smartInventLocationCode, devoldSku, wenaasSku, gtin, colorCode, colorName, size, epc, sscc, shipmentDate, expectedArrivalDate"
      }
    ],
    "admin": [
      {
        "method": "GET",
        "path": "/admin/suppliers",
        "description": "List all suppliers"
      },
      {
        "method": "POST",
        "path": "/admin/suppliers",
        "description": "Create a new supplier",
        "body": {
          "supplierId": "string (required) - Unique supplier identifier",
          "supplierName": "string (required) - Display name",
          "allowedTags": "string[] (required) - Product tags supplier can access",
          "allowedTemplates": "string[] (optional) - Template IDs supplier can use",
          "rateLimit": "number (optional) - Requests per hour (default: 1000)"
        }
      },
      {
        "method": "GET",
        "path": "/admin/suppliers/{supplierId}",
        "description": "Get supplier details"
      },
      {
        "method": "PATCH",
        "path": "/admin/suppliers/{supplierId}",
        "description": "Update supplier settings",
        "body": {
          "supplierName": "string (optional)",
          "allowedTags": "string[] (optional)",
          "allowedTemplates": "string[] (optional)",
          "rateLimit": "number (optional)",
          "enabled": "boolean (optional)"
        }
      },
      {
        "method": "POST",
        "path": "/admin/suppliers/{supplierId}/rotate-key",
        "description": "Rotate the API key for a supplier (returns new key once)"
      }
    ]
  },
  "authentication": {
    "supplier": {
      "header": "X-Api-Key",
      "queryParam": "api_key",
      "format": "sk_live_<64hex> or sk_test_<64hex>"
    },
    "admin": {
      "header": "X-Admin-Key",
      "queryParam": "api_key",
      "description": "Admin key from Secrets Manager"
    }
  }
}