{
  "openapi": "3.1.0",
  "info": {
    "title": "SupplyFi API",
    "version": "1.0.0",
    "summary": "Read approved product data and manage media and webhooks.",
    "description": "The SupplyFi REST API gives your systems read access to approved product data (families, variants, bills of materials, catalogue snapshots, product types), lets you manage media assets, and lets you register webhooks. Authenticate with a bearer API key created in SupplyFi under Admin > Integrations & AI > API keys & webhooks. API access is included on paid plans. The API is for server-to-server use: it sends no CORS headers by default, so call it from your back end and never put a key in browser code. Every response from the operations below has an X-Request-Id header, and every error is { error: { code, message, requestId } }. Lists take limit (1 to 200) and offset (0 to 1,000,000). Ids in paths are UUIDs; anything else is a 404.",
    "contact": {
      "name": "SupplyFi",
      "email": "hello@supplyfi.co.uk"
    }
  },
  "externalDocs": {
    "description": "Developer guide",
    "url": "https://www.supplyfi.co.uk/developers"
  },
  "servers": [
    {
      "url": "https://app.supplyfi.co.uk/api/v1"
    }
  ],
  "tags": [
    {
      "name": "Families"
    },
    {
      "name": "Bill of materials"
    },
    {
      "name": "Catalogue"
    },
    {
      "name": "Product types"
    },
    {
      "name": "Usage"
    },
    {
      "name": "Assets"
    },
    {
      "name": "Webhooks"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/families": {
      "get": {
        "operationId": "listFamilies",
        "tags": [
          "Families"
        ],
        "summary": "List your product families.",
        "description": "Families are groups of variants (SKUs) that share a product type. Filter by status or product type.",
        "security": [
          {
            "bearerAuth": [
              "families:read"
            ]
          }
        ],
        "x-required-scope": "families:read",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "Only families with this status.",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "sent_to_supplier",
                "submitted",
                "completed"
              ]
            }
          },
          {
            "name": "productType",
            "in": "query",
            "description": "Only families of this product type, matched by name, ignoring case.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size, 1 to 200. Default 50. A value outside the range is clamped; an unreadable one uses the default.",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "How many items to skip, 0 to 1,000,000. Default 0. A value outside the range is clamped.",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0,
              "maximum": 1000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of families.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FamilySummary"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ListMeta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "data": [
                    {
                      "id": "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11",
                      "name": "Example cordless garden trimmer",
                      "productType": "Garden power tool",
                      "productTypeId": "0e1d2c3b-4a59-4687-b7a6-958473625140",
                      "supplier": "Example Ceramics Ltd",
                      "status": "completed",
                      "variantCount": 3,
                      "fieldCount": 24,
                      "createdAt": "2026-03-02T09:30:00.000Z"
                    }
                  ],
                  "meta": {
                    "total": 1,
                    "limit": 50,
                    "offset": 0,
                    "returned": 1
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/families/{familyId}": {
      "get": {
        "operationId": "getFamily",
        "tags": [
          "Families"
        ],
        "summary": "Get one family with its field schema.",
        "security": [
          {
            "bearerAuth": [
              "families:read"
            ]
          }
        ],
        "x-required-scope": "families:read",
        "parameters": [
          {
            "name": "familyId",
            "in": "path",
            "description": "The product family's id (a UUID). An id that is not a UUID returns 404.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The family, with the fields its product type defines.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Family"
                },
                "example": {
                  "id": "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11",
                  "name": "Example cordless garden trimmer",
                  "productType": "Garden power tool",
                  "productTypeId": "0e1d2c3b-4a59-4687-b7a6-958473625140",
                  "supplier": "Example Ceramics Ltd",
                  "status": "completed",
                  "variantCount": 3,
                  "createdAt": "2026-03-02T09:30:00.000Z",
                  "schema": [
                    {
                      "key": "width_mm",
                      "label": "Width (mm)",
                      "section": "Dimensions",
                      "type": "Number",
                      "required": true,
                      "system": false,
                      "options": null
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Family not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Family not found",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/families/{familyId}/variants": {
      "get": {
        "operationId": "listFamilyVariants",
        "tags": [
          "Families"
        ],
        "summary": "List a family's variants (SKUs) with their latest approved data.",
        "security": [
          {
            "bearerAuth": [
              "families:read"
            ]
          }
        ],
        "x-required-scope": "families:read",
        "parameters": [
          {
            "name": "familyId",
            "in": "path",
            "description": "The product family's id (a UUID). An id that is not a UUID returns 404.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The family's variants.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VariantList"
                },
                "example": {
                  "familyId": "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11",
                  "familyName": "Example cordless garden trimmer",
                  "productType": "Garden power tool",
                  "data": [
                    {
                      "id": "4c8a1d2e-7b3f-4a90-9e65-0d1f2a3b4c5d",
                      "sku": "EX-1001-600",
                      "name": "Example cordless garden trimmer 600 mm",
                      "completeness": 100,
                      "lastEditedAt": "2026-04-11T14:05:00.000Z",
                      "approvedData": {
                        "width_mm": "600",
                        "finish": "Matt white"
                      }
                    }
                  ],
                  "meta": {
                    "total": 1
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Family not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Family not found",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/families/{familyId}/bom": {
      "get": {
        "operationId": "getFamilyBom",
        "tags": [
          "Bill of materials"
        ],
        "summary": "Get the parts and spares that make up each variant in a family.",
        "description": "Returns only variants that have a bill of materials. By default each variant lists its direct components. With explode=true each variant instead lists every part in the assembly tree with the total quantity needed.",
        "security": [
          {
            "bearerAuth": [
              "families:read"
            ]
          }
        ],
        "x-required-scope": "families:read",
        "parameters": [
          {
            "name": "familyId",
            "in": "path",
            "description": "The product family's id (a UUID). An id that is not a UUID returns 404.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "explode",
            "in": "query",
            "description": "Send true for the fully exploded, multi-level parts list. Any other value gives the direct components.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bill of materials by variant.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Bom"
                },
                "example": {
                  "familyId": "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11",
                  "familyName": "Example floor lamp",
                  "variants": [
                    {
                      "variantId": "4c8a1d2e-7b3f-4a90-9e65-0d1f2a3b4c5d",
                      "sku": "EX-2001-CH",
                      "name": "Example floor lamp black",
                      "components": [
                        {
                          "sku": "EX-S-0042",
                          "name": "Example cartridge",
                          "family": "Example spares",
                          "quantity": "1",
                          "unit": "each",
                          "role": "component",
                          "position": null,
                          "notes": null,
                          "isSpare": true,
                          "isOrderable": true
                        }
                      ]
                    }
                  ],
                  "meta": {
                    "variantsWithBom": 1,
                    "totalVariants": 3
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Family not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Family not found",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/variants/{variantId}/where-used": {
      "get": {
        "operationId": "getVariantWhereUsed",
        "tags": [
          "Bill of materials"
        ],
        "summary": "Find every product that uses a given component or spare.",
        "description": "The reverse bill of materials: the direct parents of one variant.",
        "security": [
          {
            "bearerAuth": [
              "families:read"
            ]
          }
        ],
        "x-required-scope": "families:read",
        "parameters": [
          {
            "name": "variantId",
            "in": "path",
            "description": "The variant's id (a UUID), typically a spare. An id that is not a UUID returns 404.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The variant and the products that use it.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WhereUsed"
                },
                "example": {
                  "variant": {
                    "id": "4c8a1d2e-7b3f-4a90-9e65-0d1f2a3b4c5d",
                    "sku": "EX-S-0042",
                    "name": "Example cartridge",
                    "family": "Example spares",
                    "isSpare": true,
                    "isOrderable": true
                  },
                  "usedIn": [
                    {
                      "variantId": "6d5c4b3a-2f1e-4d0c-9b8a-7f6e5d4c3b2a",
                      "sku": "EX-2001-CH",
                      "name": "Example floor lamp black",
                      "family": "Example floor lamp"
                    }
                  ],
                  "meta": {
                    "total": 1
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Variant not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Variant not found",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/catalog": {
      "get": {
        "operationId": "listCatalog",
        "tags": [
          "Catalogue"
        ],
        "summary": "List approved product snapshots.",
        "description": "A snapshot is a version-locked record of a family's data at the moment it was approved. This is the endpoint to sync approved data into another system.",
        "security": [
          {
            "bearerAuth": [
              "catalog:read"
            ]
          }
        ],
        "x-required-scope": "catalog:read",
        "parameters": [
          {
            "name": "productType",
            "in": "query",
            "description": "Only snapshots of this product type, matched by name, ignoring case.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "since",
            "in": "query",
            "description": "An ISO 8601 date or timestamp. Only snapshots approved on or after it. An unreadable value is ignored.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size, 1 to 200. Default 50. A value outside the range is clamped; an unreadable one uses the default.",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "How many items to skip, 0 to 1,000,000. Default 0. A value outside the range is clamped.",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0,
              "maximum": 1000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of approved snapshots.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CatalogItem"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ListMeta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "data": [
                    {
                      "id": "d1e2f3a4-5b6c-4d7e-8f90-a1b2c3d4e5f6",
                      "familyId": "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11",
                      "familyName": "Example cordless garden trimmer",
                      "productType": "Garden power tool",
                      "supplier": "Example Ceramics Ltd",
                      "approvedAt": "2026-04-12T08:00:00.000Z",
                      "variantCount": 1,
                      "skus": [
                        "EX-1001-600"
                      ],
                      "variants": [
                        {
                          "id": "4c8a1d2e-7b3f-4a90-9e65-0d1f2a3b4c5d",
                          "sku": "EX-1001-600",
                          "name": "Example cordless garden trimmer 600 mm"
                        }
                      ],
                      "fieldCount": 24
                    }
                  ],
                  "meta": {
                    "total": 1,
                    "limit": 50,
                    "offset": 0,
                    "returned": 1
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/catalog/{snapshotId}": {
      "get": {
        "operationId": "getCatalogSnapshot",
        "tags": [
          "Catalogue"
        ],
        "summary": "Get one approved snapshot with its full field data.",
        "security": [
          {
            "bearerAuth": [
              "catalog:read"
            ]
          }
        ],
        "x-required-scope": "catalog:read",
        "parameters": [
          {
            "name": "snapshotId",
            "in": "path",
            "description": "The snapshot's id (a UUID; the id field from GET /catalog). An id that is not a UUID returns 404.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The snapshot with schema, values and a flattened field list.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogSnapshot"
                },
                "example": {
                  "id": "d1e2f3a4-5b6c-4d7e-8f90-a1b2c3d4e5f6",
                  "familyId": "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11",
                  "familyName": "Example cordless garden trimmer",
                  "productType": "Garden power tool",
                  "supplier": "Example Ceramics Ltd",
                  "approvedAt": "2026-04-12T08:00:00.000Z",
                  "variants": [
                    {
                      "id": "4c8a1d2e-7b3f-4a90-9e65-0d1f2a3b4c5d",
                      "sku": "EX-1001-600",
                      "name": "Example cordless garden trimmer 600 mm"
                    }
                  ],
                  "schema": [
                    {
                      "key": "width_mm",
                      "label": "Width (mm)",
                      "section": "Dimensions",
                      "type": "Number",
                      "required": true,
                      "options": null
                    }
                  ],
                  "carbonFootprint": null,
                  "data": {
                    "width_mm": "600"
                  },
                  "fields": [
                    {
                      "key": "width_mm",
                      "label": "Width (mm)",
                      "value": "600"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Snapshot not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Snapshot not found",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/product-types": {
      "get": {
        "operationId": "listProductTypes",
        "tags": [
          "Product types"
        ],
        "summary": "List your product types and the fields each one defines.",
        "security": [
          {
            "bearerAuth": [
              "schemas:read"
            ]
          }
        ],
        "x-required-scope": "schemas:read",
        "responses": {
          "200": {
            "description": "All product types.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ProductType"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "total"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "data": [
                    {
                      "id": "0e1d2c3b-4a59-4687-b7a6-958473625140",
                      "name": "Garden power tool",
                      "description": "Cordless garden tools",
                      "icon": null,
                      "familyCount": 4,
                      "createdAt": "2026-02-01T10:00:00.000Z",
                      "fields": [
                        {
                          "key": "width_mm",
                          "label": "Width (mm)",
                          "section": "Dimensions",
                          "type": "Number",
                          "required": true,
                          "system": false,
                          "options": null
                        }
                      ]
                    }
                  ],
                  "meta": {
                    "total": 1
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/usage": {
      "get": {
        "operationId": "getUsage",
        "tags": [
          "Usage"
        ],
        "summary": "See how many API calls you have used this month.",
        "description": "Works with any valid key except an MCP-only one, and does not count against the quota. The same figures come back on quota 429 responses as X-Quota-* headers.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-required-scope": "any valid key",
        "responses": {
          "200": {
            "description": "This month's usage against the quota.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                },
                "example": {
                  "period": "2026-10",
                  "limit": 50000,
                  "used": 1280,
                  "remaining": 48720,
                  "resetAt": "2026-11-01T00:00:00.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/assets": {
      "get": {
        "operationId": "listAssets",
        "tags": [
          "Assets"
        ],
        "summary": "List media assets (images, drawings, manuals) with filters.",
        "security": [
          {
            "bearerAuth": [
              "assets:read"
            ]
          }
        ],
        "x-required-scope": "assets:read",
        "parameters": [
          {
            "name": "role",
            "in": "query",
            "description": "Only assets with this role. An unknown value is ignored.",
            "schema": {
              "type": "string",
              "enum": [
                "hero",
                "drawing",
                "manual",
                "compliance",
                "lifestyle",
                "other"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Only assets with this approval status. Anything else is a 400.",
            "schema": {
              "type": "string",
              "enum": [
                "approved",
                "pending",
                "missing"
              ]
            }
          },
          {
            "name": "familyId",
            "in": "query",
            "description": "Only assets of this origin family (a UUID; anything else is a 400).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "productType",
            "in": "query",
            "description": "A product type id (a UUID; anything else is a 400): only assets of its families.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "description": "A single tag to match.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Search the name and alt text.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size, 1 to 200. Default 50. A value outside the range is clamped; an unreadable one uses the default.",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "How many items to skip, 0 to 1,000,000. Default 0. A value outside the range is clamped.",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0,
              "maximum": 1000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of assets.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Asset"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ListMeta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "data": [
                    {
                      "id": "7a6b5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d",
                      "name": "ex-1001-main",
                      "kind": "image",
                      "role": "hero",
                      "status": "approved",
                      "url": "https://files.example.com/media/ex-1001-main.jpg",
                      "altText": "Cordless garden trimmer, front view",
                      "tags": [
                        "trimmer"
                      ],
                      "width": 2400,
                      "height": 2400,
                      "mimeType": "image/jpeg",
                      "bytes": 512340,
                      "familyId": "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11",
                      "renditions": {
                        "thumb": "https://files.example.com/media/ex-1001-main-thumb.webp"
                      },
                      "uploadedAt": "12 Apr 2026"
                    }
                  ],
                  "meta": {
                    "total": 1,
                    "limit": 50,
                    "offset": 0,
                    "returned": 1
                  }
                }
              }
            }
          },
          "400": {
            "description": "status is not one of approved, pending, missing; or familyId or productType is not a UUID.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_request",
                    "message": "Invalid status. One of: approved, pending, missing",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "createAsset",
        "tags": [
          "Assets"
        ],
        "summary": "Add an image to a family, from a URL or as base64.",
        "description": "SupplyFi checks the family first: it must be a UUID of a family in your workspace, or the call fails before anything is fetched or stored. A URL must be HTTPS and publicly reachable. The file must be a supported media type, its first bytes must match the declared type, it must be within the size limit and the workspace must have storage left. Assets created with an API key are approved straight away.",
        "security": [
          {
            "bearerAuth": [
              "assets:write"
            ]
          }
        ],
        "x-required-scope": "assets:write",
        "requestBody": {
          "description": "Send a url, or dataBase64 together with mimeType.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssetCreate"
              },
              "example": {
                "familyId": "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11",
                "url": "https://files.example.com/photos/ex-1001-detail.jpg",
                "role": "lifestyle",
                "altText": "Trimmer detail",
                "tags": [
                  "trimmer",
                  "detail"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new asset.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Asset"
                },
                "example": {
                  "id": "7a6b5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d",
                  "name": "ex-1001-detail",
                  "kind": "image",
                  "role": "lifestyle",
                  "status": "approved",
                  "url": "https://files.example.com/media/ex-1001-detail.jpg",
                  "altText": "Trimmer detail",
                  "tags": [
                    "trimmer",
                    "detail"
                  ],
                  "width": 1600,
                  "height": 1200,
                  "mimeType": "image/jpeg",
                  "bytes": 301122,
                  "familyId": "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11",
                  "renditions": {},
                  "uploadedAt": "24 Oct 2026"
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid JSON. Or: familyId is missing or not a UUID; the url is not a valid public HTTPS address or could not be fetched; or neither url nor dataBase64 with mimeType was sent.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_request",
                    "message": "Invalid JSON body",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Family not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Family not found",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "413": {
            "description": "The file is too large, or the workspace is out of storage.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "payload_too_large",
                    "message": "File too large",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "415": {
            "description": "The media type is not supported, or the file's content does not match its declared type.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unsupported_media_type",
                    "message": "File content does not match its declared media type",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/assets/{assetId}": {
      "get": {
        "operationId": "getAsset",
        "tags": [
          "Assets"
        ],
        "summary": "Get one asset, its renditions and the families it is attached to.",
        "security": [
          {
            "bearerAuth": [
              "assets:read"
            ]
          }
        ],
        "x-required-scope": "assets:read",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "description": "The asset's id (a UUID). An id that is not a UUID returns 404.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The asset, with linkedFamilyIds.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Asset"
                },
                "example": {
                  "id": "7a6b5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d",
                  "name": "ex-1001-main",
                  "kind": "image",
                  "role": "hero",
                  "status": "approved",
                  "url": "https://files.example.com/media/ex-1001-main.jpg",
                  "altText": null,
                  "tags": [],
                  "width": 2400,
                  "height": 2400,
                  "mimeType": "image/jpeg",
                  "bytes": 512340,
                  "familyId": "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11",
                  "renditions": {},
                  "uploadedAt": "12 Apr 2026",
                  "linkedFamilyIds": [
                    "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Asset not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Asset not found",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "operationId": "updateAsset",
        "tags": [
          "Assets"
        ],
        "summary": "Change an asset's role, alt text or tags.",
        "description": "Send only the fields you want to change.",
        "security": [
          {
            "bearerAuth": [
              "assets:write"
            ]
          }
        ],
        "x-required-scope": "assets:write",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "description": "The asset's id (a UUID). An id that is not a UUID returns 404.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Any of role, altText, tags.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssetUpdate"
              },
              "example": {
                "role": "drawing",
                "altText": "Dimensioned drawing",
                "tags": [
                  "drawing"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated asset.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Asset"
                },
                "example": {
                  "id": "7a6b5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d",
                  "name": "ex-1001-drawing",
                  "kind": "image",
                  "role": "drawing",
                  "status": "approved",
                  "url": "https://files.example.com/media/ex-1001-drawing.png",
                  "altText": "Dimensioned drawing",
                  "tags": [
                    "drawing"
                  ],
                  "width": 1800,
                  "height": 1200,
                  "mimeType": "image/png",
                  "bytes": 220010,
                  "familyId": "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11",
                  "renditions": {},
                  "uploadedAt": "12 Apr 2026"
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid JSON. Or: The role is not one of the allowed values.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_request",
                    "message": "Invalid JSON body",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Asset not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Asset not found",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "operationId": "deleteAsset",
        "tags": [
          "Assets"
        ],
        "summary": "Delete an asset, with its renditions and links.",
        "security": [
          {
            "bearerAuth": [
              "assets:write"
            ]
          }
        ],
        "x-required-scope": "assets:write",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "description": "The asset's id (a UUID). An id that is not a UUID returns 404.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "deleted",
                    "id"
                  ]
                },
                "example": {
                  "deleted": true,
                  "id": "7a6b5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Asset not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Asset not found",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/assets/{assetId}/links": {
      "get": {
        "operationId": "listAssetLinks",
        "tags": [
          "Assets"
        ],
        "summary": "List the families an asset is attached to.",
        "security": [
          {
            "bearerAuth": [
              "assets:read"
            ]
          }
        ],
        "x-required-scope": "assets:read",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "description": "The asset's id (a UUID). An id that is not a UUID returns 404.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The asset's links.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AssetLink"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "total"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "data": [
                    {
                      "familyId": "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11",
                      "isPrimary": true,
                      "sortOrder": 0
                    }
                  ],
                  "meta": {
                    "total": 1
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Asset not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Asset not found",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "attachAsset",
        "tags": [
          "Assets"
        ],
        "summary": "Attach an asset to one or more families.",
        "description": "Send one familyId, or up to 100 in familyIds (duplicates are ignored). Ids that are not UUIDs or not found are listed in failed. If none could be attached the call fails with 422.",
        "security": [
          {
            "bearerAuth": [
              "assets:write"
            ]
          }
        ],
        "x-required-scope": "assets:write",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "description": "The asset's id (a UUID). An id that is not a UUID returns 404.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "familyId, or familyIds for several.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssetLinkCreate"
              },
              "example": {
                "familyIds": [
                  "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11"
                ],
                "isPrimary": false,
                "sortOrder": 2
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Which families were linked and which were not.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "assetId": {
                      "type": "string"
                    },
                    "linked": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "failed": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "assetId",
                    "linked",
                    "failed"
                  ]
                },
                "example": {
                  "assetId": "7a6b5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d",
                  "linked": [
                    "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11"
                  ],
                  "failed": []
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid JSON. Or: Neither familyId nor familyIds was sent, or familyIds holds more than 100 ids.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_request",
                    "message": "Invalid JSON body",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Asset not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Asset not found",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "422": {
            "description": "None of the families could be found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unprocessable",
                    "message": "No valid families to attach. Unknown family ids: abc",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "operationId": "detachAsset",
        "tags": [
          "Assets"
        ],
        "summary": "Detach an asset from a family.",
        "security": [
          {
            "bearerAuth": [
              "assets:write"
            ]
          }
        ],
        "x-required-scope": "assets:write",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "description": "The asset's id (a UUID). An id that is not a UUID returns 404.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "familyId",
            "in": "query",
            "description": "The family to detach from.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Detached.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detached": {
                      "type": "boolean"
                    },
                    "assetId": {
                      "type": "string"
                    },
                    "familyId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "detached",
                    "assetId",
                    "familyId"
                  ]
                },
                "example": {
                  "detached": true,
                  "assetId": "7a6b5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d",
                  "familyId": "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11"
                }
              }
            }
          },
          "400": {
            "description": "The familyId query parameter is missing.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_request",
                    "message": "familyId query param is required",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Link not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Link not found",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "tags": [
          "Webhooks"
        ],
        "summary": "List the webhooks registered for your workspace.",
        "description": "Needs the webhooks:write scope, because a webhook URL can carry a token (there is no read-only webhook scope). Secrets are never returned.",
        "security": [
          {
            "bearerAuth": [
              "webhooks:write"
            ]
          }
        ],
        "x-required-scope": "webhooks:write",
        "responses": {
          "200": {
            "description": "Registered webhooks.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Webhook"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "total"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "data": [
                    {
                      "id": "5f4e3d2c-1b0a-4f9e-8d7c-6b5a49382716",
                      "url": "https://hooks.example.com/supplyfi",
                      "events": [
                        "snapshot.approved"
                      ],
                      "active": true,
                      "failCount": 0,
                      "lastFiredAt": "2026-10-20T11:15:00.000Z",
                      "createdAt": "2026-09-01T09:00:00.000Z"
                    }
                  ],
                  "meta": {
                    "total": 1
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "createWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Register a URL to be called when something happens.",
        "description": "The URL must be HTTPS and reachable from the public internet. The signing secret is returned once. A workspace can have 20 webhooks, and registration is limited to 30 a minute per key. Four event names are accepted; today SupplyFi sends snapshot.approved only.",
        "security": [
          {
            "bearerAuth": [
              "webhooks:write"
            ]
          }
        ],
        "x-required-scope": "webhooks:write",
        "requestBody": {
          "description": "The URL and the events to subscribe to.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookCreate"
              },
              "example": {
                "url": "https://hooks.example.com/supplyfi",
                "events": [
                  "snapshot.approved"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The webhook, with its signing secret (shown once).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookCreated"
                },
                "example": {
                  "id": "5f4e3d2c-1b0a-4f9e-8d7c-6b5a49382716",
                  "url": "https://hooks.example.com/supplyfi",
                  "events": [
                    "snapshot.approved"
                  ],
                  "active": true,
                  "createdAt": "2026-10-24T10:00:00.000Z",
                  "secret": "whsec_<64 hex characters>",
                  "_note": "Save the secret now — it will not be shown again. Verify incoming deliveries using X-SupplyFi-Signature (HMAC-SHA256)."
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid JSON. Or: The url is missing, not a valid HTTPS address, or not publicly reachable; or events is empty or has an unknown name.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_request",
                    "message": "Invalid JSON body",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "description": "The workspace already has 20 webhooks. Delete one first.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "webhook_limit_reached",
                    "message": "Webhook limit reached (20 per workspace). Delete one before registering another.",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/webhooks/{webhookId}": {
      "patch": {
        "operationId": "updateWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Pause a webhook, or switch it back on after SupplyFi turned it off.",
        "description": "SupplyFi switches a webhook off after repeated failed deliveries. Send active true to re-enable it (this resets its failure count), or false to pause it.",
        "security": [
          {
            "bearerAuth": [
              "webhooks:write"
            ]
          }
        ],
        "x-required-scope": "webhooks:write",
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "description": "The webhook's id (a UUID). An id that is not a UUID returns 404.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Only active is accepted, and it must be a boolean.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookUpdate"
              },
              "example": {
                "active": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated webhook.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                },
                "example": {
                  "id": "5f4e3d2c-1b0a-4f9e-8d7c-6b5a49382716",
                  "url": "https://hooks.example.com/supplyfi",
                  "events": [
                    "snapshot.approved"
                  ],
                  "active": true,
                  "failCount": 0,
                  "lastFiredAt": "2026-10-20T11:15:00.000Z",
                  "createdAt": "2026-09-01T09:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid JSON. Or: The body is not an object with a boolean active.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_request",
                    "message": "Invalid JSON body",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Webhook not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Webhook not found",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "operationId": "deleteWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Remove a webhook.",
        "security": [
          {
            "bearerAuth": [
              "webhooks:write"
            ]
          }
        ],
        "x-required-scope": "webhooks:write",
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "description": "The webhook's id (a UUID). An id that is not a UUID returns 404.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Removed.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "deleted",
                    "id"
                  ]
                },
                "example": {
                  "deleted": true,
                  "id": "5f4e3d2c-1b0a-4f9e-8d7c-6b5a49382716"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Webhook not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Webhook not found",
                    "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
                  }
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    }
  },
  "webhooks": {
    "snapshot.approved": {
      "post": {
        "operationId": "receiveSnapshotApproved",
        "summary": "SupplyFi calls your URL when a product snapshot is approved.",
        "description": "Sent as a POST with a JSON body. Headers: X-SupplyFi-Event (the event name), X-SupplyFi-Signature (sha256=<hex>, an HMAC-SHA256 of the raw body made with your webhook secret) and X-SupplyFi-Delivery. Answer with any 2xx status. Today this is the only event SupplyFi sends.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookDelivery"
              },
              "example": {
                "event": "snapshot.approved",
                "timestamp": "2026-10-24T10:05:00.000Z",
                "snapshotId": "d1e2f3a4-5b6c-4d7e-8f90-a1b2c3d4e5f6",
                "familyId": "9b2f6c1e-3d4a-4e57-8a10-5c7d2f0e1a11",
                "familyName": "Example cordless garden trimmer",
                "productType": "Garden power tool",
                "supplier": "Example Ceramics Ltd",
                "approvedAt": "2026-10-24T10:05:00.000Z",
                "variantCount": 1,
                "skus": [
                  "EX-1001-600"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received."
          }
        }
      }
    }
  },
  "components": {
    "headers": {
      "XRequestId": {
        "description": "The id of this request. It is also in error.requestId on errors. Quote it when you contact support.",
        "schema": {
          "type": "string"
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "A SupplyFi API key, sent as Authorization: Bearer <key>. Keys start spk_live_. Each key has scopes; the scope an operation needs is in its security entry."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "insufficient_scope",
                  "feature_locked",
                  "workspace_locked",
                  "workspace_suspended",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "webhook_limit_reached",
                  "deletion_pending",
                  "payload_too_large",
                  "unsupported_media_type",
                  "unprocessable",
                  "rate_limited",
                  "quota_exceeded",
                  "internal_error"
                ],
                "description": "A stable machine-readable code. Branch on this, not on the message."
              },
              "message": {
                "type": "string",
                "description": "A readable message."
              },
              "requestId": {
                "type": "string",
                "description": "The id of this request, also in the X-Request-Id header. Quote it when you contact support."
              }
            },
            "required": [
              "code",
              "message",
              "requestId"
            ]
          },
          "details": {
            "description": "Extra detail, on a few errors."
          }
        },
        "required": [
          "error"
        ]
      },
      "QuotaExceeded": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "quota_exceeded"
                ]
              },
              "message": {
                "type": "string"
              },
              "requestId": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message",
              "requestId"
            ]
          },
          "quota": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer"
              },
              "used": {
                "type": "integer"
              },
              "remaining": {
                "type": "integer"
              },
              "period": {
                "type": "string",
                "description": "Calendar month, YYYY-MM (UTC)."
              },
              "resetAt": {
                "type": "string",
                "description": "When the quota resets (ISO 8601)."
              }
            },
            "required": [
              "limit",
              "used",
              "remaining",
              "period",
              "resetAt"
            ]
          }
        },
        "required": [
          "error",
          "quota"
        ]
      },
      "ListMeta": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "description": "Matches before paging."
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "returned": {
            "type": "integer",
            "description": "Items in this page."
          }
        },
        "required": [
          "total",
          "limit",
          "offset",
          "returned"
        ]
      },
      "FieldSchema": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "section": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "Text",
              "Number",
              "YesNo",
              "Choice",
              "Date"
            ],
            "description": "The field's control type."
          },
          "required": {
            "type": "boolean"
          },
          "system": {
            "type": "boolean",
            "description": "True for built-in fields."
          },
          "options": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Allowed values for a Choice field, otherwise null."
          }
        },
        "required": [
          "key",
          "label",
          "section",
          "type",
          "required",
          "options"
        ]
      },
      "FamilySummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "productType": {
            "type": "string",
            "description": "Product type name."
          },
          "productTypeId": {
            "type": "string"
          },
          "supplier": {
            "type": [
              "string",
              "null"
            ],
            "description": "Supplier name (the supplier's internal id is not exposed)."
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "sent_to_supplier",
              "submitted",
              "completed"
            ]
          },
          "variantCount": {
            "type": "integer",
            "description": "Active SKUs."
          },
          "fieldCount": {
            "type": "integer"
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601."
          }
        },
        "required": [
          "id",
          "name",
          "productType",
          "productTypeId",
          "supplier",
          "status",
          "variantCount",
          "fieldCount",
          "createdAt"
        ]
      },
      "Family": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "productType": {
            "type": "string"
          },
          "productTypeId": {
            "type": "string"
          },
          "supplier": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "sent_to_supplier",
              "submitted",
              "completed"
            ]
          },
          "variantCount": {
            "type": "integer"
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601."
          },
          "schema": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FieldSchema"
            }
          }
        },
        "required": [
          "id",
          "name",
          "productType",
          "productTypeId",
          "supplier",
          "status",
          "variantCount",
          "createdAt",
          "schema"
        ]
      },
      "VariantItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "completeness": {
            "type": [
              "number",
              "null"
            ],
            "description": "How complete the variant's data is, when known."
          },
          "lastEditedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "approvedData": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "Field values of the family's latest approved snapshot, keyed by field key; null if none is approved. The same object is returned for every variant of the family."
          }
        },
        "required": [
          "id",
          "sku",
          "name",
          "completeness",
          "lastEditedAt",
          "approvedData"
        ]
      },
      "VariantList": {
        "type": "object",
        "properties": {
          "familyId": {
            "type": "string"
          },
          "familyName": {
            "type": "string"
          },
          "productType": {
            "type": "string"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VariantItem"
            }
          },
          "meta": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              }
            },
            "required": [
              "total"
            ]
          }
        },
        "required": [
          "familyId",
          "familyName",
          "productType",
          "data",
          "meta"
        ]
      },
      "BomComponent": {
        "type": "object",
        "properties": {
          "sku": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "family": {
            "type": "string",
            "description": "The family the component belongs to."
          },
          "quantity": {
            "type": "string",
            "description": "Quantity per parent, as a numeric string."
          },
          "unit": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "position": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "isSpare": {
            "type": "boolean"
          },
          "isOrderable": {
            "type": "boolean"
          }
        },
        "required": [
          "sku",
          "name",
          "family",
          "quantity",
          "unit",
          "role",
          "position",
          "notes",
          "isSpare",
          "isOrderable"
        ]
      },
      "BomVariant": {
        "type": "object",
        "properties": {
          "variantId": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "components": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BomComponent"
            }
          }
        },
        "required": [
          "variantId",
          "sku",
          "name",
          "components"
        ]
      },
      "ExplodedPart": {
        "type": "object",
        "properties": {
          "sku": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "family": {
            "type": "string"
          },
          "totalQuantity": {
            "type": "number",
            "description": "Total needed across the whole assembly tree."
          },
          "depth": {
            "type": "integer",
            "description": "Shallowest depth from the variant (1 is a direct component)."
          },
          "isSpare": {
            "type": "boolean"
          },
          "isOrderable": {
            "type": "boolean"
          }
        },
        "required": [
          "sku",
          "name",
          "family",
          "totalQuantity",
          "depth",
          "isSpare",
          "isOrderable"
        ]
      },
      "ExplodedBomVariant": {
        "type": "object",
        "properties": {
          "variantId": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "parts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExplodedPart"
            }
          }
        },
        "required": [
          "variantId",
          "sku",
          "name",
          "parts"
        ]
      },
      "Bom": {
        "type": "object",
        "properties": {
          "familyId": {
            "type": "string"
          },
          "familyName": {
            "type": "string"
          },
          "exploded": {
            "const": true,
            "description": "Only present with explode=true."
          },
          "variants": {
            "type": "array",
            "description": "Only variants that have a bill of materials. Items are BomVariant, or ExplodedBomVariant with explode=true.",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/BomVariant"
                },
                {
                  "$ref": "#/components/schemas/ExplodedBomVariant"
                }
              ]
            }
          },
          "meta": {
            "type": "object",
            "properties": {
              "variantsWithBom": {
                "type": "integer"
              },
              "totalVariants": {
                "type": "integer"
              }
            },
            "required": [
              "variantsWithBom",
              "totalVariants"
            ]
          }
        },
        "required": [
          "familyId",
          "familyName",
          "variants",
          "meta"
        ]
      },
      "WhereUsed": {
        "type": "object",
        "properties": {
          "variant": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "sku": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "family": {
                "type": "string"
              },
              "isSpare": {
                "type": "boolean"
              },
              "isOrderable": {
                "type": "boolean"
              }
            },
            "required": [
              "id",
              "sku",
              "name",
              "family",
              "isSpare",
              "isOrderable"
            ]
          },
          "usedIn": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "variantId": {
                  "type": "string"
                },
                "sku": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "family": {
                  "type": "string"
                }
              },
              "required": [
                "variantId",
                "sku",
                "name",
                "family"
              ]
            }
          },
          "meta": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              }
            },
            "required": [
              "total"
            ]
          }
        },
        "required": [
          "variant",
          "usedIn",
          "meta"
        ]
      },
      "VariantRef": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "options": {
            "type": "array",
            "description": "The variant's size / colour options, in axis order, e.g. [{ axis: \"Colour\", value: \"Navy\" }, { axis: \"Size\", value: \"M\" }]. Only present for a family that uses options.",
            "items": {
              "type": "object",
              "properties": {
                "axis": {
                  "type": "string",
                  "description": "The option's name, e.g. Colour."
                },
                "value": {
                  "type": "string",
                  "description": "The chosen value, e.g. Navy."
                }
              },
              "required": [
                "axis",
                "value"
              ]
            }
          }
        },
        "required": [
          "id",
          "sku",
          "name"
        ]
      },
      "CatalogItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The snapshot id."
          },
          "familyId": {
            "type": "string"
          },
          "familyName": {
            "type": "string"
          },
          "productType": {
            "type": "string"
          },
          "supplier": {
            "type": [
              "string",
              "null"
            ]
          },
          "approvedAt": {
            "type": "string",
            "description": "ISO 8601."
          },
          "variantCount": {
            "type": "integer"
          },
          "skus": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VariantRef"
            }
          },
          "fieldCount": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "familyId",
          "familyName",
          "productType",
          "supplier",
          "approvedAt",
          "variantCount",
          "skus",
          "variants",
          "fieldCount"
        ]
      },
      "CatalogSnapshot": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The snapshot id."
          },
          "familyId": {
            "type": "string"
          },
          "familyName": {
            "type": "string"
          },
          "productType": {
            "type": "string"
          },
          "supplier": {
            "type": [
              "string",
              "null"
            ]
          },
          "approvedAt": {
            "type": "string",
            "description": "ISO 8601."
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VariantRef"
            }
          },
          "schema": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "section": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "Text",
                    "Number",
                    "YesNo",
                    "Choice",
                    "Date"
                  ]
                },
                "required": {
                  "type": "boolean"
                },
                "options": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "string"
                  },
                  "description": "Allowed values for a Choice field, otherwise null."
                }
              },
              "required": [
                "key",
                "label",
                "section",
                "type",
                "required",
                "options"
              ]
            }
          },
          "carbonFootprint": {
            "description": "The declared carbon footprint (kg CO2e per unit) when the product declares one, otherwise null."
          },
          "data": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Approved field values, keyed by field key."
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "key",
                "label",
                "value"
              ]
            }
          }
        },
        "required": [
          "id",
          "familyId",
          "familyName",
          "productType",
          "supplier",
          "approvedAt",
          "variants",
          "schema",
          "carbonFootprint",
          "data",
          "fields"
        ]
      },
      "ProductType": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "icon": {
            "type": [
              "string",
              "null"
            ]
          },
          "familyCount": {
            "type": "integer"
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601."
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FieldSchema"
            }
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "icon",
          "familyCount",
          "createdAt",
          "fields"
        ]
      },
      "Usage": {
        "type": "object",
        "properties": {
          "period": {
            "type": "string",
            "description": "Calendar month, YYYY-MM (UTC)."
          },
          "limit": {
            "type": "integer",
            "description": "Calls included this month."
          },
          "used": {
            "type": "integer"
          },
          "remaining": {
            "type": "integer"
          },
          "resetAt": {
            "type": "string",
            "description": "ISO 8601."
          }
        },
        "required": [
          "period",
          "limit",
          "used",
          "remaining",
          "resetAt"
        ]
      },
      "Asset": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "render"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "hero",
              "drawing",
              "manual",
              "compliance",
              "lifestyle",
              "other"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "approved",
              "pending",
              "missing"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The original file."
          },
          "altText": {
            "type": [
              "string",
              "null"
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "width": {
            "type": [
              "integer",
              "null"
            ]
          },
          "height": {
            "type": [
              "integer",
              "null"
            ]
          },
          "mimeType": {
            "type": [
              "string",
              "null"
            ]
          },
          "bytes": {
            "type": [
              "integer",
              "null"
            ]
          },
          "familyId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The origin family."
          },
          "renditions": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Generated sizes keyed thumb, web, square or print, once they exist. Images are processed shortly after upload."
          },
          "uploadedAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "A display date as stored, for example 24 Oct 2026."
          },
          "linkedFamilyIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Only on GET /assets/{assetId}."
          }
        },
        "required": [
          "id",
          "name",
          "kind",
          "role",
          "status",
          "altText",
          "tags",
          "width",
          "height",
          "mimeType",
          "bytes",
          "familyId",
          "renditions",
          "uploadedAt"
        ]
      },
      "AssetCreate": {
        "type": "object",
        "properties": {
          "familyId": {
            "type": "string",
            "description": "The family the asset belongs to."
          },
          "url": {
            "type": "string",
            "description": "A public HTTPS URL for SupplyFi to fetch. Send this, or dataBase64 with mimeType."
          },
          "dataBase64": {
            "type": "string",
            "description": "The file, base64-encoded. Send with mimeType."
          },
          "mimeType": {
            "type": "string",
            "description": "For example image/jpeg. Needed with dataBase64."
          },
          "name": {
            "type": "string",
            "description": "Defaults to the file name in the URL."
          },
          "role": {
            "type": "string",
            "enum": [
              "hero",
              "drawing",
              "manual",
              "compliance",
              "lifestyle",
              "other"
            ],
            "description": "Defaults to other."
          },
          "altText": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "familyId"
        ]
      },
      "AssetUpdate": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "hero",
              "drawing",
              "manual",
              "compliance",
              "lifestyle",
              "other"
            ]
          },
          "altText": {
            "type": [
              "string",
              "null"
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": []
      },
      "AssetLink": {
        "type": "object",
        "properties": {
          "familyId": {
            "type": "string"
          },
          "isPrimary": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "familyId",
          "isPrimary",
          "sortOrder"
        ]
      },
      "AssetLinkCreate": {
        "type": "object",
        "properties": {
          "familyId": {
            "type": "string",
            "description": "One family. Send this or familyIds."
          },
          "familyIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "isPrimary": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "integer"
          }
        },
        "required": []
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "snapshot.approved",
                "snapshot.created",
                "family.sent",
                "submission.received"
              ]
            }
          },
          "active": {
            "type": "boolean"
          },
          "failCount": {
            "type": "integer"
          },
          "lastFiredAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601."
          }
        },
        "required": [
          "id",
          "url",
          "events",
          "active",
          "failCount",
          "lastFiredAt",
          "createdAt"
        ]
      },
      "WebhookUpdate": {
        "type": "object",
        "properties": {
          "active": {
            "type": "boolean",
            "description": "true re-enables the webhook and resets its failure count; false pauses it."
          }
        },
        "required": [
          "active"
        ]
      },
      "WebhookCreate": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "HTTPS, and reachable from the public internet."
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": [
                "snapshot.approved",
                "snapshot.created",
                "family.sent",
                "submission.received"
              ]
            }
          }
        },
        "required": [
          "url",
          "events"
        ]
      },
      "WebhookCreated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "snapshot.approved",
                "snapshot.created",
                "family.sent",
                "submission.received"
              ]
            }
          },
          "active": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string"
          },
          "secret": {
            "type": "string",
            "description": "Shown once. Use it to verify X-SupplyFi-Signature."
          },
          "_note": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "url",
          "events",
          "active",
          "createdAt",
          "secret",
          "_note"
        ]
      },
      "WebhookDelivery": {
        "type": "object",
        "properties": {
          "event": {
            "type": "string",
            "description": "Currently always snapshot.approved."
          },
          "timestamp": {
            "type": "string",
            "description": "ISO 8601."
          },
          "snapshotId": {
            "type": "string"
          },
          "familyId": {
            "type": "string"
          },
          "familyName": {
            "type": "string"
          },
          "productType": {
            "type": "string"
          },
          "supplier": {
            "type": [
              "string",
              "null"
            ]
          },
          "approvedAt": {
            "type": "string"
          },
          "variantCount": {
            "type": "integer"
          },
          "skus": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "event",
          "timestamp",
          "snapshotId",
          "familyId",
          "familyName",
          "productType",
          "supplier",
          "approvedAt",
          "variantCount",
          "skus"
        ]
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "No bearer token, or the key is invalid, revoked or expired. Code unauthorized.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "unauthorized",
                "message": "Invalid or revoked API key",
                "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
              }
            }
          }
        }
      },
      "PaymentRequired": {
        "description": "The workspace does not have API access (it is a paid-plan feature), for example after a subscription ends. Code feature_locked. The key is kept.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "feature_locked",
                "message": "API access isn't enabled for this workspace.",
                "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "insufficient_scope: the key lacks the scope this endpoint needs, or it is an MCP-only key (those are refused on every REST endpoint). workspace_locked: the workspace is read-only, which blocks all API calls. workspace_suspended: writes are blocked.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "insufficient_scope",
                "message": "This key does not have the required scope: families:read",
                "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
              }
            }
          }
        }
      },
      "Gone": {
        "description": "The workspace owner has confirmed deletion; the API is unavailable until it is cancelled. Code deletion_pending.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "deletion_pending",
                "message": "This workspace is unavailable.",
                "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
              }
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Code rate_limited: over 60 requests a minute from one IP address, or over 120 a minute on one key (wait for Retry-After seconds). Code quota_exceeded: over the workspace's monthly call allowance (the body also has quota, and X-Quota-* headers).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "Retry-After": {
            "description": "Seconds to wait.",
            "schema": {
              "type": "integer"
            }
          },
          "X-RateLimit-Limit": {
            "description": "The per-key limit. Per-key 429s only.",
            "schema": {
              "type": "integer"
            }
          },
          "X-RateLimit-Remaining": {
            "description": "Requests left in the window. Per-key 429s only.",
            "schema": {
              "type": "integer"
            }
          },
          "X-RateLimit-Reset": {
            "description": "When the window resets, as epoch seconds. Per-key 429s only.",
            "schema": {
              "type": "integer"
            }
          },
          "X-Quota-Limit": {
            "description": "Monthly quota. Quota 429s only.",
            "schema": {
              "type": "integer"
            }
          },
          "X-Quota-Remaining": {
            "description": "Calls left. Quota 429s only.",
            "schema": {
              "type": "integer"
            }
          },
          "X-Quota-Reset": {
            "description": "When it resets (ISO 8601). Quota 429s only.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/QuotaExceeded"
                },
                {
                  "$ref": "#/components/schemas/Error"
                }
              ]
            },
            "example": {
              "error": {
                "code": "quota_exceeded",
                "message": "Monthly API quota exceeded - 50,000 requests/month. Resets 2026-11-01.",
                "requestId": "req_5d1c0a9e7b3f4a2c8e6d1f0b"
              },
              "quota": {
                "limit": 50000,
                "used": 50001,
                "remaining": 0,
                "period": "2026-10",
                "resetAt": "2026-11-01T00:00:00.000Z"
              }
            }
          }
        }
      }
    }
  }
}