djangorestframework 3.17.1


pip install djangorestframework

  Latest version

Released: Mar 24, 2026


Meta
Author: Tom Christie
Requires Python: >=3.10

Classifiers

Development Status
  • 5 - Production/Stable

Environment
  • Web Environment

Framework
  • Django
  • Django :: 4.2
  • Django :: 5.0
  • Django :: 5.1
  • Django :: 5.2
  • Django :: 6.0

Intended Audience
  • Developers

Operating System
  • OS Independent

Programming Language
  • Python
  • Python :: 3 :: Only
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14

Topic
  • Internet :: WWW/HTTP

Django REST framework

build-status-image coverage-status-image pypi-version

Awesome web-browsable Web APIs.

Full documentation for the project is available at https://www.django-rest-framework.org/.


Overview

Django REST framework is a powerful and flexible toolkit for building Web APIs.

Some reasons you might want to use REST framework:

Below: Screenshot from the browsable API

Screenshot


Requirements

  • Python 3.10+
  • Django 4.2, 5.0, 5.1, 5.2, 6.0

We highly recommend and only officially support the latest patch release of each Python and Django series.

Installation

Install using pip...

pip install djangorestframework

Add 'rest_framework' to your INSTALLED_APPS setting.

INSTALLED_APPS = [
    # ...
    "rest_framework",
]

Example

Let's take a look at a quick example of using REST framework to build a simple model-backed API for accessing users and groups.

Start up a new project like so...

pip install django
pip install djangorestframework
django-admin startproject example .
./manage.py migrate
./manage.py createsuperuser

Now edit the example/urls.py module in your project:

from django.contrib.auth.models import User
from django.urls import include, path
from rest_framework import routers, serializers, viewsets


# Serializers define the API representation.
class UserSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = User
        fields = ["url", "username", "email", "is_staff"]


# ViewSets define the view behavior.
class UserViewSet(viewsets.ModelViewSet):
    queryset = User.objects.all()
    serializer_class = UserSerializer


# Routers provide a way of automatically determining the URL conf.
router = routers.DefaultRouter()
router.register(r"users", UserViewSet)

# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
    path("", include(router.urls)),
    path("api-auth/", include("rest_framework.urls", namespace="rest_framework")),
]

We'd also like to configure a couple of settings for our API.

Add the following to your settings.py module:

INSTALLED_APPS = [
    # ... make sure to include the default installed apps here.
    "rest_framework",
]

REST_FRAMEWORK = {
    # Use Django's standard `django.contrib.auth` permissions,
    # or allow read-only access for unauthenticated users.
    "DEFAULT_PERMISSION_CLASSES": [
        "rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly",
    ]
}

That's it, we're done!

./manage.py runserver

You can now open the API in your browser at http://127.0.0.1:8000/, and view your new 'users' API. If you use the Login control in the top right corner you'll also be able to add, create and delete users from the system.

You can also interact with the API using command line tools such as curl. For example, to list the users endpoint:

$ curl -H 'Accept: application/json; indent=4' -u admin:password http://127.0.0.1:8000/users/
[
    {
        "url": "http://127.0.0.1:8000/users/1/",
        "username": "admin",
        "email": "admin@example.com",
        "is_staff": true,
    }
]

Or to create a new user:

$ curl -X POST -d username=new -d email=new@example.com -d is_staff=false -H 'Accept: application/json; indent=4' -u admin:password http://127.0.0.1:8000/users/
{
    "url": "http://127.0.0.1:8000/users/2/",
    "username": "new",
    "email": "new@example.com",
    "is_staff": false,
}

Documentation & Support

Full documentation for the project is available at https://www.django-rest-framework.org/.

For questions and support, use the REST framework discussion group, or #restframework on libera.chat IRC.

Security

Please see the security policy.

