readthedocs-search-api
Read the Docs Search API
Query the public Read the Docs Search API to find documentation across millions of pages. This API is available on both Community and Business sites; the base URL changes by host.
Step-by-step instructions
1. Make a search request
Set RTD_HOST for your site:
- Community:
https://app.readthedocs.org - Business:
https://app.readthedocs.com
Query the API using:
GET ${RTD_HOST}/api/v3/search/?q={query}&page={page}
Required parameters:
q: Your search query (e.g., "authentication", "API pagination")page: Result page number (default: 1)
Note on scoping: You will generally get better and more consistent results by scoping your query to a specific project. Use fielded search syntax inside q, for example project:{project-slug} your terms.
Examples: project:docs build, project:sphinx configuration.
2. Parse the response
The API returns JSON with this structure:
{
"count": 1234,
"next": "https://readthedocs.org/api/v3/search/?q=query&page=2",
"previous": null,
"results": [
{
"id": "project-name:doc-title",
"project": "project-name",
"version": "latest",
"title": "Documentation Title",
"path": "/en/latest/path/to/page.html",
"domain": "project-name.readthedocs.io",
"highlight": "snippet of matching <mark>text</mark>...",
"blocks": [
{
"id": "section-id",
"title": "Section Title",
"path": "/path#section-id"
}
]
}
]
}
3. Handle pagination
If there are more results, use the next URL to fetch the next page. Continue until next is null.
Examples
Search for authentication documentation
curl "${RTD_HOST}/api/v3/search/?q=authentication"
Search within a specific project
curl "${RTD_HOST}/api/v3/search/?q=project:docs%20authentication"
Project-scoped quick queries
# Sphinx
curl "${RTD_HOST}/api/v3/search/?q=project:sphinx%20configuration"
curl "${RTD_HOST}/api/v3/search/?q=project:sphinx%20autodoc"
# Requests
curl "${RTD_HOST}/api/v3/search/?q=project:requests%20proxies"
curl "${RTD_HOST}/api/v3/search/?q=project:requests%20authentication"
# Read the Docs
curl "${RTD_HOST}/api/v3/search/?q=project:readthedocs%20build"
curl "${RTD_HOST}/api/v3/search/?q=project:readthedocs%20redirects"
Search with pagination
curl "${RTD_HOST}/api/v3/search/?q=API&page=2"
Parse results with Python
import os
import requests
response = requests.get(
f"{os.environ['RTD_HOST']}/api/v3/search/",
params={"q": "REST API"}
)
data = response.json()
for result in data['results']:
print(f"{result['project']}: {result['title']}")
print(f" Domain: {result['domain']}")
print(f" Path: {result['path']}")
Get all paginated results
def search_all(query):
all_results = []
page = 1
while True:
response = requests.get(
f"{os.environ['RTD_HOST']}/api/v3/search/",
params={"q": query, "page": page}
)
data = response.json()
all_results.extend(data['results'])
if not data['next']:
break
page += 1
return all_results
Common edge cases
No authentication required: The Search API is public and does not require API keys or authentication.
Rate limiting: The API applies reasonable rate limits. If you receive HTTP 429, implement exponential backoff.
Private documentation excluded: Only publicly available documentation is searchable. Private projects are not included.
Search delay: The search index updates with a slight delay. New documentation may not appear immediately.
Empty results: If a query returns no results, try simpler keywords or browse the project directly on Read the Docs.
Project scoping recommended: The global index is large and queries can be broad. For most use cases, include a project:{project-slug} filter in q to scope results to the relevant documentation project.
Docs
More from readthedocs/skills
readthedocs-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-redirects-manager
Manage Read the Docs redirects via the RTD API. Use when listing, creating, updating, or deleting custom redirects for a project.
12readthedocs-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