---
title: "flask-restx | pypx"
description: "Fully featured framework for fast, easy and documented API development with Flask"
canonical_url: "https://pypx.app/packages/flask-restx"
meta:
  "og:description": "Fully featured framework for fast, easy and documented API development with Flask"
  "og:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_flask-restx%2Cversion_1.3.2%2Csummary_~RnVsbHkgZmVhdHVyZWQgZnJhbWV3b3JrIGZvciBmYXN0LCBlYXN5IGFuZCBkb2N1bWVudGVkIEFQSSBkZXZlbG9wbWVudCB3aXRoIEZsYXNr%2Clicense_BSD%2BLicense%2Cp_Ii9wYWNrYWdlcy9mbGFzay1yZXN0eCI%2Cs_pvET1gh1twAE6Nw4.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "flask-restx 1.3.2"
  "twitter:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_flask-restx%2Cversion_1.3.2%2Csummary_~RnVsbHkgZmVhdHVyZWQgZnJhbWV3b3JrIGZvciBmYXN0LCBlYXN5IGFuZCBkb2N1bWVudGVkIEFQSSBkZXZlbG9wbWVudCB3aXRoIEZsYXNr%2Clicense_BSD%2BLicense%2Cp_Ii9wYWNrYWdlcy9mbGFzay1yZXN0eCI%2Cs_pvET1gh1twAE6Nw4.png"
---

