APIs / Go Modules / Search Go packages

Go Modules: Search Go packages

Go packages on pkg.go.dev matching a query, with module, version, synopsis and how many packages and modules import them.

GET /v1/go-modules/search

Parameters

Send parameters in the query string.

ParameterTypeRequiredAllowed values
querystringRequiredUp to 200 characters
Words to match in package paths and documentation.
limitintegerOptionalAny
Results to return, 1 to 100. Default 20.
page_tokenstringOptionalUp to 512 characters
next_page_token from the previous response, for the next page.

Example request

Go Modules
GET/v1/go-modules/search?query=yaml&limit=10
{
  "success": true,
  "data": {
    "total": 1000,
    "has_more": true,
    "next_page_token": "bf219618e419755eaba216f67d3dd243",
    "count": 10,
    "items": [
      {
        "package": "gopkg.in/yaml.v2",
        "module": "gopkg.in/yaml.v2",
        "version": "v2.4.0",
        "synopsis": "Package yaml implements YAML support for the Go language.",
        "imported_by_packages": 60161,
        "imported_by_modules": 43006,
        "url": "https://pkg.go.dev/gopkg.in/yaml.v2"
      },
      {
        "package": "gopkg.in/yaml.v3",
        "module": "gopkg.in/yaml.v3",
        "version": "v3.0.1",
        "synopsis": "Package yaml implements YAML support for the Go language.",
        "imported_by_packages": 44731,
        "imported_by_modules": 42641,
        "url": "https://pkg.go.dev/gopkg.in/yaml.v3"
      },
      {
        "package": "sigs.k8s.io/yaml",
        "module": "sigs.k8s.io/yaml",
        "version": "v1.6.0",
        "imported_by_packages": 12078,
        "imported_by_modules": 6258,
        "url": "https://pkg.go.dev/sigs.k8s.io/yaml"
      }
    ]
  },
  "meta": {
    "request_id": "req_4f669232d0204d1e95c977e643e9bf88",
    "credits_charged": 1,
    "credits_remaining": 457
  }
}
200 OKJSONX-Credits-Used: 1
Recorded from our API and shortened.

Run this endpoint in the playground with your own parameters. 1 credit per successful call; failed calls are free.

Response fields

Each item in data.items has these 7 fields, read from a recorded call. The recording leaves out fields that were empty, so a live call can return more.

FieldType
packagestring
modulestring
versionstring
synopsisstring
imported_by_packagesinteger
imported_by_modulesinteger
urlurl