Library / SDK
marshmallow-code/flask-smorest avatar
marshmallow-code/flask-smorest

flask-smorest turns marshmallow schemas into a documented REST API

DB agnostic framework to build auto-documented REST APIs with Flask and marshmallow

717 stars78 forksPythonMIT

At a glance

What is it?
flask-smorest is a Flask extension that wires marshmallow schemas into request parsing, response serialization and OpenAPI generation, so one schema class defines both the validation and the documentation. The trade is that it commits you to marshmallow 4 and apispec, and the version numbers in the release tags have drifted from the current package version.
Who is it for?
flask-smorest suits a Flask team that already uses marshmallow and wants one schema to drive parsing, response shaping and the OpenAPI document, which removes a class of drift between what the API accepts and what the docs claim. It does not suit a project that has already invested in a different validation layer, such as pydantic, or one that needs to publish an OpenAPI document without adopting marshmallow.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 9 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

One schema class does the parsing, the response and the docs

The problem this solves is the usual REST API drift. A team has a marshmallow schema that describes the shape of a resource, and separately a Flask view that parses the request and shapes the response, and separately an OpenAPI document that describes all of it. Three descriptions of the same thing, and they disagree. flask-smorest is a REST API framework built upon Flask and marshmallow, and the README lists what that buys you. Serialization, deserialization and validation using marshmallow Schema. Explicit validation error messages returned in the response. An OpenAPI specification automatically generated and exposed with ReDoc, Swagger UI or RapiDoc. Plus pagination and ETag. The intended user is a Python team that has already chosen marshmallow and Flask and wants the API surface to fall out of the schema rather than be maintained alongside it. The package description says it plainly, a Flask and Marshmallow based REST API framework, and the project lives in the marshmallow-code organisation, the same one behind marshmallow itself.

Explicit validation errors instead of a generic 400

The validation behaviour is the part that distinguishes it from a plain Flask view, and it is called out as its own feature: explicit validation error messages returned in the response. In a typical hand-rolled Flask endpoint, a validation failure is a catch-all exception handler and the client gets a generic message. Here the errors come from the schema, so the client gets the field-level detail the schema already knows how to produce. The mechanism underneath is webargs, which handles the request parsing side, and the package depends on it at version 8.0.0 or newer. The dependency set is worth reading as a whole because it explains what the tool is: werkzeug at 3.0.1 or newer, flask at 3.0.2 or newer, marshmallow at 4.0.0 or newer, webargs at 8.0.0 or newer, and apispec with the marshmallow extra at 6.0.0 or newer. That last one is the OpenAPI layer, apispec being the library that produces a specification object which this extension then serves.

The OpenAPI document is served, not just generated

Generating a specification is one thing, and the feature list is specific that the specification is automatically generated and exposed with ReDoc, Swagger UI or RapiDoc. That is a meaningful distinction, because a generated document that nobody can look at does not help anybody. The three viewers named are the common OpenAPI renderers, and the extension serves the document so that a developer can point a browser at the running service and read it. The project also depends on apispec with its marshmallow extra, which is the piece that knows how to turn a marshmallow schema into an OpenAPI object, and the topic list on the repository names apispec, marshmallow, openapi, webargs and rest-api. The name itself is a joke the README makes explicit, with the tagline 'cause everybody wants s'more.

Database agnostic, and how that is achieved

The database-agnostic claim is listed among the features, and it is worth being precise about what it means here, because it is the kind of phrase that gets read two ways. There is no ORM and no query builder in the dependency list. What the framework does is give you a consistent API surface for pagination, which means a request with a page number and a per-page count and a total count, and for ETag support, which means conditional requests. The query construction and the database access stay with whatever you already use, and the framework is the layer that turns that into a uniform response. For a team on SQLAlchemy, on plain SQL, or on something else, the pagination and ETag behaviour is the same in the API. It also means the framework is not in the business of deciding what your models look like, which is the point of the arrangement.

Installing it is one pip command and a docs site

