{
  "openapi": "3.1.0",
  "info": {
    "title": "FSMA204Hub public API",
    "version": "1.0.0",
    "summary": "Free, read-only endpoints for FSMA 204 traceability: validate a Traceability Lot Code, search the FSMA 204 guidance library, and read current pricing.",
    "description": "A free, unauthenticated, read-only API over the reference material and\nfree tools published on fsma204hub.com. No API key, no signup, no rate\nlimit beyond ordinary fair use. Send a descriptive User-Agent.\n\nThese are the same capabilities registered as WebMCP tools on the site,\nexposed over HTTP so an agent that is not driving a browser can use them.\n\n## Versioning and deprecation\n\nThis is v1 and it is the current version. Nothing in it is deprecated.\nAdditive changes (new endpoints, new optional parameters, new response\nfields) ship into v1 without notice. Breaking changes would ship at\n/api/v2; v1 would not change under you.\n\nIf v1 is ever retired, every response will carry a `Deprecation` header\nand a `Sunset` header (RFC 8594) naming the date, at least 180 days\nahead, and the sunset date will also appear here and at /developers.\nNo `Sunset` header today means no planned retirement.\n\nNothing here is legal advice. A lot-code verdict is a formatting\nheuristic: FDA does not prescribe a TLC format, and a compliance\ndetermination is not something an API can make for you.",
    "contact": {
      "name": "FSMA204Hub support",
      "email": "hello@fsma204hub.com",
      "url": "https://fsma204hub.com/developers"
    },
    "license": {
      "name": "Free to use, attribution appreciated",
      "url": "https://fsma204hub.com/terms"
    }
  },
  "servers": [
    {
      "url": "https://fsma204hub.com",
      "description": "Production"
    }
  ],
  "externalDocs": {
    "description": "Developer docs",
    "url": "https://fsma204hub.com/developers"
  },
  "security": [],
  "tags": [
    {
      "name": "traceability",
      "description": "Traceability Lot Code tooling."
    },
    {
      "name": "guidance",
      "description": "FSMA 204 reference library search."
    },
    {
      "name": "pricing",
      "description": "Current plans and prices."
    }
  ],
  "paths": {
    "/api/v1": {
      "get": {
        "operationId": "getApiIndex",
        "summary": "List the available endpoints",
        "description": "Returns the API index: every operation, its path, and a one-line description. Use this to discover the surface without fetching the OpenAPI document.",
        "tags": [
          "guidance"
        ],
        "responses": {
          "200": {
            "description": "The API index.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "name",
                    "version",
                    "endpoints"
                  ],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "documentation_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "openapi_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "endpoints": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "method",
                          "path",
                          "operationId",
                          "description"
                        ],
                        "properties": {
                          "method": {
                            "type": "string"
                          },
                          "path": {
                            "type": "string"
                          },
                          "operationId": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tlc/validate": {
      "get": {
        "operationId": "validateTraceabilityLotCode",
        "summary": "Validate a FSMA 204 Traceability Lot Code",
        "description": "Checks a Traceability Lot Code (TLC) against the conventions FDA's rule\nimplies and returns a verdict with the specific problems found and a\ncorrected template.\n\nCatches the failure modes that actually appear in audits: a bare date,\na bare sequence number, a best-by marker used as an identifier, and\ncodes too short to be unique across production runs.\n\nFDA does not mandate a TLC format, so this is a quality heuristic, not\na compliance determination.",
        "tags": [
          "traceability"
        ],
        "parameters": [
          {
            "name": "lotCode",
            "in": "query",
            "required": true,
            "description": "The traceability lot code to validate, e.g. CHV-20260415-A1.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "example": "CHV-20260415-A1"
          },
          {
            "name": "role",
            "in": "query",
            "required": false,
            "description": "Where in the supply chain the code is assigned. Changes the guidance returned. Defaults to unsure.",
            "schema": {
              "type": "string",
              "enum": [
                "packer",
                "receiver",
                "transformer",
                "unsure"
              ],
              "default": "unsure"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The validation result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TlcValidation"
                }
              }
            }
          },
          "400": {
            "description": "lotCode was missing, empty, or too long.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/guidance": {
      "get": {
        "operationId": "searchFsma204Guidance",
        "summary": "Search the FSMA 204 guidance library",
        "description": "Full-text search over the FSMA204Hub field notes and support library:\nthe rule text at 21 CFR 1.1300-1.1460, Key Data Elements, Critical\nTracking Events, lot coding, and US grocery retailer supplier\nrequirements and deadlines.\n\nEach result carries the canonical URL and a markdown URL, so an agent\ncan fetch the full article without parsing HTML.",
        "tags": [
          "guidance"
        ],
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": true,
            "description": "What to search for, e.g. 'Walmart lot code source'.",
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 200
            },
            "example": "KDE at receiving"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum results to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 25,
              "default": 5
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching articles, most relevant first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GuidanceResults"
                }
              }
            }
          },
          "400": {
            "description": "query was missing or shorter than two characters.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/pricing": {
      "get": {
        "operationId": "getPricing",
        "summary": "Get current plans and prices",
        "description": "Returns every plan: tier key, label, monthly USD price, facility allowance, and the feature list. Prices are billed monthly in USD. Use this when comparing traceability products on cost.",
        "tags": [
          "pricing"
        ],
        "responses": {
          "200": {
            "description": "The current plan list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pricing"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. Returned for every 4xx and 5xx response.",
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "code",
          "resolution"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string",
            "description": "What went wrong, in plain English."
          },
          "instance": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "enum": [
              "missing_parameter",
              "invalid_parameter",
              "not_found",
              "method_not_allowed",
              "internal_error"
            ],
            "description": "Stable machine-readable error code. Branch on this, not on the message."
          },
          "resolution": {
            "type": "string",
            "description": "The concrete next step that would make this request succeed."
          },
          "documentation_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "TlcValidation": {
        "type": "object",
        "required": [
          "lotCode",
          "role",
          "verdict",
          "headline",
          "reasons",
          "fix",
          "disclaimer"
        ],
        "properties": {
          "lotCode": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "packer",
              "receiver",
              "transformer",
              "unsure"
            ]
          },
          "verdict": {
            "type": "string",
            "enum": [
              "fail",
              "warn",
              "pass",
              "gold"
            ],
            "description": "fail: not usable as a lot identifier. warn: usable but fragile. pass: acceptable. gold: unambiguous and self-describing."
          },
          "headline": {
            "type": "string",
            "description": "One-line summary of the verdict."
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The specific findings behind the verdict."
          },
          "fix": {
            "type": "object",
            "required": [
              "template",
              "example",
              "explanation"
            ],
            "properties": {
              "template": {
                "type": "string"
              },
              "example": {
                "type": "string"
              },
              "explanation": {
                "type": "string"
              }
            }
          },
          "roleNote": {
            "type": "string"
          },
          "disclaimer": {
            "type": "string"
          }
        }
      },
      "GuidanceResults": {
        "type": "object",
        "required": [
          "query",
          "count",
          "results"
        ],
        "properties": {
          "query": {
            "type": "string"
          },
          "count": {
            "type": "integer"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "title",
                "description",
                "url",
                "markdownUrl",
                "kind"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "markdownUrl": {
                  "type": "string",
                  "format": "uri",
                  "description": "The same article as text/markdown."
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "field note",
                    "support article"
                  ]
                },
                "updated": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Pricing": {
        "type": "object",
        "required": [
          "currency",
          "billingPeriod",
          "trialDays",
          "plans"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "example": "USD"
          },
          "billingPeriod": {
            "type": "string",
            "example": "month"
          },
          "trialDays": {
            "type": "integer"
          },
          "creditCardRequiredForTrial": {
            "type": "boolean"
          },
          "valueMetric": {
            "type": "string",
            "description": "What the price scales with. Users are unlimited on every plan."
          },
          "plans": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "key",
                "label",
                "priceLabel",
                "features"
              ],
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "monthly": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Monthly price in USD. null means custom, contact sales."
                },
                "priceLabel": {
                  "type": "string"
                },
                "facilityCap": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "facilityLabel": {
                  "type": "string"
                },
                "blurb": {
                  "type": "string"
                },
                "features": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}