{
  "openapi": "3.1.0",
  "info": {
    "title": "Pactrum Public Catalogue API",
    "version": "1.0.0",
    "description": "Read-only catalogue of Pactrum flexible packaging pouches. No authentication. Responses are cached for up to 5 minutes and rate limited per IP (HTTP 429 when exceeded). Prices are per piece in INR before 18% GST.",
    "contact": {
      "name": "Pactrum",
      "email": "info@pactrum.com",
      "url": "https://pactrum.com"
    }
  },
  "servers": [
    {
      "url": "https://pactrum.com"
    }
  ],
  "externalDocs": {
    "url": "https://pactrum.com/developers/"
  },
  "paths": {
    "/api/public/products": {
      "get": {
        "operationId": "searchProducts",
        "summary": "Search or list products",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Free-text search (size, finish, use, SKU)."
          },
          {
            "name": "family",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Category id, e.g. stand-up-pouches."
          },
          {
            "name": "finish",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Finish id or label, e.g. matt-black."
          },
          {
            "name": "inStock",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching products",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "products": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Product"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/products/{id}": {
      "get": {
        "operationId": "getProduct",
        "summary": "Get one product by SKU or slug",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "L001"
          }
        ],
        "responses": {
          "200": {
            "description": "Product",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "product": {
                      "$ref": "#/components/schemas/Product"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/categories": {
      "get": {
        "operationId": "listCategories",
        "summary": "List pouch families",
        "responses": {
          "200": {
            "description": "Categories",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "categories": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Category"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/health": {
      "get": {
        "operationId": "health",
        "summary": "Service status",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "products": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Product": {
        "type": "object",
        "properties": {
          "sku": {
            "type": "string",
            "example": "L001"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "family": {
            "type": "string"
          },
          "familyName": {
            "type": "string"
          },
          "finish": {
            "type": "string"
          },
          "finishLabel": {
            "type": "string"
          },
          "size": {
            "type": [
              "string",
              "null"
            ]
          },
          "widthInches": {
            "type": [
              "number",
              "null"
            ]
          },
          "heightInches": {
            "type": [
              "number",
              "null"
            ]
          },
          "capacityMl": {
            "type": [
              "number",
              "null"
            ]
          },
          "spoutPosition": {
            "type": [
              "string",
              "null"
            ]
          },
          "structureCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "zipper": {
            "type": "boolean"
          },
          "applications": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "description": {
            "type": "string"
          },
          "image": {
            "type": "string",
            "format": "uri"
          },
          "inStock": {
            "type": "boolean"
          },
          "purchase": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "buy-online",
                  "quote-only"
                ]
              },
              "currency": {
                "type": "string",
                "enum": [
                  "INR"
                ]
              },
              "unitPricePaise": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Per piece, before GST."
              },
              "unitPriceInr": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Per piece, before GST."
              },
              "priceExcludesGst": {
                "type": "boolean"
              },
              "gstPercent": {
                "type": "number"
              },
              "minimumOrderQuantity": {
                "type": "integer"
              },
              "quantityStep": {
                "type": "integer"
              },
              "note": {
                "type": "string"
              }
            }
          },
          "quoteUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Category": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "shortName": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "summary": {
            "type": "string"
          },
          "productCount": {
            "type": "integer"
          },
          "image": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        }
      }
    }
  }
}