--- id: apiflask version: "3.1.1" license: MIT license_treatment: permissive maintenance: active --- # APIFlask — A lightweight web API framework based on Flask. License: permissive · Maintenance: active · Downloads: 211.2K/mo ## What it is and what it does APIFlask is a thin wrapper around Flask that adds structured API development patterns. It lets you declare request and response schemas using either marshmallow or Pydantic, then automatically validates incoming JSON, deserializes it into your schema, and serializes responses back out—all while generating an OpenAPI specification and interactive Swagger UI documentation on the fly. You write decorators like `@app.input()` and `@app.output()` on your route functions, and APIFlask handles the plumbing: validation errors return JSON, successful responses are formatted consistently, and your API docs stay in sync with your code. It's built on top of Flask's ecosystem (using flask-marshmallow, webargs, apispec, and flask-httpauth) and remains fully compatible with Flask extensions and patterns. The framework is ORM/ODM-agnostic, so you can use it with SQLAlchemy, MongoDB, or any data layer. It supports both synchronous and asynchronous route handlers, and you can choose between multiple documentation UIs (Swagger UI, Redoc, Elements, RapiDoc, RapiPDF). Use it for: - Build REST APIs with automatic request validation and OpenAPI docs without writing boilerplate schema code. - Migrate from plain Flask to a structured API framework while keeping all existing Flask extensions and middleware. - Generate interactive API documentation (Swagger UI) automatically from your route decorators and schemas. - Validate incoming JSON against marshmallow or Pydantic schemas and return consistent error responses. - Implement API authentication using Flask-HTTPAuth with minimal setup code. - Serialize ORM/ODM model instances directly to JSON responses without manual conversion. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. APIFlask is a lightweight web API framework that extends Flask with automatic request validation, response serialization, and OpenAPI documentation generation using either marshmallow schemas or Pydantic models. Yes. APIFlask is actively maintained, has no known vulnerabilities, installs with low friction, and solves a real problem—reducing boilerplate in Flask API development while keeping you in the Flask ecosystem. It's suitable for production use (Development Status: Production/Stable) and works with modern Python versions. Choose it if you want Flask's flexibility with structured API patterns and auto-generated docs, without adopting a heavier framework. ## Install pip install apiflask uv add apiflask poetry add apiflask ## Installing APIFlask Before you install: Low friction install with a pure-Python wheel. Depends on seven runtime packages including Flask, marshmallow, Pydantic, and webargs. Actively maintained with a recent release and ongoing commits. License in practice: MIT license is permissive and imposes no restrictions on commercial or private use, modification, or redistribution. Quickstart: pip install apiflask from apiflask import APIFlask, Schema from apiflask.fields import String app = APIFlask(__name__) class PetOut(Schema): name = String() @app.get('/pets/') @app.output(PetOut) def get_pet(pet_id): return {'name': 'Kitty'} Requires Python 3.9+ and Flask 2.1+. Verify before relying: - Performance characteristics under load compared to other Flask-based API frameworks. - Maturity and stability of Pydantic model adapter relative to marshmallow schemas. - Real-world async support reliability and any known gotchas with Flask 2.0+ async features. ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 211.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags flask api framework with validation, automatic openapi documentation, marshmallow pydantic schema validation, rest api with flask, json request response serialization, swagger ui api docs, flask http authentication, rest-api, openapi-generation, schema-validation [View on SkillFed](https://skillfed.io/packages/apiflask) · [View on PyPI](https://pypi.org/project/apiflask/)