Compare two exact source trees
Compare source changes between two package versions or two refs in a public repository. The response lists changed files and can include added and deleted line counts and patches.
Use this experimental endpoint to inspect the code behind a release or upgrade. Comparisons cover the whole repository, including when you identify it through a package.
Selector catalogue
Use the following selectors with the fields query parameter to choose which fields the response includes. See Choose what the response includes for details.
| Selector | Data | Default |
|---|---|---|
files | Identity/status fields and content safety; inventory only | No |
files.stats | Adds nullable additions/deletions; implies files and requests stats | No |
files.patch | Adds nullable patch and omission reason; implies stats and requests patches | Yes |
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Optional trimmed printable ASCII client name, maximum 80 bytes.
Optional trimmed printable ASCII client version, maximum 80 bytes.
Optional trimmed printable ASCII agent attribution, maximum 160 bytes.
Optional session attribution, maximum 128 printable ASCII bytes; malformed values are dropped.
Query Parameters
Finite comma-separated selectors: files, files.stats, and files.patch. The default is files.patch. Dependencies are additive; repeated selector tokens are idempotent. Unknown, empty, leaf, and wildcard selectors, plus repeated fields query parameters, are rejected.
Use the case-sensitive selectors in the catalogue. Order and duplicate selectors do not affect the result. ASCII whitespace around selectors is ignored. The decoded value is limited to 2048 UTF-8 bytes. Empty or unknown selectors and repeated fields query parameters return 400 VALIDATION_ERROR. A group does not include nested groups unless the catalogue says so; only listed wildcard bundles are supported.
2048Body
Compare two package versions or two repository refs.
Explicit base ref, at most 255 UTF-8 bytes.
Base package version or registry-compatible constraint.
Maximum relevance-ranked files returned after filtering.
1 <= x <= 300Total patch-byte budget, used only when files.patch is selected.
1024 <= x <= 2097152Package name; requires registry and both version endpoints.
Repository-relative bounded glob intersected with path_prefix.
Repository-relative component prefix, normalized without edge slashes.
Package registry; requires name and both version endpoints.
npm, pypi, hex, crates, vcpkg, zig, nuget, maven, packagist, rubygems, go, swift Supported credential-free public GitHub, GitLab or Codeberg URL.
Explicit head ref, at most 255 UTF-8 bytes.
Head package version or registry-compatible constraint.
Response
Exact-tree inventory and selected content evidence
Resolved commits, complete inventory counts, and selected file details.
Coverage of optional content for returned files.
not_requested, complete, partial, failed Bounded content-phase failure; null unless content_coverage is failed.
Files in relevance order, limited by max_files; paths that cannot be represented are omitted.
Immutable base-side resolution used by the diff.
Whether additional matching files with representable paths were omitted by max_files.
Canonical package identity; null for repository addressing.
Effective repository inventory scope and caller filters.
Complete caller-filtered repository inventory counts before file projection.
Immutable head-side resolution used by the diff.