> Index of every page on this site: [llms.txt](https://pypx.app/llms.txt)

# **flask-restx**

v1.3.2

Fully featured framework for fast, easy and documented API development with Flask

2.7 MB Python 3.9+ py2.py3-none-anyBSD License6 deps

[**Diff **](https://pypx.app/packages/flask-restx/diff)

`$ uv add flask-restx`

\===========

# Flask RESTX

![Tests status](https://github.com/python-restx/flask-restx/workflows/Tests/badge.svg?tag=1.3.2&event=push) ![Code coverage](https://codecov.io/gh/python-restx/flask-restx/branch/master/graph/badge.svg) ![Documentation status](https://readthedocs.org/projects/flask-restx/badge/?version=1.3.2) ![License](https://img.shields.io/pypi/l/flask-restx.svg) ![Supported Python versions](https://img.shields.io/pypi/pyversions/flask-restx.svg) ![Join the chat at https://gitter.im/python-restx](https://badges.gitter.im/Join%20Chat.svg) ![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)

Flask-RESTX is a community driven fork of [Flask-RESTPlus](https://github.com/noirbizarre/flask-restplus).

Flask-RESTX is an extension for `Flask`\_ that adds support for quickly building REST APIs. Flask-RESTX encourages best practices with minimal setup. If you are familiar with Flask, Flask-RESTX should be easy to pick up. It provides a coherent collection of decorators and tools to describe your API and expose its documentation properly using `Swagger`\_.

# Compatibility

Flask-RESTX requires Python 3.9+.

# On Flask Compatibility

Flask and Werkzeug moved to versions 2.0 in March 2020. This caused a breaking change in Flask-RESTX.

:widths: 25 25 25 :header-rows: 1 *- Flask-RESTX version - Flask version - Note* - <= 0.3.0 - < 2.0.0 - unpinned in Flask-RESTX. Pin your projects! *- == 0.4.0 - < 2.0.0 - pinned in Flask-RESTX.* - >= 0.5.0 - < 3.0.0 - unpinned, import statements wrapped for compatibility *- == 1.2.0 - < 3.0.0 - pinned in Flask-RESTX.* - >= 1.3.0 - >= 2.0.0 (Flask >= 3.0.0 support) - unpinned, import statements wrapped for compatibility \* - trunk branch in Github - >= 2.0.0 (Flask >= 3.0.0 support) - unpinned, will address issues faster than releases.

# Installation

You can install Flask-RESTX with pip:

```console
$ pip install flask-restx
```

or with easy\_install:

```console
$ easy_install flask-restx
```

# Quick start

With Flask-RESTX, you only import the api instance to route and document your endpoints.

```python
from flask import Flask
from flask_restx import Api, Resource, fields

app = Flask(__name__)
api = Api(app, version='1.0', title='TodoMVC API',
    description='A simple TodoMVC API',
)

ns = api.namespace('todos', description='TODO operations')

todo = api.model('Todo', {
    'id': fields.Integer(readonly=True, description='The task unique identifier'),
    'task': fields.String(required=True, description='The task details')
})


class TodoDAO(object):
    def __init__(self):
        self.counter = 0
        self.todos = []

    def get(self, id):
        for todo in self.todos:
            if todo['id'] == id:
                return todo
        api.abort(404, "Todo {} doesn't exist".format(id))

    def create(self, data):
        todo = data
        todo['id'] = self.counter = self.counter + 1
        self.todos.append(todo)
        return todo

    def update(self, id, data):
        todo = self.get(id)
        todo.update(data)
        return todo

    def delete(self, id):
        todo = self.get(id)
        self.todos.remove(todo)


DAO = TodoDAO()
DAO.create({'task': 'Build an API'})
DAO.create({'task': '?????'})
DAO.create({'task': 'profit!'})


@ns.route('/')
class TodoList(Resource):
    '''Shows a list of all todos, and lets you POST to add new tasks'''
    @ns.doc('list_todos')
    @ns.marshal_list_with(todo)
    def get(self):
        '''List all tasks'''
        return DAO.todos

    @ns.doc('create_todo')
    @ns.expect(todo)
    @ns.marshal_with(todo, code=201)
    def post(self):
        '''Create a new task'''
        return DAO.create(api.payload), 201


@ns.route('/<int:id>')
@ns.response(404, 'Todo not found')
@ns.param('id', 'The task identifier')
class Todo(Resource):
    '''Show a single todo item and lets you delete them'''
    @ns.doc('get_todo')
    @ns.marshal_with(todo)
    def get(self, id):
        '''Fetch a given resource'''
        return DAO.get(id)

    @ns.doc('delete_todo')
    @ns.response(204, 'Todo deleted')
    def delete(self, id):
        '''Delete a task given its identifier'''
        DAO.delete(id)
        return '', 204

    @ns.expect(todo)
    @ns.marshal_with(todo)
    def put(self, id):
        '''Update a task given its identifier'''
        return DAO.update(id, api.payload)


if __name__ == '__main__':
    app.run(debug=True)
```

# Contributors

Flask-RESTX is brought to you by @python-restx. Since early 2019 @SteadBytes, @a-luna, @j5awry, @ziirish volunteered to help @python-restx keep the project up and running, they did so for a long time! Since the beginning of 2023, the project is maintained by @peter-doggart with help from @ziirish. Of course everyone is welcome to contribute and we will be happy to review your PR's or answer to your issues.

# Documentation

The documentation is hosted [on Read the Docs](http://flask-restx.readthedocs.io/en/latest/)

# Contribution

Want to contribute! That's awesome! Check out [CONTRIBUTING.rst!](https://github.com/python-restx/flask-restx/blob/master/CONTRIBUTING.rst)

## **Details **

<dl>

<dt>Version</dt>
<dd>1.3.2</dd>

<dt>License</dt>
<dd>BSD License</dd>

<dt>Python</dt>
<dd>&gt;=3.9</dd>

<dt>Maintainer</dt>
<dd>python-restx Authors</dd></dl>

## **Links**

- [Homepage](https://github.com/python-restx/flask-restx)
- [View on PyPI](https://pypi.org/project/flask-restx/)

## **Maintainers **

- python-restx Authors

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://pypx.app/#website","@type":"WebSite","description":"The Python Package Index, reimagined. Fast search, dependency insights, download trends, and changelogs — all in one place.","name":"pypx","url":"https://pypx.app/"},{"@id":"https://pypx.app/packages/flask-restx#webpage","@type":"WebPage","description":"Fully featured framework for fast, easy and documented API development with Flask","name":"flask-restx","url":"https://pypx.app/packages/flask-restx","isPartOf":{"@id":"https://pypx.app/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://pypx.app/packages/flask-restx"]}]},{"@id":"https://pypx.app/packages/flask-restx#/schema/software-application/1","@type":"SoftwareApplication","applicationCategory":"DeveloperApplication","description":"Fully featured framework for fast, easy and documented API development with Flask","license":"BSD License","name":"flask-restx","softwareVersion":"1.3.2"}]}
```

## Sitemap

See the full [sitemap](https://pypx.app/sitemap.md) for all pages.
