pkg.go.dev now has a real API — stop scraping docs
The pkgsite HTTP API is GET-only and precision-first — ambiguous module paths fail instead of guessing.
pkg.go.dev now has a real API — stop scraping docs
If your tool scrapes package pages for module metadata, you are on borrowed time. pkgsite shipped a programmatic surface under /v1beta for package, module, versions, symbols, search, importers, and vulns.
Design choice that matters
The website can “pick the longest module path” when a package path is ambiguous. The API refuses to guess: it returns candidates and makes the client be explicit. That is annoying for one-liners and correct for agents and IDEs.
Practical shape
- Stateless GET endpoints — cache-friendly.
- Optional
version=for tags ormain/master(resolved to a pseudo-version). - Reference client:
pkgsite-cli(CLI not frozen; API aims for compatibility).
What to do with it
Wire discovery and “what imports this?” into CI or agent context packs from structured JSON, not HTML. Precision over convenience is the right default when a wrong module path wastes a whole agent run.
Background: go.dev/blog/pkgsite-api.