3.17.1 Mar 24, 2026
3.17.0 Mar 18, 2026
3.16.1 Aug 06, 2025
3.16.0 Mar 28, 2025
3.15.2 Jun 19, 2024
3.15.1 Mar 22, 2024
3.15.0 Mar 16, 2024
3.14.0 Sep 22, 2022
3.13.1 Dec 15, 2021
3.13.0 Dec 13, 2021
3.12.4 Mar 26, 2021
3.12.3 Mar 25, 2021
3.12.2 Nov 05, 2020
3.12.1 Sep 28, 2020
3.12.0 Sep 28, 2020
3.11.2 Sep 30, 2020
3.11.1 Aug 05, 2020
3.11.0 Dec 12, 2019
3.10.3 Sep 04, 2019
3.10.2 Jul 29, 2019
3.10.1 Jul 17, 2019
3.10.0 Jul 15, 2019
3.9.4 May 10, 2019
3.9.3 Apr 29, 2019
3.9.2 Mar 03, 2019
3.9.1 Jan 16, 2019
3.9.0 Oct 18, 2018
3.8.2 Apr 06, 2018
3.8.1 Apr 04, 2018
3.8.0 Apr 03, 2018
3.7.7 Dec 21, 2017
3.7.6 Dec 21, 2017
3.7.5 Dec 21, 2017
3.7.4 Dec 20, 2017
3.7.3 Nov 06, 2017
3.7.2 Nov 06, 2017
3.7.1 Oct 16, 2017
3.7.0 Oct 06, 2017
3.6.4 Aug 22, 2017
3.6.3 May 12, 2017
3.6.2 Mar 10, 2017
3.6.1 Mar 09, 2017
3.6.0 Mar 09, 2017
3.5.4 Feb 10, 2017
3.5.3 Nov 07, 2016
3.5.2 Nov 01, 2016
3.5.1 Oct 21, 2016
3.5.0 Oct 20, 2016
3.4.7 Sep 21, 2016
3.4.6 Aug 23, 2016
3.4.5 Aug 19, 2016
3.4.4 Aug 12, 2016
3.4.3 Aug 05, 2016
3.4.2 Aug 05, 2016
3.4.1 Jul 28, 2016
3.4.0 Jul 14, 2016
3.3.3 Mar 14, 2016
3.3.2 Dec 14, 2015
3.3.1 Nov 04, 2015
3.3.0 Oct 28, 2015
3.2.5 Oct 27, 2015
3.2.4 Sep 22, 2015
3.2.3 Aug 24, 2015
3.2.2 Aug 13, 2015
3.2.1 Aug 09, 2015
3.2.0 Aug 06, 2015
3.1.3 Jun 04, 2015
3.1.2 May 14, 2015
3.1.1 Mar 23, 2015
3.1.0 Mar 06, 2015
3.0.5 Feb 10, 2015
3.0.4 Jan 27, 2015
3.0.3 Jan 10, 2015
3.0.2 Dec 17, 2014
3.0.1 Dec 11, 2014
3.0.0 Dec 01, 2014
2.4.8 Aug 21, 2015
2.4.6 Jul 08, 2015
2.4.5 Apr 22, 2015
2.4.4 Nov 03, 2014
2.4.3 Sep 19, 2014
2.4.2 Sep 03, 2014
2.4.1 Sep 01, 2014
2.4.0 Aug 29, 2014
2.3.14 Jun 12, 2014
2.3.13 Mar 06, 2014
2.3.12 Jan 15, 2014
2.3.11 Jan 14, 2014
2.3.10 Dec 06, 2013
2.3.9 Nov 18, 2013
2.3.8 Sep 11, 2013
2.3.7 Aug 16, 2013
2.3.6 Jun 27, 2013
2.3.5 Jun 03, 2013
2.3.4 May 24, 2013
2.3.3 May 16, 2013
2.3.2 May 08, 2013
2.3.1 May 07, 2013
2.3.0 May 07, 2013
2.2.7 Apr 17, 2013
2.2.6 Apr 04, 2013
2.2.5 Mar 26, 2013
2.2.4 Mar 13, 2013
2.2.3 Mar 07, 2013
2.2.2 Mar 06, 2013
2.2.1 Feb 23, 2013
2.2.0 Feb 13, 2013
2.1.17 Jan 26, 2013
2.1.16 Jan 14, 2013
2.1.15 Jan 03, 2013
2.1.14 Dec 31, 2012
2.1.13 Dec 28, 2012
2.1.12 Dec 21, 2012
2.1.11 Dec 17, 2012
2.1.10 Dec 17, 2012
2.1.9 Dec 11, 2012
2.1.8 Dec 08, 2012
2.1.7 Dec 07, 2012
2.1.6 Nov 23, 2012
2.1.5 Nov 23, 2012
2.1.4 Nov 22, 2012
2.1.3 Nov 16, 2012
2.1.2 Nov 09, 2012
2.1.1 Nov 07, 2012
2.1.0 Nov 05, 2012
2.0.2 Nov 02, 2012
2.0.1 Nov 01, 2012
2.0.0 Oct 30, 2012
0.4.0 Aug 29, 2012
0.3.3 Feb 20, 2012
0.3.2 Jan 28, 2012
0.3.1 Jan 04, 2012
0.3.0 Dec 29, 2011
0.2.4 Dec 12, 2011
0.2.3 Jun 14, 2011
0.2.2 Jun 12, 2011
0.2.1 Jun 07, 2011
0.2.0 Jun 02, 2011
0.1.1 Jun 02, 2011
0.1 Feb 21, 2011
Extras: None
Dependencies:
django (>=4.2)