# CPAN API
> The Perl package ecosystem — CPAN, the Comprehensive Perl Archive Network — as an API. Look up any distribution for its abstract, latest version, author, license, homepage / repository / bug-tracker links, runtime dependencies and download URL; find which distribution provides a given Perl module (e.g. JSON::PP, LWP::UserAgent); read a distribution's full release history with dates; and search the entire CPAN registry by keyword. Covers the Perl ecosystem from Mojolicious, Moose, DBI and Catalyst to JSON, Plack and the Dancer framework. Live from the official MetaCPAN API. Ideal for package dashboards, dependency and supply-chain tooling, Perl developer portals and CPAN ecosystem analytics. Open data from CPAN.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/cpan-api/..."
```

## Pricing
- **Free** (Free) — 3,520 calls/Mo, 2 req/s
- **Starter** ($4/Mo) — 48,200 calls/Mo, 8 req/s
- **Pro** ($13/Mo) — 237,000 calls/Mo, 20 req/s
- **Mega** ($34/Mo) — 1,190,000 calls/Mo, 50 req/s

## Endpoints

### CPAN

#### `GET /v1/distribution` — Distribution metadata + dependencies

**Parameters:**
- `name` (query, required, string) — Distribution name, e.g. Mojolicious Example: `Mojolicious`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/cpan-api/v1/distribution?name=Mojolicious"
```

**Response:**
```json
{
    "data": {
        "distribution": {
            "date": "2026-05-05T18:34:01",
            "name": "Mojolicious",
            "author": "SRI",
            "status": "latest",
            "license": [
                "artistic_2"
            ],
            "version": "9.45",
            "abstract": "Real-time web framework",
            "maturity": "released",
            "resources": {
                "homepage": "https://mojolicious.org",
                "bugtracker": "https://github.com/mojolicious/mojo/issues",
                "repository": "https://github.com/mojolicious/mojo.git"
            },
            "download_url": "https://cpan.metacpan.org/authors/id/S/SR/SRI/Mojolicious-9.45.tar.gz",
            "metacpan_url": "https://metacpan.org/release/Mojolicious",
            "dependency_count": 5,
            "runtime_dependencies": [
                {
                    "module": "Sub::Util",
                    "version": "1.41"
                },
                {
                    "module": "perl",
                    "version": "5.016"
                },
                {
                    "module": "IO::Socket::IP",
                    "version": "0.37"
                }
            ]
        }
    },
    "meta": {
        "timestamp": "2026-05-31T12:54:31.576Z",
        "request_id": "6a4c6d37-b02e-489a-9036-fda6aa23060b"
    },
    "status": "ok",
    "message": "Distribution retrieved",
    "success": true
}
```

#### `GET /v1/module` — Which distribution provides a module

**Parameters:**
- `name` (query, required, string) — Perl module name, e.g. Moose or JSON::PP Example: `Moose`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/cpan-api/v1/module?name=Moose"
```

**Response:**
```json
{
    "data": {
        "module": {
            "date": "2025-07-04T21:24:15",
            "name": "Moose",
            "author": "ETHER",
            "release": "Moose-2.4000",
            "version": "2.4000",
            "abstract": "A postmodern object system for Perl 5",
            "distribution": "Moose",
            "metacpan_url": "https://metacpan.org/pod/Moose"
        }
    },
    "meta": {
        "timestamp": "2026-05-31T12:54:31.769Z",
        "request_id": "cdd6d3c4-c9fa-4b73-baaf-efe1ab2a74e2"
    },
    "status": "ok",
    "message": "Module retrieved",
    "success": true
}
```

#### `GET /v1/releases` — Release history of a distribution

**Parameters:**
- `name` (query, required, string) — Distribution name, e.g. Mojolicious Example: `Mojolicious`
- `limit` (query, optional, string) — Max releases (1-100, default 25)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/cpan-api/v1/releases?name=Mojolicious"
```

**Response:**
```json
{
    "data": {
        "count": 25,
        "total": 755,
        "releases": [
            {
                "date": "2026-05-05T18:34:01",
                "author": "SRI",
                "status": "latest",
                "version": "9.45"
            },
            {
                "date": "2026-05-05T18:10:38",
                "author": "SRI",
                "status": "cpan",
                "version": "9.44"
            },
            {
                "date": "2026-05-04T17:44:08",
                "author": "SRI",
                "status": "cpan",
                "version": "9.43"
            },
            {
                "date": "2025-10-01T14:47:16",
                "author": "SRI",
                "status": "cpan",
                "version": "9.42"
            },
            {
                "date": "2025-07-03T12:27:43",
                "author": "SRI",
                "status": "cpan",
                "version": "9.41"
            },
            {
                "date": "2025-05-12T13:09:01",
                "author": "SRI",
                "status": "cpan",
                "version": "9.40"
            },
            {
                "date": "2024-11-23T14:16:18",
                "author": "SRI",
                "status": "cpan",
                "version": "9.39"
            },
            {
                "date": "2024-08-17T14:52:48",
                "author": "SRI",
                "status": "cpan",
                "version": "9.38"
            },
 
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/search` — Search the CPAN registry

**Parameters:**
- `q` (query, required, string) — Search term Example: `JSON`
- `limit` (query, optional, string) — Results (1-100, default 20)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/cpan-api/v1/search?q=JSON"
```

**Response:**
```json
{
    "data": {
        "count": 20,
        "query": "JSON",
        "results": [
            {
                "name": "JSON",
                "score": 15.940096,
                "author": "ISHIGAKI",
                "version": "4.11",
                "abstract": "JSON (JavaScript Object Notation) encoder/decoder",
                "metacpan_url": "https://metacpan.org/release/JSON"
            },
            {
                "name": "SPVM-JSON",
                "score": 12.457367,
                "author": "KIMOTO",
                "version": "1.003",
                "abstract": "JSON",
                "metacpan_url": "https://metacpan.org/release/SPVM-JSON"
            },
            {
                "name": "JSON-TinyValidatorV4",
                "score": 8.84754,
                "author": "MILA",
                "version": "0.003",
                "abstract": "JSON Validator for v4 JSON Schema",
                "metacpan_url": "https://metacpan.org/release/JSON-TinyValidatorV4"
            },
            {
                "name": "JSON-Create",
                "score": 8.7672205,
                "author": "BKB",
                "version": "0.36",
                "abstract": "Create JSON",
                "metacpan_url": "https://metacpan.org/release/JSON-Create"
            },
            {
                "name": "App-jt",
                "score": 8.7672205,
                "author": "GUGOD",
                "version": "0.43",
                "abstract": "JSON transfo
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Source & options

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/cpan-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "note": "Live CPAN registry data. /v1/distribution = latest release metadata (abstract, author, license, resources, runtime dependencies, download URL); /v1/module = which distribution provides a Perl module; /v1/releases = release history of a distribution; /v1/search = search the registry. Distribution names use hyphens (Mojolicious, libwww-perl); module names use :: (Moose, JSON::PP).",
        "source": "CPAN — the Comprehensive Perl Archive Network (via the MetaCPAN API)",
        "endpoints": [
            "/v1/distribution",
            "/v1/module",
            "/v1/releases",
            "/v1/search",
            "/v1/meta"
        ]
    },
    "meta": {
        "timestamp": "2026-05-31T12:54:32.201Z",
        "request_id": "e0eb6340-dccd-4d2d-baac-227e8d5b82f7"
    },
    "status": "ok",
    "message": "Meta retrieved",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/cpan-api
OpenAPI spec: https://www.oanor.com/api/cpan-api/openapi.json
