from fastapi import Header, HTTPException def x_api_key_auth(x_api_key: str = Header(...)): expected_api_key = "your_expected_api_key" # Replace with your actual API key if x_api_key != expected_api_key: raise HTTPException(status_code=401, detail="Invalid API Key") return True