flask-apispec
Build and document REST APIs with Flask and apispec
What it is and what it does
flask-apispec is a lightweight decorator-based library that bridges Flask, webargs, marshmallow, and apispec to streamline REST API development. It lets you annotate view functions and class-based views with decorators that simultaneously handle request parsing, response serialization, and automatic Swagger documentation generation. Instead of writing separate validation and documentation code, you declare your schema once and flask-apispec handles the rest.
The package works with vanilla Flask or Flask-RESTful, supporting both function-based and class-based views. It automatically serves Swagger JSON and Swagger-UI at configurable endpoints. However, the project is aging—last released in August 2022 with no active development since—so it may not track the latest versions of its dependencies or modern OpenAPI standards.
Use it for:
- Build a REST API where request validation, response formatting, and Swagger docs are all declared via decorators on a single view.
- Generate live Swagger documentation automatically from your Flask route handlers without writing separate spec files.
- Migrate from Flask-RESTful or Flask-RESTplus to a lighter-weight approach that still provides structured request/response handling.
- Combine webargs request parsing with marshmallow serialization in a single decorator stack on class-based views.
- Serve Swagger-UI alongside your API to provide interactive documentation to API consumers.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
flask-apispec decorates Flask view functions and classes to automatically parse requests with webargs, format responses with marshmallow, and generate Swagger documentation via apispec.
Yes, if you are starting a new Flask REST API and want lightweight decorator-based request/response handling plus automatic Swagger generation. No, if you need active maintenance, support for the latest OpenAPI/Swagger standards, or compatibility with recent versions of its dependencies—the aging status and lack of updates since 2022 mean you may encounter compatibility issues or missing features. Consider it a stable but unmaintained choice for greenfield projects with stable dependency versions.
Install
flask-apispec on PyPI
pip
pip install flask-apispecuv
uv add flask-apispecpoetry
poetry add flask-apispecInstalling flask-apispec
Before you install
Low install friction; depends on four well-established packages (flask, marshmallow, webargs, apispec). Maintenance is aging—last release was 2022-08-11 and no commits since 2025-05-04—so expect no active bug fixes or feature development, though the repo remains unarchived.
License in practice
MIT license is permissive; you can use, modify, and distribute flask-apispec with minimal restrictions, provided you include the license notice.
Quickstart
pip install flask-apispec
from flask import Flask
from flask_apispec import use_kwargs, marshal_with
from marshmallow import Schema
from webargs import fields
app = Flask(__name__)
class PetSchema(Schema):
class Meta:
fields = ('name', 'category')
@app.route('/pets')
@use_kwargs({'category': fields.Str()})
@marshal_with(PetSchema(many=True))
def get_pets(**kwargs):
return []
Requires Python 3.6 or later; webargs, marshmallow, and apispec must be installed and compatible.
Verify before relying
- Whether the package remains compatible with current versions of Flask, webargs, marshmallow, and apispec given the aging maintenance status.
- Whether Swagger/OpenAPI generation still produces valid specs for modern API documentation tools.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — flask, marshmallow, webargs, apispec |
| Maintenance | aging — 1,464 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 356,015/month — #7,286 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: flask_apispec-0.11.4-py2.py3-none-any.whl
Keywords: flask, marshmallow, webargs, apispec
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
apispecGenerates OpenAPI specification documents from…
permissive · top 5,000 on PyPI
webargswebargs parses and validates HTTP request…
permissive · top 5,000 on PyPI
apispec-webframeworksProvides web framework plugins for apispec to…
permissive · top 15,000 on PyPI
Flask-RESTfulFlask-RESTful provides decorators and utilities…
permissive · top 5,000 on PyPI
APIFlaskAPIFlask is a lightweight web API framework…
permissive · top 15,000 on PyPI
flask-restplusFlask-RESTPlus adds decorators and tools to…
permissive · top 15,000 on PyPI
flasggerFlasgger extracts OpenAPI specifications from…
permissive · top 5,000 on PyPI
flask-swaggerExtracts Swagger 2.0 API specifications from…
permissive · top 15,000 on PyPI
apispec-oneofschemaExtends apispec to generate OpenAPI 3.0+…
permissive · top 15,000 on PyPI
flask-restxFlask-RESTX extends Flask with decorators and…
permissive · top 5,000 on PyPI