{
  "openapi": "3.0.3",
  "info": {
    "title": "Supplement Check",
    "version": "1.1.0",
    "description": "Read a supplement label, check a dose or a whole routine against adult upper limits, learn what a vitamin, mineral or popular supplement (creatine, melatonin, ashwagandha, caffeine and more) is for, and see which ingredients need a confirmed halal source. Every answer has a ready-to-read `say` line and a `note` that this is general information, not medical advice. Read only, no account, nothing stored. Data: NIH Dietary Supplement Label Database, NIH Office of Dietary Supplements and NCCIH fact sheets, FDA, Open Food Facts and the Halal or Not? rulebook.",
    "contact": {
      "email": "hello@askmizan.com"
    }
  },
  "servers": [
    {
      "url": "https://supplementcheck.pages.dev"
    }
  ],
  "paths": {
    "/v1/product": {
      "get": {
        "operationId": "getSupplement",
        "summary": "A supplement's label: amounts per serving, upper limit check, halal status and a buy link",
        "description": "Use for \"what's in Nature Made vitamin D3?\", \"is Centrum halal?\", \"how much melatonin is in OLLY Sleep?\" or \"is this supplement halal?\" with a barcode. Give q (brand and product name) or barcode. Returns per-serving amounts, dose_check (each vitamin and mineral compared with the adult upper limit at the most the label suggests per day, with per_day_base amounts), other_checks (melatonin, caffeine, creatine, ashwagandha and similar, including when a blend hides the amount), halal (likely_halal, doubtful, not_halal or depends_on_school, with the ingredients that need a confirmed source), alternatives (other sizes or versions), an Amazon link, and halal_options (links to halal-certified or gelatine-free versions) when the halal answer is not likely_halal. For a general name like \"creatine monohydrate\" it reads one common label and says so. Read out `say`, then the `note`. Offer buy or halal_options links only after the answer.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Brand and product name, for example Nature Made vitamin D3 2000 IU.",
            "schema": {
              "type": "string",
              "maxLength": 120
            }
          },
          {
            "name": "barcode",
            "in": "query",
            "required": false,
            "description": "UPC or EAN barcode digits (8 to 14).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": false,
            "description": "A label id from the NIH database, for example from alternatives.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "description": "For buy links: US, GB, IE, CA, AU. Default from the request.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Label facts with say, note and disclosure"
          },
          "400": {
            "description": "Missing or bad input"
          },
          "404": {
            "description": "Not found"
          },
          "503": {
            "description": "Label database not answering"
          }
        }
      }
    },
    "/v1/nutrient": {
      "get": {
        "operationId": "getNutrient",
        "summary": "What a vitamin, mineral or popular supplement does, how much adults need or studies used, limits, cautions and food sources",
        "description": "Use for \"what does magnesium glycinate do?\", \"what is vitamin K for?\", \"how much vitamin D do I need?\", \"is ashwagandha safe?\" or \"what is creatine?\". Covers vitamins A, B1, B2, B5, B6, B12, C, D, E and K, niacin, folate, biotin, choline, calcium, iron, zinc, magnesium, potassium, selenium, iodine, copper, chromium, manganese, molybdenum, phosphorus, boron and omega-3, and explains common forms. Also covers creatine, melatonin, caffeine, ashwagandha, turmeric, CoQ10, collagen, protein powder, probiotics, psyllium, glucosamine, St John's wort, green tea extract, berberine, L-theanine and elderberry: for these it returns supplement, what_studies_looked_at, studied_amounts, ceiling, cautions and source instead of rda and upper_limit. Links the NIH fact sheet. Also returns shop links (Amazon, with a disclosure) to offer only if the user wants to buy.",
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "required": true,
            "description": "A vitamin, mineral, form or supplement, for example magnesium glycinate or ashwagandha.",
            "schema": {
              "type": "string",
              "maxLength": 60
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "description": "For shop links: US, GB, IE, CA, AU. Default from the request.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Nutrient facts"
          },
          "400": {
            "description": "Missing name"
          },
          "404": {
            "description": "Not covered"
          }
        }
      }
    },
    "/v1/dose": {
      "get": {
        "operationId": "checkDose",
        "summary": "Compare an amount of a vitamin or mineral with the adult RDA and upper limit",
        "description": "Use for \"is 5000 IU of vitamin D too much?\", \"is 500 mg of magnesium glycinate safe?\", \"is 10 mg of melatonin a lot?\" or \"is 300 mg of caffeine too much?\". Handles IU, mcg, mg and g, including IU for vitamins A, D and E and DFE for folate. For vitamins and minerals, status is above, at, within or no_upper_limit; when the name is a compound (magnesium glycinate, ferrous sulfate, zinc gluconate) the `compound` field also gives how much of the mineral the compound holds, as US labels list the mineral itself. For other supplements the answer compares with an official ceiling where one exists (caffeine) or the amounts studies have used, with status above, at, within, above_studied_range, within_studied_range, below_studied_range or no_set_amount, plus cautions. Adult values only; always read the `note`.",
        "parameters": [
          {
            "name": "nutrient",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 60
            }
          },
          {
            "name": "amount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 10000000
            }
          },
          {
            "name": "unit",
            "in": "query",
            "required": false,
            "description": "IU, mcg, mg, g, mcg DFE, or billion (CFU) for probiotics. Defaults to IU for vitamin D amounts of 200 or more, otherwise the usual unit.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "The whole question instead, for example 5000 IU vitamin D.",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Comparison"
          },
          "400": {
            "description": "Missing or bad input"
          },
          "404": {
            "description": "Nutrient not covered"
          }
        }
      }
    },
    "/v1/stack": {
      "get": {
        "operationId": "checkStack",
        "summary": "Add up everything someone takes and check the daily totals against adult upper limits",
        "description": "Use for \"I take Centrum, vitamin D 5000 IU and zinc 50 mg, is that too much?\" or \"is it OK to take OLLY Sleep with extra melatonin?\". Pass up to 6 items separated by semicolons: product names, barcodes, or amounts like vitamin D 5000 IU. Products are counted at the most each label suggests per day. Returns totals (each vitamin and mineral added up, with the items it comes from, compared with the adult upper limit), other_totals (caffeine, melatonin and similar added up, or marked when a label hides the amount), items (what each was matched to) and not_found. Read out `say`, then the `note`.",
        "parameters": [
          {
            "name": "items",
            "in": "query",
            "required": true,
            "description": "What the user takes, separated by semicolons, for example Centrum Silver Men; vitamin D 5000 IU; zinc 50 mg.",
            "schema": {
              "type": "string",
              "maxLength": 400
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Daily totals with say and note"
          },
          "400": {
            "description": "Missing input or more than 6 items"
          },
          "404": {
            "description": "None of the items found"
          },
          "503": {
            "description": "Label database not answering"
          }
        }
      }
    },
    "/v1/health": {
      "get": {
        "operationId": "health",
        "summary": "Service status",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  }
}