CTAN API
Read LaTeX package metadata from CTAN as JSON: authors, licence, version, documentation links and descriptions. No API key. Verified example and parsing notes.
Endpoint tested and returned HTTP 200 on 2026-08-21
What is the CTAN API?
CTAN, the Comprehensive TeX Archive Network, publishes package metadata as JSON. `GET https://ctan.org/json/2.0/pkg/{id}` returns a LaTeX package's caption, authors, copyright, licence, version and documentation links. No API key is required.
CTAN has catalogued the TeX world since 1992, and the JSON 2.0 endpoints are a modern face on that archive. For anyone building LaTeX tooling, a documentation site or a package browser, this is the authoritative source for what a package is, who maintains it and which licence it carries, all keyed by the package id you already type in `\usepackage`.
The descriptions are the part to plan for. `descriptions[].text` is not plain text: it is the archive's own XML-flavoured markup, including `<ref refid="...">` cross-references to other CTAN packages and `<tt>` for code. Those refids are genuinely useful for building a link graph between packages, but they must be transformed rather than printed. Documentation hrefs are equally non-standard, using a `ctan:/` pseudo-scheme that you resolve against a CTAN mirror rather than fetching directly.
Quick facts
- Base URL
https://ctan.org/json/2.0- Authentication
- No key or account. Please use a mirror for bulk downloads rather than hammering the main site.
- Rate limit
- Not published. Package metadata changes rarely, so cache per package id.
- Pricing
- Free.
- CORS
- Not enabled — call it from your server
- Official docs
- Read the docs
How to use the CTAN API
Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.
1. Fetch metadata for a LaTeX package
GET https://ctan.org/json/2.0/pkg/graphicx
curl 'https://ctan.org/json/2.0/pkg/graphicx'const res = await fetch("https://ctan.org/json/2.0/pkg/graphicx");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://ctan.org/json/2.0/pkg/graphicx", timeout=20)
res.raise_for_status()
print(res.json()){
"id": "graphicx",
"name": "graphicx",
"aliases": [],
"caption": "Enhanced support for graphics",
"authors": [
{
"id": "latex",
"active": true
},
{
"id": "carlisle",
"active": true
}
],
"copyright": [
{
"owner": "David Carlisle, Sebastian Rahtz",
"year": "1994"
},
{
"owner": "David Carlisle, LaTeX3 Project",
"year": "1995-2021"
}
],
"license": "lppl1.3c",
"version": {
"number": "1.2e",
"date": "2026-05-17"
},
"descriptions": [
{
"language": null,
"text": "<p>\n The package builds upon the <ref refid=\"graphics\">graphics</ref>\n package, providing a key-value interface for optional arguments\n to the <tt>\\includegraphics</tt> command. This interface provides\n facilities that go far beyond what the\n <ref refid=\"graphics\">graphics</ref> package offers on its own.\n </p>\n <p>\n For extended documentation, see\n <ref refid=\"epslatex\">epslatex</ref>.\n </p>\n <p>\n The package is part of the\n <ref refid=\"latex-graphics\">latex-graphics</ref> bundle,\n which is one of the collections in the\n <ref refid=\"required\">LaTeX <q>required</q>\n </ref>\n set of packages.\n </p>"
}
],
"documentation": [
{
"language": "en",
"details": "Guide to graphics in LaTeX (English)",
"href": "ctan:/macros/latex/required/graphics/grfguide.pdf"
},
{
"language": "it",
"details": "Guide to graphics in LaTeX (Italian)",
"href": "ctan:/infParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
{id} | path | Required | CTAN package id, which is the name you use in `\usepackage`. graphicx |
/json/2.0/packages | path | Optional | Endpoint listing every package id and name in the archive. /json/2.0/packages |
/json/2.0/author/{id} | path | Optional | Author record, referenced by the `authors[].id` values in a package response. carlisle |
Response fields
id / namestring- Package identifier and display name. The id is what you pass to other endpoints.
captionstring- One-line description, safe to display as-is. This is the plain-text field; `descriptions` is not.
authorsarray- Author references as `{id, active}`. Only the id is present, so resolve it against the author endpoint to get a name.
copyrightarray- Copyright statements as `{owner, year}` pairs. `year` is a string and may be a range such as `1995-2021`.
licensestring- Licence key in CTAN's own vocabulary, such as `lppl1.3c`. Not an SPDX identifier.
versionobject- `number` and `date` of the current release. The date is an ISO date string.
descriptionsarray- Long descriptions in CTAN's XML-flavoured markup, including `<ref refid="...">` cross-references. Transform before rendering; do not print raw.
documentationarray- Documentation links as `{language, details, href}`. Hrefs often use a `ctan:/` pseudo-scheme that must be resolved against a mirror.
What you can build with the CTAN API
- Build a searchable LaTeX package browser or documentation portal
- Check the licence of every package a thesis template depends on
- Resolve `\usepackage` names to authors and documentation links inside an editor plugin
- Detect unmaintained packages by inspecting version dates and author `active` flags
- Construct a dependency or cross-reference graph from the `refid` links in descriptions
Common errors and how to fix them
404
The package id does not exist. Ids are not always the same as the display name.
Fix: Fetch `/json/2.0/packages` and match against it, or check the package page on ctan.org.
Markup rendered literally
`descriptions[].text` contains CTAN's own tags, not HTML.
Fix: Convert `<ref refid="x">` into your own links and strip or map the remaining tags before display.
Broken documentation links
Hrefs may use the `ctan:/` pseudo-scheme rather than an absolute URL.
Fix: Prefix `ctan:/` paths with a CTAN mirror base URL such as `https://mirrors.ctan.org`.
CTAN API — frequently asked questions
Is the CTAN API free?
Yes, with no key or account. CTAN asks that bulk downloads go through a mirror rather than the primary site.
How do I get an author's name?
Package responses only give author ids. Resolve each id against `/json/2.0/author/{id}` to get the full name and details.
Is the licence field SPDX?
No. CTAN uses its own licence keys such as `lppl1.3c`. Map them to SPDX yourself if you are feeding a standard licence scanner.
Can I list every package?
Yes, `/json/2.0/packages` returns the full index of ids and names, which is the right starting point for building a local mirror of the catalogue.
Tools that pair with this API
JSON Formatter
Format, beautify and minify JSON online with 2-space, 4-space or tab indentation. Sort keys alphabetically and catch syntax errors instantly — free and private.
JSON Viewer
View JSON as a collapsible interactive tree online. Expand and collapse nodes, search keys and values, and copy the JSONPath of any node privately.
Strip HTML Tags
Remove all HTML tags and convert markup to clean plain text. Decode HTML entities and keep line breaks for block elements like paragraphs and headings.
XML to JSON Converter
Convert XML to JSON online. Elements become objects, attributes are prefixed with @, text is preserved, and parse errors are reported clearly — in-browser.
CTAN is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.