List files and documentation paths
Browse files and documentation paths in a package, repository, or documentation site. Use this endpoint when you know the target and want to find something to read. Use grep to find text within its contents, or search to discover documentation by topic.
Start browsing
Send a JSON body to POST /v1/list. This request lists the root of a package:
{"target":"npm:express@5.2.1"}
Package targets list files within that package, including local documentation. A repository target such as github:expressjs/express lists the whole repository snapshot. To browse hosted documentation, use a site: target:
{"target":"site:expressjs.com/en","recursive":true,"limit":100}
Omit paths, or use an empty array, to start at the root. To narrow the selection, pass paths or globs such as {"target":"github:expressjs/express","paths":["lib/**/*.js"]}. Entries matching any selector are included. Directories show their immediate children by default; recursive: true lists files or pages beneath them. Glob depth is determined by the glob itself.
The file_types, languages, and intents filters apply only to source files. For filename extensions, use a path glob. Send all options in the JSON body; query parameters are not accepted. Request bodies can be at most 2 MiB.
Read a result or open a directory
Each entry includes a read action, a browse action, or both as applicable. Use these actions to make the next request:
- For
read, send itstargetand non-nullpathas URL-encoded query parameters toGET /v1/read. Omitpathwhen it is null. - For
browse, send itstargetand non-nullpathsin a newPOST /v1/listbody. Omitpathswhen it is null, and leave outafter.
Copy action values exactly. A displayed path can differ from the path needed to read a file. Preserve the path value, including trailing slashes and any query string, then URL-encode it as one query parameter. Encode literal + as %2B and % as %25; do not decode the action before encoding it. For example, GET /v1/read?target=site%3Aexpressjs.com%2Fen&path=%2F reads the landing page for that site scope. Use the action returned for your selected entry.
Get the next page
limit defaults to 100 and accepts 1–500 entries per page. When has_more is true, repeat the same target, paths, filters, recursion, and limit, adding the returned next_cursor as after. Copy the cursor unchanged. If it is rejected, start again without after.
Site pages can change between requests. Pagination does not freeze their contents or membership; start without after to get a fresh listing. The response does not report a total number of entries.
Check availability and coverage
An empty page does not prove that all content has been indexed. For source files, inspect code_index_state and target_resolution to check availability, freshness, and the version or commit actually returned. For sites, inspect inventory_state, crawl_status, coverage_state, and preparation. Null means unknown or not applicable.
A site selection can combine multiple indexed documentation collections. Crawl and coverage fields are null when there is no single collection summary. The canonical_target may identify the host root even for a narrower request; keep your original selection and use the returned actions.
To wait for source indexing or an empty site’s preparation, set wait_timeout_ms to a value from 0 to 210000 milliseconds. The default, 0, returns without waiting. At the maximum wait, allow up to 240 seconds for the HTTP request. A wait timeout does not stop preparation. Each site’s wait reports an exact status and a summary outcome; use status to distinguish failed from discarded, or superseded from cancelled.
In preparation, selected counts documentation collections, enqueued counts newly queued preparation, and active_jobs lists work already running. A positive repair_limit_reached means some collections still need preparation but were not queued. Narrow the site selection to include fewer collections. A zero value does not guarantee complete coverage.
For RESOURCE_LIMIT errors, choose a target or paths that select fewer documentation collections. If a single collection exceeds the limit, read a known page directly; selecting fewer paths within that collection does not reduce the limit. If a package’s source inventory is unavailable (409 SOURCE_INVENTORY_SCOPE_UNAVAILABLE), the error can include repo_url and commit_sha. A repository target at that commit, such as github:expressjs/express@<commit_sha>, can include files outside the package, so use it only when that broader scope is acceptable.
{
"available_versions": null,
"canonical_target": "site:expressjs.com",
"code_index_state": null,
"coverage_reason": null,
"coverage_state": null,
"crawl_status": null,
"entries": [
{
"browse": null,
"byte_size": null,
"content_hash": null,
"file_type": null,
"intent": null,
"kind": "page",
"language": null,
"line_count": null,
"path": "/",
"read": {
"path": "/",
"target": "site:expressjs.com/en"
},
"title": "Express"
},
{
"browse": {
"paths": [
"5x/"
],
"target": "site:expressjs.com/en"
},
"byte_size": null,
"content_hash": null,
"file_type": null,
"intent": null,
"kind": "directory",
"language": null,
"line_count": null,
"path": "5x/",
"read": null,
"title": null
}
],
"has_more": true,
"indexed_version": null,
"indexing_estimate": null,
"indexing_ref": null,
"indexing_status": null,
"inventory_kind": "site",
"inventory_state": "available",
"next_cursor": "site-cursor +/%",
"preparation": {
"active_jobs": [
{
"mode": "full",
"state": "executing"
}
],
"awaited": [
{
"mode": "full",
"outcome": "timeout",
"status": "timeout"
}
],
"enqueued": 1,
"repair_limit_reached": 1,
"selected": 3
},
"requested_target": "site:expressjs.com/en",
"resolution": null,
"target_resolution": null
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Optional client attribution: trimmed printable ASCII, at most 80 bytes. Invalid optional values are dropped.
Optional client-version attribution: trimmed printable ASCII, at most 80 bytes. Invalid optional values are dropped.
Optional agent attribution: trimmed printable ASCII, at most 160 bytes. Invalid optional values are dropped.
Optional caller-defined session ID: one to 64 ASCII letters, digits, underscores or hyphens, preserved exactly. Supply the header at most once. Invalid supplied IDs return 400 INVALID_SESSION_ID; no session is created.
1 - 64^[A-Za-z0-9_-]{1,64}$Body
Selection for a source or hosted-site inventory page. Unknown and null controls are rejected.
Package, repository, or documentation site to browse, such as npm:express@5.2.1, github:expressjs/express, or site:expressjs.com/en. Must not be blank.
1Opaque continuation. Blank starts page one; preserve a nonblank cursor unchanged and repeat the same selection.
File-type labels for source files, such as config. Up to 64 values; surrounding whitespace is removed and case is ignored. Omit or use [] for no filter. For extensions, use a paths glob.
64Include source files with any listed purpose, such as production or test. Up to 64 values; omit or use [] for no filter.
64Purpose of a source file; inclusion values form a union.
production, test, benchmark, example, generated, fixture, build, vendor Language labels for source files, such as JavaScript. Up to 64 values; surrounding whitespace is removed and case is ignored. Omit or use [] for no filter.
64Maximum entries on this page, 1 through 500; default 100. The response does not report a total across pages.
1 <= x <= 500Paths or globs relative to the target; entries matching any selector are included. Omit or use [] for the root. Up to 1000 nonblank selectors of 2048 UTF-8 bytes each. On sites, / alone selects the root; a leading / on another selector is optional.
1000Default false lists immediate directory children. True expands selected directories to leaves; glob depth is independent.
Time to wait for source indexing or an empty site to become available, 0 through 210000 milliseconds; default 0. At the maximum wait, allow up to 240 seconds for the HTTP request. Preparation may continue after the wait ends.
0 <= x <= 210000Response
One page of paths with read and browse actions and content availability
One page of paths, with actions for reading entries or browsing directories and information about content availability.
Indexed package versions or repository refs for immediate retry; null for sites.
Show child attributes
Show child attributes
Resolved package version, repository commit, or stable site domain root; a sole redirect may retain its scope. Null while unavailable.
Source freshness or preparation state; null for sites.
current, stale, provisional, indexing, pending, failed, not_found, unresolvable Explanation of site coverage, when available for a single documentation collection; otherwise null.
Coverage of a single documentation collection; null for combined collections or source files. An empty entries list does not prove complete coverage.
none, partial, capped, complete Latest crawl state when the selection has a single documentation collection; null for combined collections or source files.
idle, running, complete, failed Files, pages, and directories on this page, in listing order.
Show child attributes
Show child attributes
Whether another inventory page is available.
Served source ref; null for sites or unprepared source.
Source preparation estimate, when known.
Show child attributes
Show child attributes
Opaque active source preparation reference, or null.
Source indexing lifecycle; prefer code_index_state for freshness.
indexed, indexing, pending, failed, not_found, unresolvable Inventory being browsed: source files or hosted documentation.
source, site Whether the hosted site has active pages; null for source inventories.
available, empty Opaque continuation; repeat the same request with this value as after. Site entries can change between requests.
Site preparation counts, active jobs, and wait results; null when not applicable.
Show child attributes
Show child attributes
Target selected for this page. Keep the original request target when continuing.
Source snapshot resolution; null when not applicable or known.
Show child attributes
Show child attributes
Requested, resolved and served source provenance, including retry candidates.
Show child attributes
Show child attributes
{
"available_versions": null,
"canonical_target": "site:expressjs.com",
"code_index_state": null,
"coverage_reason": null,
"coverage_state": null,
"crawl_status": null,
"entries": [
{
"browse": null,
"byte_size": null,
"content_hash": null,
"file_type": null,
"intent": null,
"kind": "page",
"language": null,
"line_count": null,
"path": "/",
"read": {
"path": "/",
"target": "site:expressjs.com/en"
},
"title": "Express"
},
{
"browse": {
"paths": [
"5x/"
],
"target": "site:expressjs.com/en"
},
"byte_size": null,
"content_hash": null,
"file_type": null,
"intent": null,
"kind": "directory",
"language": null,
"line_count": null,
"path": "5x/",
"read": null,
"title": null
}
],
"has_more": true,
"indexed_version": null,
"indexing_estimate": null,
"indexing_ref": null,
"indexing_status": null,
"inventory_kind": "site",
"inventory_state": "available",
"next_cursor": "site-cursor +/%",
"preparation": {
"active_jobs": [
{
"mode": "full",
"state": "executing"
}
],
"awaited": [
{
"mode": "full",
"outcome": "timeout",
"status": "timeout"
}
],
"enqueued": 1,
"repair_limit_reached": 1,
"selected": 3
},
"requested_target": "site:expressjs.com/en",
"resolution": null,
"target_resolution": null
}