{
  "openapi": "3.0.3",
  "info": {
    "title": "ChinaMedsCheck — Official Public REST & MCP API",
    "version": "1.0.0",
    "description": "Stateless read-only medication border compliance API covering 38 controlled, banned, and allowed drugs under China Customs GACC Decree 442, CAAC aviation sharps/cold-chain policies, 4 airport Red Channel walkthroughs (PVG, PEK, CAN, PKX), bilingual Chinese pharmacy show cards, and local substitute meshes.",
    "contact": {
      "name": "ChinaMedsCheck",
      "url": "https://chinamedscheck.com",
      "email": "admin@chinamedscheck.com"
    },
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/licenses/MIT"
    }
  },
  "externalDocs": {
    "description": "ChinaMedsCheck Official Portal",
    "url": "https://chinamedscheck.com"
  },
  "servers": [
    {
      "url": "https://chinamedscheck.com",
      "description": "Production Edge & Cloud Run"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "paths": {
    "/api/v1/me": {
      "get": {
        "operationId": "verifyApiConnection",
        "summary": "Verify ChinaMedsCheck Connection & Tool Count",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "BearerAuth": []
          },
          {}
        ],
        "responses": {
          "200": {
            "description": "Service status and MCP tool inventory count"
          }
        }
      }
    },
    "/api/v1/tools": {
      "get": {
        "operationId": "listChinaMedsCheckTools",
        "summary": "List All ChinaMedsCheck Tools",
        "responses": {
          "200": {
            "description": "JSON schema inventory of all 8 ChinaMedsCheck tools"
          }
        }
      }
    },
    "/api/v1/tools/screen_medication_gacc_customs_legality": {
      "post": {
        "operationId": "screen_medication_gacc_customs_legality",
        "summary": "China Customs GACC Narcotic & Psychotropic Drug Border Screener",
        "description": "Match prescription brands, active ingredients, CAS numbers, RxNorm CUIs, Chinese names, or Russian/Japanese/Korean/Vietnamese aliases against 38 regulated entries under GACC Decree 442.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "medicationQuery": {
                    "type": "string",
                    "description": "Brand name, generic ingredient, Chinese name, CAS number, or slug (e.g., \"Adderall\", \"Concerta\", \"Xanax\", \"CBD oil\", \"Ozempic\", or \"all\")."
                  },
                  "statusFilter": {
                    "type": "string",
                    "enum": [
                      "all",
                      "RED",
                      "YELLOW",
                      "GREEN"
                    ],
                    "description": "Optional severity filter when listing or narrowing results (RED banned, YELLOW controlled, GREEN allowed)."
                  }
                },
                "required": [
                  "medicationQuery"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deterministic customs & medical clearance result"
          }
        }
      }
    },
    "/api/v1/tools/calculate_medication_supply_allowance": {
      "post": {
        "operationId": "calculate_medication_supply_allowance",
        "summary": "GACC Decree 442 Personal Supply Day-Limit & Channel Evaluator",
        "description": "Compute whether carried medication quantities fall within legal Class I psychotropic (7-day), Class II (15-day), or maintenance prescription (90-day) caps relative to trip length.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "medicationQuery": {
                    "type": "string",
                    "description": "Drug brand, slug, generic name, or fallback class (\"GENERIC_BANNED\", \"GENERIC_CAT1\", \"GENERIC_CAT2\", \"GENERIC_MAINTENANCE_RX\", \"GENERIC_OTC\")."
                  },
                  "carriedSupplyDays": {
                    "type": "number",
                    "description": "Total days of medication dosage the traveler intends to pack across China Customs."
                  },
                  "stayDurationDays": {
                    "type": "number",
                    "description": "Total planned stay length inside Mainland China in calendar days."
                  }
                },
                "required": [
                  "medicationQuery",
                  "carriedSupplyDays"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deterministic customs & medical clearance result"
          }
        }
      }
    },
    "/api/v1/tools/evaluate_caac_cabin_sharps_and_cold_chain": {
      "post": {
        "operationId": "evaluate_caac_cabin_sharps_and_cold_chain",
        "summary": "CAAC Aviation Carry-On Syringes, Auto-Injectors & Cold-Chain Gate",
        "description": "Inspect Civil Aviation Administration of China cabin rules for insulin pens, EpiPen auto-injectors, medical needles, refrigerated cold packs, and doctor certificate requirements.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "medicationQuery": {
                    "type": "string",
                    "description": "Specific injectable or biologic medication name/slug (e.g., \"Ozempic\", \"Insulin\", \"EpiPen\") or pass \"all\" to filter by equipment flag."
                  },
                  "filterMode": {
                    "type": "string",
                    "enum": [
                      "all",
                      "sharps_only",
                      "cold_chain_only",
                      "certificate_required"
                    ],
                    "description": "Filter dataset by syringe/needle involvement, cold-chain refrigeration, or mandatory airline medical certificate."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deterministic customs & medical clearance result"
          }
        }
      }
    },
    "/api/v1/tools/generate_bilingual_china_pharmacy_card": {
      "post": {
        "operationId": "generate_bilingual_china_pharmacy_card",
        "summary": "Chinese Pharmacist Show Card, Pinyin & Local OTC Brand Equivalent",
        "description": "Produce printable simplified Mandarin doctor/pharmacist consultation notes, Pinyin pronunciation, domestic brand equivalents, and customs officer show-card fields for travelers in China.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "medicationQuery": {
                    "type": "string",
                    "description": "Medication brand name, generic drug, or slug (e.g., \"Ibuprofen\", \"Tylenol\", \"Adderall\", \"Concerta\", \"Claritin\")."
                  },
                  "passengerName": {
                    "type": "string",
                    "description": "Optional traveler full passport name to prefill the English/Chinese declaration slip header."
                  },
                  "daysOfSupply": {
                    "type": "number",
                    "description": "Optional declared supply duration in days for customs paperwork formatting."
                  }
                },
                "required": [
                  "medicationQuery"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deterministic customs & medical clearance result"
          }
        }
      }
    },
    "/api/v1/tools/check_china_hospital_refill_and_clinic_pathway": {
      "post": {
        "operationId": "check_china_hospital_refill_and_clinic_pathway",
        "summary": "In-China Hospital Refill Viability & Specialist Clinic Advisor",
        "description": "Determine if a foreign prescription can be legally re-prescribed inside Chinese Tier-3 hospitals or expat clinics, listing required department specialists, max refill days, and documentation.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "medicationQuery": {
                    "type": "string",
                    "description": "Drug brand, generic substance, or slug (e.g., \"Concerta\", \"Xanax\", \"Metformin\", \"Prozac\") or pass \"refillable_only\"."
                  }
                },
                "required": [
                  "medicationQuery"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deterministic customs & medical clearance result"
          }
        }
      }
    },
    "/api/v1/tools/audit_multi_medication_travel_bag_manifest": {
      "post": {
        "operationId": "audit_multi_medication_travel_bag_manifest",
        "summary": "Multi-Drug Luggage Manifest Risk & Border Channel Consolidator",
        "description": "Evaluate an entire packed toiletry or travel bag containing multiple medications simultaneously to pinpoint any single banned trigger, aggregate Red Channel duties, and prepare a customs manifest.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "bagItems": {
                    "type": "array",
                    "description": "List of medications inside traveler luggage along with packed day quantities.",
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "medicationQuery": {
                          "type": "string",
                          "description": "Brand name, generic ingredient, or slug of a packed medication."
                        },
                        "carriedSupplyDays": {
                          "type": "number",
                          "description": "Number of daily doses packed in luggage for this item."
                        }
                      },
                      "required": [
                        "medicationQuery",
                        "carriedSupplyDays"
                      ]
                    }
                  },
                  "stayDurationDays": {
                    "type": "number",
                    "description": "Planned Mainland China visit duration in days used to cross-check long-stay refills."
                  }
                },
                "required": [
                  "bagItems"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deterministic customs & medical clearance result"
          }
        }
      }
    },
    "/api/v1/tools/query_airport_red_channel_meds_walkthrough": {
      "post": {
        "operationId": "query_airport_red_channel_meds_walkthrough",
        "summary": "China Airport Red Channel Desk & CT Pre-Screen Lock Walkthrough",
        "description": "Look up customs pre-inspection CT lock procedures, exact Red Channel declaration counters, operating hours, and arrival baggage steps across PVG, PEK, CAN, and PKX international airports.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "airportQuery": {
                    "type": "string",
                    "description": "Airport IATA code (PVG, PEK, CAN, PKX), city name (Shanghai, Beijing, Guangzhou), terminal slug, or \"all\"."
                  },
                  "locale": {
                    "type": "string",
                    "enum": [
                      "en",
                      "ja",
                      "ko",
                      "ru",
                      "vi"
                    ],
                    "description": "Language code for localized arrival instructions (defaults to English)."
                  }
                },
                "required": [
                  "airportQuery"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deterministic customs & medical clearance result"
          }
        }
      }
    },
    "/api/v1/tools/lookup_therapeutic_substitute_mesh": {
      "post": {
        "operationId": "lookup_therapeutic_substitute_mesh",
        "summary": "Therapeutic Alternative Graph & Safer Border Substitute Finder",
        "description": "Traverse the curated 38-drug therapeutic similarity graph to surface legal Chinese-approved substitutes and side-by-side risk comparisons when a traveler’s primary prescription is prohibited or heavily restricted.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "medicationQuery": {
                    "type": "string",
                    "description": "Target banned or restricted medication (e.g., \"Adderall\", \"CBD oil\", \"Codeine\", \"Modafinil\") to find safer clinical alternatives."
                  }
                },
                "required": [
                  "medicationQuery"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deterministic customs & medical clearance result"
          }
        }
      }
    }
  }
}
