# CTAN API
> The TeX and LaTeX package ecosystem — CTAN, the Comprehensive TeX Archive Network — as an API. Look up any of CTAN's ~6,900 packages for its caption and description, latest version and date, license, authors (with resolved names), aliases, topics, home and repository links, and whether it ships with MiKTeX and TeX Live; search the whole registry by name and caption; and resolve any CTAN author id to a name. Covers the TeX/LaTeX world from PGF/TikZ, Beamer and KOMA-Script to amsmath, biblatex and listings. Live from the official CTAN JSON API. Ideal for LaTeX editors and tooling, package dashboards, academic-publishing pipelines and TeX ecosystem analytics. Open data from CTAN.

## 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/ctan-api/..."
```

## Pricing
- **Free** (Free) — 3,500 calls/Mo, 2 req/s
- **Starter** ($4/Mo) — 47,500 calls/Mo, 8 req/s
- **Pro** ($13/Mo) — 234,000 calls/Mo, 20 req/s
- **Mega** ($33/Mo) — 1,185,000 calls/Mo, 50 req/s

## Endpoints

### CTAN

#### `GET /v1/author` — Resolve a CTAN author id to a name

**Parameters:**
- `id` (query, required, string) — CTAN author id, e.g. knuth Example: `knuth`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/ctan-api/v1/author?id=knuth"
```

**Response:**
```json
{
    "data": {
        "author": {
            "id": "knuth",
            "name": "Donald E. Knuth",
            "ctan_url": "https://ctan.org/author/knuth"
        }
    },
    "meta": {
        "timestamp": "2026-05-31T13:03:59.179Z",
        "request_id": "8a7df902-cf6c-48b3-8db4-800f160f26cc"
    },
    "status": "ok",
    "message": "Author retrieved",
    "success": true
}
```

#### `GET /v1/package` — Package detail (caption, version, license, authors, topics)

**Parameters:**
- `name` (query, required, string) — CTAN package name, e.g. pgf Example: `pgf`

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

**Response:**
```json
{
    "data": {
        "package": {
            "id": "pgf",
            "home": null,
            "name": "pgf",
            "topics": [
                "graphics-in-tex",
                "graphics",
                "pgf-tikz",
                "tagged-pdf-partially"
            ],
            "aliases": [
                {
                    "id": "tikz",
                    "name": "TikZ"
                }
            ],
            "authors": [
                {
                    "id": "pgf",
                    "name": "The PGF/TikZ Team",
                    "active": true
                },
                {
                    "id": "feuersaenger",
                    "name": "Christian Feuersänger",
                    "active": true
                },
                {
                    "id": "tantau",
                    "name": "Till Tantau",
                    "active": true
                },
                {
                    "id": "menke",
                    "name": "Henri Menke",
                    "active": true
                }
            ],
            "caption": "Create PostScript and PDF graphics in TeX",
            "license": [
                "gpl2",
                "fdl",
                "lppl1.3c"
            ],
            "version": {
                "date": "2025-08-29",
                "number": "3.1.11a"
            },
            "ctan_url": "https://ctan.org/pkg/pgf",
            "ctan_path": "/graphics/pgf/base",
            "o
…(truncated, see openapi.json for full schema)
```

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

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

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

**Response:**
```json
{
    "data": {
        "count": 20,
        "query": "graphics",
        "total": 74,
        "results": [
            {
                "key": "graphics",
                "name": "graphics",
                "caption": "Standard LaTeX graphics",
                "ctan_url": "https://ctan.org/pkg/graphics"
            },
            {
                "key": "graphics-cfg",
                "name": "graphics-cfg",
                "caption": "Sample configuration files for LaTeX color and graphics",
                "ctan_url": "https://ctan.org/pkg/graphics-cfg"
            },
            {
                "key": "graphics-def",
                "name": "graphics-def",
                "caption": "Colour and graphics option files",
                "ctan_url": "https://ctan.org/pkg/graphics-def"
            },
            {
                "key": "graphics-pln",
                "name": "graphics-pln",
                "caption": "LaTeX-style graphics for Plain TeX users",
                "ctan_url": "https://ctan.org/pkg/graphics-pln"
            },
            {
                "key": "graphicscache",
                "name": "graphicscache",
                "caption": "Cache includegraphics calls",
                "ctan_url": "https://ctan.org/pkg/graphicscache"
            },
            {
                "key": "combinedgraphics",
                "name": "combinedgraphics",
                "caption": "Include graphic (EPS or PDF)/LaTeX combinations",
                "ctan_url": "h
…(truncated, see openapi.json for full schema)
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "note": "TeX/LaTeX packages from CTAN. /v1/package = live detail (caption, description, version, license, resolved authors, topics, MiKTeX/TeX Live availability); /v1/search = search the bundled index by name and caption; /v1/author = resolve a CTAN author id to a name.",
        "source": "CTAN — the Comprehensive TeX Archive Network (the TeX / LaTeX package registry)",
        "endpoints": [
            "/v1/package",
            "/v1/search",
            "/v1/author",
            "/v1/meta"
        ],
        "total_authors": 3152,
        "total_packages": 6969
    },
    "meta": {
        "timestamp": "2026-05-31T13:03:59.470Z",
        "request_id": "f0b2e68c-3da0-49f0-a60a-a97f05d80ef8"
    },
    "status": "ok",
    "message": "Meta retrieved",
    "success": true
}
```


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