Installation is the shortest section in the README, and that is accurate for a Flask extension. The install section gives a single pip install line:@@C1@@ and there is nothing else to configure, because the extension is imported into an existing Flask application rather than run on its own. The full documentation is hosted at flask-smorest.readthedocs.io, and the project badges show that the docs are built on Read the Docs, the package on PyPI, the Python versions supported, a build status, a pre-commit status and a codecov coverage badge. The repository layout matches a modern Python package, with src/ for the code, tests/ for the suite, docs/ for the documentation source, a tox.ini for the test matrix, a uv.lock alongside a pyproject.toml, a renovate.json for dependency updates and a .pre-commit-config.yaml for the lint hooks. The author and maintainer listed in the metadata is Jérôme Lafréchoux, and the funding route is marshmallow's Open Collective.

Marshmallow 4 is a hard requirement in this release

The version constraints are the part to check before you install, and they are tighter than the release tag list suggests. The current package metadata says version 0.47.0, requires-python is greater than or equal to 3.10, and the classifiers list Python 3.10 through 3.14. The dependency on marshmallow is 4.0.0 or newer and less than 5, which is the significant one. Marshmallow 4 is not backward compatible with Marshmallow 3 in a number of places, and the project also pins webargs at 8.0.0 or newer, which is the matching major of webargs for the marshmallow 4 generation. The build system is flit_core below version 5, and the package is developed with uv, with a default-groups setting of dev and an exclude-newer window of one week on the resolver.

Release tags and the package version have drifted apart

There is a discrepancy worth flagging, because it affects how you pin the dependency. The recent releases listed for the repository are 0.24.1 from 2020-08-09, 0.24.0 from 2020-07-16 and 0.23.0 from 2020-07-08, while the current package metadata declares version 0.47.0, and the last push to the repository was on 2026-10-13. The version numbers have moved a long way past the newest tag in that list, and the default branch is dev rather than main. For a project that is published to PyPI and installed by name, what matters is the PyPI version, and the README points at the package on PyPI rather than at a release artefact. The changelog URL in the project metadata points at the documentation site rather than a file in the repository, which is consistent with the project keeping its history in Read the Docs.

Editorial conclusion

flask-smorest suits a Flask team that already uses marshmallow and wants one schema to drive parsing, response shaping and the OpenAPI document, which removes a class of drift between what the API accepts and what the docs claim. It does not suit a project that has already invested in a different validation layer, such as pydantic, or one that needs to publish an OpenAPI document without adopting marshmallow. Before adopting, check the marshmallow major version in your project against the version this release requires, and note that the last push to the repository was on 2026-10-13 while the newest tagged release in the list is 0.24.1 from 2020-08-09 and the package metadata now says version 0.47.0.

Frequently asked questions

How do I install flask-smorest?

One pip command, `pip install flask-smorest`. It is a Flask extension rather than a standalone service, so there is nothing to run separately. The full documentation is at flask-smorest.readthedocs.io.

What does flask-smorest add on top of Flask and marshmallow?

Serialization, deserialization and validation using marshmallow Schema, explicit validation error messages returned in the response, pagination, ETag support, and an OpenAPI specification that is automatically generated and exposed with ReDoc, Swagger UI or RapiDoc.

Which marshmallow version does flask-smorest require?

The current package metadata requires marshmallow 4.0.0 or newer and less than 5, along with webargs 8.0.0 or newer, flask 3.0.2 or newer, werkzeug 3.0.1 or newer, and apispec with the marshmallow extra at 6.0.0 or newer. Python 3.10 or newer is required.

Does flask-smorest pick my database layer for me?

No. The feature is described as database-agnostic, and there is no ORM in the dependency list. The framework provides a uniform API surface for pagination and ETag support, while query construction and database access stay with whatever you already use.

Where is the flask-smorest documentation and changelog?

The full documentation is hosted at flask-smorest.readthedocs.io, and the project metadata lists the changelog URL as https://flask-smorest.readthedocs.io/en/latest/changelog.html. The repository itself carries a README.rst, a CHANGELOG.rst and a docs/ directory with the documentation source.

Official sources

  1. License: MIT
  2. marshmallow-code/flask-smorest on GitHub
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/marshmallow-code-flask-smorest.svg)](https://hysenlabs.com/projects/marshmallow-code-flask-smorest)

Was this useful?