{"id":4245,"library":"scalar-fastapi","title":"Scalar FastAPI","description":"Scalar FastAPI is a Python plugin that enhances the default FastAPI documentation experience by rendering a beautiful, interactive API reference based on the OpenAPI/Swagger specification. It provides a modern, responsive UI and a developer-first experience, offering extensive customization options for branding and layout. The library is actively maintained, with frequent updates to its underlying JavaScript components reflected in new Python wrapper releases.","status":"active","version":"1.8.2","language":"python","source_language":"en","source_url":"https://github.com/scalar/scalar","tags":["fastapi","openapi","swagger","api-documentation","docs","ui"],"install":[{"cmd":"pip install scalar-fastapi uvicorn","lang":"bash","label":"Install library and Uvicorn"}],"dependencies":[{"reason":"Core web framework required to generate OpenAPI schema.","package":"fastapi"},{"reason":"ASGI server to run FastAPI applications, necessary for quickstart examples.","package":"uvicorn","optional":true}],"imports":[{"symbol":"get_scalar_api_reference","correct":"from scalar_fastapi import get_scalar_api_reference"},{"note":"Used for providing multiple OpenAPI sources to the documentation.","symbol":"OpenAPISource","correct":"from scalar_fastapi import get_scalar_api_reference, OpenAPISource"},{"note":"Provides options for customizing the documentation layout.","symbol":"Layout","correct":"from scalar_fastapi import Layout"},{"note":"Provides options for customizing the documentation theme.","symbol":"Theme","correct":"from scalar_fastapi import Theme"}],"quickstart":{"code":"from fastapi import FastAPI\nfrom scalar_fastapi import get_scalar_api_reference\nimport uvicorn\n\napp = FastAPI(\n    title=\"My Awesome API\",\n    description=\"A simple FastAPI application to demonstrate Scalar docs.\",\n    version=\"1.0.0\",\n)\n\n@app.get(\"/\")\nasync def read_root():\n    return {\"message\": \"Hello, World!\"}\n\n@app.get(\"/scalar\", include_in_schema=False)\nasync def scalar_html():\n    return get_scalar_api_reference(\n        openapi_url=app.openapi_url,\n        title=app.title,\n        # Optional: Avoid CORS issues with a proxy\n        # scalar_proxy_url=\"https://proxy.scalar.com\",\n        # Optional: Disable telemetry\n        # telemetry=False\n    )\n\n# To run: uvicorn main:app --reload\n# Then open http://127.0.0.1:8000/scalar in your browser\n","lang":"python","description":"This example sets up a basic FastAPI application and integrates Scalar documentation at the `/scalar` endpoint. It uses `app.openapi_url` to automatically load the API's schema. Run with `uvicorn main:app --reload` and navigate to `/scalar`."},"warnings":[{"fix":"Pass `telemetry=False` to `get_scalar_api_reference()`.","message":"Telemetry is enabled by default. To disable usage telemetry for privacy or compliance, explicitly set `telemetry=False` in the `get_scalar_api_reference` call.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For production, configure `agent=AgentScalarConfig(key=\"your-agent-scalar-key\")` in `get_scalar_api_reference` or per `OpenAPISource`.","message":"The AI Chat 'Agent' feature is enabled by default on localhost with limited free messages. For production environments, an Agent key is required for full functionality. Failing to provide a key will limit or disable the AI features.","severity":"gotcha","affected_versions":"All versions with Agent feature"},{"fix":"Replace `hide_download_button=True` with `document_download_type=DocumentDownloadType.NONE` (or `JSON`, `YAML`, `BOTH` as needed).","message":"The `hide_download_button` parameter in `get_scalar_api_reference` is deprecated. Use `document_download_type` instead to control the visibility and type of the OpenAPI document download button.","severity":"deprecated","affected_versions":"1.5.0+"},{"fix":"Pass `scalar_proxy_url=\"https://proxy.scalar.com\"` (or your own proxy URL) to `get_scalar_api_reference()`.","message":"When serving the OpenAPI document from a different origin than Scalar (e.g., local development vs. hosted Scalar), CORS issues might occur. The documentation recommends using `scalar_proxy_url` to mitigate these problems.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Check the `scalar-fastapi` changelog (`integrations/fastapi/CHANGELOG.md` in the main Scalar GitHub repo) for Python-specific updates and breaking changes rather than solely relying on the overall Scalar project's release notes.","message":"The `scalar-fastapi` Python package wraps a core JavaScript frontend library. While the underlying JS components (e.g., `@scalar/api-client`, `@scalar/api-reference`) receive very frequent updates and potentially major changes, the Python wrapper's release cycle is less frequent. Python users might experience a slight delay in new frontend features or minor breaking changes being reflected in the `scalar-fastapi` version.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'activ':51 'api':21,71 'api-document':70 'base':23 'beauti':19 'brand':45 'compon':60 'custom':42 'default':12 'develop':37 'developer-first':36 'doc':73 'document':14,72 'enhanc':10 'experi':15,39 'extens':41 'fastapi':2,4,13,67 'first':38 'frequent':54 'interact':20 'javascript':59 'layout':47 'librari':49 'maintain':52 'modern':31 'new':63 'offer':40 'openapi':68 'openapi/swagger':26 'option':43 'plugin':8 'provid':29 'python':7,64 'refer':22 'reflect':61 'releas':66 'render':17 'respons':32 'scalar':1,3 'specif':27 'swagger':69 'ui':33,74 'under':58 'updat':55 'wrapper':65","created_at":"2026-04-12T03:47:08.381232+00:00","updated_at":"2026-04-17T14:13:10.993974+00:00","problems":{"verify_error":"error: Failed to parse: `scalar-fastapi uvicorn`\n  Caused by: Expected one of `@`, `(`, `<`, `=`, `>`, `~`, `!`, `;`, found `u`\nscalar-fastapi uvicorn\n               ^"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.9.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/scalar/scalar","docs":null,"changelog":null,"pypi":"https://pypi.org/project/scalar-fastapi/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-29","next_check":"2026-07-05","install_tag":null}}