Redoc Documentation0%

Redoc Documentation

Beginner12 min read•Updated: Jul 11, 2026
Study MaterialsCheatsheet

Redoc Interactive Documentation Generation

While Swagger UI is renowned for interactive "Try it out" testing, Redoc provides a cleaner, highly readable, three-column layout inspired by modern developer documentation (such as Stripe and Twilio).


1. Redoc vs Swagger UI

FeatureSwagger UIRedoc
LayoutSingle-column accordion listClean 3-column responsive layout (Navigation / Content / Code samples)
Interactive "Try It Out"Built-in browser HTTP executionView-only (or requires third-party plugins)
Search & FilteringBasic string filterFast fuzzy search with deep linking
Visual PolishFunctional, utility-focusedElegant, publication-ready for external developers

In professional production architectures, exposing both /api/docs/swagger/ (for internal testing) and /api/docs/redoc/ (for external partners and client developers) is best practice.


2. Redoc Endpoint Configuration

Configuring Redoc with drf-spectacular is straightforward:

Python
# config/urls.py
from django.urls import path
from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView
 
urlpatterns = [
path('api/schema/', SpectacularAPIView.as_view(), name='schema'),
path('api/docs/redoc/', SpectacularRedocView.as_view(url_name='schema'), name='redoc'),
]

3. Customizing Redoc Appearance and Metadata

You can customize the Redoc interface through SPECTACULAR_SETTINGS in settings.py:

Python
SPECTACULAR_SETTINGS = {
'TITLE': 'MSK Institute Cloud API',
'DESCRIPTION': '''
# Welcome to MSK Institute API
 
This API provides endpoints for authentication, course enrollment, real-time analytics, and billing.
 
## Authentication
All requests must include an `Authorization: Bearer <token>` header obtained from `/api/v1/auth/token/`.
''',
'VERSION': '2.4.0',
'REDOC_UI_SETTINGS': {
'hideDownloadButton': False,
'expandResponses': '200,201',
'theme': {
'colors': {
'primary': {
'main': '#4F46E5', # Indigo brand color
}
},
'typography': {
'fontFamily': 'Inter, sans-serif',
'headings': {
'fontFamily': 'Poppins, sans-serif',
}
}
}
}
}

Interactive Quiz

Practice Quiz

Question 1
What layout style is characteristic of Redoc documentation?
Question 2
How does SpectacularRedocView obtain the API schema it displays?
Question 3
What is the key functional difference between Swagger UI and Redoc?
Question 4
Where are custom brand colors and fonts configured for Redoc in a DRF project?
Question 5
Can markdown syntax be used inside SPECTACULAR_SETTINGS['DESCRIPTION']?
Next Lesson

Documenting API Endpoints

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Related Lessons

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

PrevNext