---
title: "Go Modules API: Go package search as JSON | Perceptlayer"
description: "Go Modules API for Go package search with import counts, a module's latest version with VCS origin and licences, and its version list as JSON."
url: https://perceptlayer.com/apis/go-modules
---

[APIs](https://perceptlayer.com/apis) / [Apps and media](https://perceptlayer.com/verticals/apps) / Go Modules

1 credit per call 3 endpoints 

# Go Modules API

Go Modules API for Go package search with import counts, a module's latest version with VCS origin and licences, and its version list as JSON.

[Get a free API key](https://perceptlayer.com/signup) Run it below

Go Modules

GET /v1/go-modules/module-latest?module=github.com%2Fgin-gonic%2Fgin 

```
{
  "success": true,
  "data": {
    "module": "github.com/gin-gonic/gin",
    "version": "v1.12.0",
    "published_at": "2026-02-28T10:10:09Z",
    "origin": {
      "vcs": "git",
      "url": "https://github.com/gin-gonic/gin",
      "ref": "refs/tags/v1.12.0",
      "hash": "73726dc606796a025971fe451f0aa6f1b9b847f6"
    },
    "repo_url": "https://github.com/gin-gonic/gin",
    "deprecated": false,
    "retracted": false,
    "licenses": [
      "MIT"
    ],
    "redistributable": true,
    "has_go_mod": true,
    "url": "https://pkg.go.dev/github.com/gin-gonic/gin"
  },
  "meta": {
    "request_id": "req_e3297318cb05405da38d6e7cf9b845cd",
    "credits_charged": 1,
    "credits_remaining": 491
  }
}
```

200 OK JSON X-Credits-Used: 1

Recorded from our API and shortened.

Playground

## Run this API

cURL shell 

```
curl "https://api.perceptlayer.com/v1/go-modules/module-latest?module=github.com%2Fgin-gonic%2Fgin" \
  -H "X-API-Key: $API_KEY"
```

Go Modules · 3 endpoints

## Endpoints

Every endpoint takes the same key. Open one for its parameters, the fields it returns and an example request.

| Endpoint | Required parameters | Returns | Cost |
| --- | --- | --- | --- |
| [GET `/v1/go-modules/module-latest`](https://perceptlayer.com/apis/go-modules/module-latest) | `module` | `module` `version` `published_at` `origin` `repo_url` `deprecated` +5 more | 1 credit |
| [GET `/v1/go-modules/module-versions`](https://perceptlayer.com/apis/go-modules/module-versions) | `module` +3 optional | `version` `published_at` `retracted` `url` | 1 credit |
| [GET `/v1/go-modules/search`](https://perceptlayer.com/apis/go-modules/search) | `query` +2 optional | `package` `module` `version` `synopsis` `imported_by_packages` `imported_by_modules` +1 more | 1 credit |

Overview

## About the Go Modules API

## What you can get

The Go Modules API returns Go module data from the Go module mirror and pkg.go.dev as JSON through 3 endpoints.

-   **Search:** `search` takes a `query` (words in package paths and documentation), with `limit` (1 to 100, default 20) and `page_token`.
-   **Latest version:** `module-latest` takes a `module` path, for example github.com/gin-gonic/gin.
-   **Versions:** `module-versions` takes a `module` path, with `prerelease` (false to leave out pre-releases; default true), `page` and `per_page` (1 to 100, default 20). Versions come highest first. Major versions 2 and up are separate modules (…/v2).

The recorded `search` for "yaml" returned packages with `package`, `module`, `version`, `synopsis`, `imported_by_packages`, `imported_by_modules` and `url`. The first was gopkg.in/yaml.v2 at v2.4.0, imported by 60,161 packages in 43,006 modules.

The recorded `module-latest` for github.com/gin-gonic/gin returned `version` v1.12.0 with `published_at`, an `origin` with `vcs`, `url`, `ref` and commit `hash`, `repo_url`, `licenses` (MIT), `redistributable`, `has_go_mod`, `deprecated` and `retracted`. The recorded `module-versions` call for the same module found 28 versions ( `total`), each with `version`, `published_at`, `retracted` and `url`.

## How a call works

Search, then check a module: `GET /v1/go-modules/search?query=yaml&limit=10` with your key in the `X-API-Key` header returns each package's `module`, which `module-latest` and `module-versions` take, for example `GET /v1/go-modules/module-latest?module=github.com/gin-gonic/gin`. Module paths keep their capitals; the gateway encodes them for the mirror. To page search results, pass `next_page_token` back as `page_token` while `has_more` is true. Answers come from a cache for up to an hour. Every successful call costs 1 credit; failed calls cost nothing.

Apps and media JSON REST MCP

### More apps and media APIs

[Apple App Store](https://perceptlayer.com/apis/apple-app-store) [Apple Podcasts](https://perceptlayer.com/apis/apple-podcasts) [arXiv](https://perceptlayer.com/apis/arxiv) [Audible](https://perceptlayer.com/apis/audible) [Bandcamp](https://perceptlayer.com/apis/bandcamp) [Chrome Web Store](https://perceptlayer.com/apis/chrome-web-store) [CISA KEV](https://perceptlayer.com/apis/cisa-kev) [ClinicalTrials.gov](https://perceptlayer.com/apis/clinicaltrials) [Coursera](https://perceptlayer.com/apis/coursera) [crates.io](https://perceptlayer.com/apis/crates-io) [Crossref](https://perceptlayer.com/apis/crossref) [Discogs](https://perceptlayer.com/apis/discogs)

Use cases

### Let a coding agent check a module's latest version before editing \`go.mod\`

`` Use the Go Modules API to let a coding agent check a module's latest version before editing `go.mod` `` 

### Flag deprecated modules and retracted versions in a dependency list

`Use the Go Modules API to flag deprecated modules and retracted versions in a dependency list` 

### Rank packages for a job by how many packages and modules import them

`Use the Go Modules API to rank packages for a job by how many packages and modules import them` 

### Check a module's licence and whether pkg.go.dev marks it \`redistributable\`

`` Use the Go Modules API to check a module's licence and whether pkg.go.dev marks it `redistributable` `` 

FAQ

## Questions

**Is this the official Go Modules API?**

No. Perceptlayer is an independent service and is not affiliated with Google or the Go project. The Go module mirror (proxy.golang.org) and pkg.go.dev, the official sources, are free to call directly, without a key, under Google's terms. This API calls them on your behalf and adds one key for every source on Perceptlayer, mirror and pkg.go.dev data merged into one response shape, a cache of up to an hour, and no charge for failed calls.

**Where does each field come from?**

Versions and the VCS \`origin\` come from the Go module mirror; publish dates, deprecation, retraction, licences, import counts and search come from pkg.go.dev.

**Why doesn't \`module-versions\` show v2 and later?**

In Go, major version 2 and above is a separate module with its own path, such as \`example.com/mod/v2\`. Pass that path to list its versions.

**Does it return a module's dependencies?**

No. These endpoints return versions, origin, licences, status and import counts, not the module's \`go.mod\` requirements.

**Should I build a Go Modules scraper instead?**

You can, but a Go Modules scraper is code you maintain: page changes break it, requests get blocked, and Go Modules's terms govern how you collect data. The Go Modules API gives you 3 endpoints of named JSON fields for 1 credit per successful call, and failed calls cost nothing. A scraper makes sense only for data these endpoints don't return, so check the response in the playground on this page first.

## Try the Go Modules API with 100 free credits

No credit card. Failed calls are never billed.

[Get a free API key](https://perceptlayer.com/signup) [Read the docs](https://docs.perceptlayer.com)
