The Browsable API in Django REST Framework (DRF) provides a powerful web-based interface that allows developers to explore, test, and debug API endpoints directly from the browser without additional tools.
The Browsable API is enabled by default when using DRF during development. When accessing any API endpoint via a browser, DRF renders an HTML interface instead of raw JSON.
// Accessing the browsable API endpoint
http://localhost:8000/books/
// Basic API test using APITestCase
from rest_framework.test import APITestCase
from rest_framework import status
class BookTests(APITestCase):
def test_create_book(self):
response = self.client.post("/api/books/", {
"title": "Test Book",
"author": "Author",
"price": "19.99"
}, format="json")
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
The response returned by the API is rendered both as JSON and as a form-based UI in the browser, allowing developers to instantly validate request and response behavior.
Use the simulator below to experience how the Browsable API works. Select a method (GET or POST) and click send to see the response.