readthedocs-redirects-manager
Read the Docs Redirects Manager
Use the Read the Docs API to manage custom redirects for a project.
Required inputs
- RTD host in
RTD_HOST- Community:
https://app.readthedocs.org - Business:
https://app.readthedocs.com
- Community:
- API token available in
RTD_TOKEN(preferred) or provided by the user - Project slug
Redirect model (API v3)
Fields commonly used in redirect requests/responses:
from_url: source path (e.g.,/old-page/)to_url: destination path or URL (e.g.,/new-page/)type: redirect type (e.g.,page,exact,clean_url_to_html,html_to_clean_url)http_status: HTTP status code (commonly301or302)description: optional noteenabled:true/falseforce: apply even if the page exists (availability depends on plan)position: priority order (lower is higher priority)
Common tasks
1) List redirects
GET /api/v3/projects/{slug}/redirects/
curl -s -H "Authorization: Token $RTD_TOKEN" \
"${RTD_HOST}/api/v3/projects/project-slug/redirects/"
2) Create a redirect
POST /api/v3/projects/{slug}/redirects/
curl -s -X POST \
-H "Authorization: Token $RTD_TOKEN" \
-H "Content-Type: application/json" \
"${RTD_HOST}/api/v3/projects/project-slug/redirects/" \
-d '{
"from_url": "/old-page/",
"to_url": "/new-page/",
"type": "page",
"http_status": 301,
"description": "Move old page to new location",
"enabled": true
}'
3) Update a redirect
PUT /api/v3/projects/{slug}/redirects/{id}/
curl -s -X PUT \
-H "Authorization: Token $RTD_TOKEN" \
-H "Content-Type: application/json" \
"${RTD_HOST}/api/v3/projects/project-slug/redirects/123/" \
-d '{
"from_url": "/old-page/",
"to_url": "/new-page/",
"type": "page",
"http_status": 302,
"description": "Temporary redirect during migration",
"enabled": true
}'
4) Delete a redirect
DELETE /api/v3/projects/{slug}/redirects/{id}/
curl -s -X DELETE \
-H "Authorization: Token $RTD_TOKEN" \
"${RTD_HOST}/api/v3/projects/project-slug/redirects/123/"
Notes
- Use
pageredirects for version-agnostic moves andexactfor version/language-specific URLs. - Order matters: earlier rules win when multiple redirects match.
- Do not print or log token values in responses.
Docs
More from readthedocs/skills
readthedocs-search-api
Query the Read the Docs Search API to find documentation across projects and repositories. Use when searching documentation, finding related docs, finding API documentation, or gathering information about projects on Read the Docs.
16readthedocs-api
Full Read the Docs API v3 client guidance. Use when building or updating an API client, generating requests, or answering questions about Read the Docs API v3 endpoints (projects, versions, builds, subprojects, translations, redirects, environment variables, organizations, remote VCS resources, or embed content).
15readthedocs-write-config
Create or update Read the Docs `.readthedocs.yaml` v2 configuration files for Sphinx or MkDocs builds, including build images/tools, dependency installs, formats, custom build jobs/commands, conda environments, submodules, and search settings. Use when a user asks for a Read the Docs config file, YAML changes, or build behavior updates.
13readthedocs-build-failure-triage
Triage Read the Docs build failures using build logs and config context. Use when a build fails, logs need analysis, or you need fix recommendations.
12readthedocs-project-manager
Manage Read the Docs projects via the RTD API. Use when creating projects, listing repos, triggering builds, syncing versions, or checking build status on Read the Docs.
11readthedocs-build-optimization
Optimize Read the Docs build performance and resource usage. Use when Read the Docs builds are slow, timing out, or hitting memory limits, or when users want to speed up builds by adjusting formats, dependencies, conda/mamba usage, or Python API documentation strategy.
7