# Hex API
> The Elixir and Erlang package ecosystem — Hex (hex.pm) — as an API. Look up any Hex package for its description, licenses, latest version, GitHub / docs / changelog links, owners and download counts (all-time and recent); read a package's complete release history with publication dates; get a single release's dependency list, Elixir version constraint and build tools; and search the entire Hex registry by keyword. Covers the Elixir/Erlang (BEAM) ecosystem from Phoenix, Ecto and Plug to Jason, Absinthe and Nerves. Live from the official hex.pm API. Ideal for package dashboards, dependency and supply-chain tooling, Elixir developer portals and BEAM ecosystem analytics. Open data from Hex.

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

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

## Endpoints

### Hex

#### `GET /v1/package` — Package metadata + downloads + recent releases

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

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

**Response:**
```json
{
    "data": {
        "package": {
            "name": "phoenix",
            "links": {
                "GitHub": "https://github.com/phoenixframework/phoenix",
                "Changelog": "https://hexdocs.pm/phoenix/changelog.html"
            },
            "owners": [
                {
                    "url": "https://hex.pm/api/users/chrismccord",
                    "username": "chrismccord"
                },
                {
                    "url": "https://hex.pm/api/users/josevalim",
                    "username": "josevalim"
                },
                {
                    "url": "https://hex.pm/api/users/gazler",
                    "username": "gazler"
                },
                {
                    "url": "https://hex.pm/api/users/jeregrine",
                    "username": "jeregrine"
                },
                {
                    "url": "https://hex.pm/api/users/steffend",
                    "username": "steffend"
                }
            ],
            "html_url": "https://hex.pm/packages/phoenix",
            "licenses": [
                "MIT"
            ],
            "downloads": {
                "all": 150117848,
                "day": 17151,
                "week": 279074,
                "recent": 3166740
            },
            "updated_at": "2026-05-06T07:30:27.416322Z",
            "description": "Peace of mind from prototype to production",
            "inserted_at": "2014-04-21T22:38:32.000000Z",
  
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/release` — Single release: dependencies + build info

**Parameters:**
- `name` (query, required, string) — Hex package name, e.g. phoenix Example: `phoenix`
- `version` (query, required, string) — Version, e.g. 1.7.14 Example: `1.7.14`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/hex-api/v1/release?name=phoenix&version=1.7.14"
```

**Response:**
```json
{
    "data": {
        "release": {
            "app": "phoenix",
            "elixir": "~> 1.11",
            "package": "phoenix",
            "version": "1.7.14",
            "checksum": "c7859bc56cc5dfef19ecfc240775dae358cbaa530231118a9e014df392ace61a",
            "has_docs": true,
            "downloads": 5878652,
            "updated_at": "2024-06-18T17:12:38.891007Z",
            "build_tools": [
                "mix"
            ],
            "inserted_at": "2024-06-18T17:12:33.509392Z",
            "dependencies": [
                {
                    "app": "castore",
                    "name": "castore",
                    "optional": false,
                    "requirement": ">= 0.0.0"
                },
                {
                    "app": "jason",
                    "name": "jason",
                    "optional": true,
                    "requirement": "~> 1.0"
                },
                {
                    "app": "phoenix_pubsub",
                    "name": "phoenix_pubsub",
                    "optional": false,
                    "requirement": "~> 2.1"
                },
                {
                    "app": "phoenix_template",
                    "name": "phoenix_template",
                    "optional": false,
                    "requirement": "~> 1.0"
                },
                {
                    "app": "phoenix_view",
                    "name": "phoenix_view",
                    "optional": true,
      
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/releases` — Full release history

**Parameters:**
- `name` (query, required, string) — Hex package name, e.g. ecto Example: `ecto`
- `limit` (query, optional, string) — Max releases (1-500, default 50)

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

**Response:**
```json
{
    "data": {
        "count": 50,
        "total": 192,
        "latest": "3.14.0",
        "package": "ecto",
        "releases": [
            {
                "version": "3.14.0",
                "has_docs": true,
                "inserted_at": "2026-05-19T16:02:40.684729Z"
            },
            {
                "version": "3.13.6",
                "has_docs": true,
                "inserted_at": "2026-05-05T14:28:17.970417Z"
            },
            {
                "version": "3.13.5",
                "has_docs": true,
                "inserted_at": "2025-11-09T08:10:52.139053Z"
            },
            {
                "version": "3.13.4",
                "has_docs": true,
                "inserted_at": "2025-10-24T07:47:26.654057Z"
            },
            {
                "version": "3.13.3",
                "has_docs": true,
                "inserted_at": "2025-09-19T13:08:59.585452Z"
            },
            {
                "version": "3.13.2",
                "has_docs": true,
                "inserted_at": "2025-06-24T10:03:30.127278Z"
            },
            {
                "version": "3.13.1",
                "has_docs": true,
                "inserted_at": "2025-06-19T16:10:05.714214Z"
            },
            {
                "version": "3.13.0",
                "has_docs": true,
                "inserted_at": "2025-06-18T11:35:05.560754Z"
            },
            {
                "version": "3.12.6",
                "has_docs
…(truncated, see openapi.json for full schema)
```

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

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

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

**Response:**
```json
{
    "data": {
        "page": 1,
        "count": 20,
        "query": "json",
        "results": [
            {
                "name": "absinthe_json_scalar",
                "html_url": "https://hex.pm/packages/absinthe_json_scalar",
                "description": "This library provides an easily pluggable JSON scalar type for use with [Absinthe](https://github.com/absinthe-graphql/absinthe), a GraphQL implementation for Elixir. This package wraps the JSON scalar recipe from Absinthe docs.",
                "downloads_all": 43641,
                "latest_version": "0.1.0"
            },
            {
                "name": "absinthe_sorting_codec",
                "html_url": "https://hex.pm/packages/absinthe_sorting_codec",
                "description": "Codec for generating Absinthe JSON schemas in a deterministic format with alphabetically ordered type definitions",
                "downloads_all": 22364833,
                "latest_version": "1.0.1"
            },
            {
                "name": "accent",
                "html_url": "https://hex.pm/packages/accent",
                "description": "Dynamically convert the case of your JSON API keys",
                "downloads_all": 355005,
                "latest_version": "1.1.1"
            },
            {
                "name": "acpex",
                "html_url": "https://hex.pm/packages/acpex",
                "description": "An Elixir implementation of the Agent Client Protocol (ACP) for editor-agent 
…(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/hex-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "note": "Live hex.pm registry data. /v1/package = metadata (description, licenses, links, owners, downloads, recent releases); /v1/releases = full version history; /v1/release = a single release's dependencies, Elixir constraint and build tools; /v1/search = search the registry.",
        "source": "Hex — the Elixir / Erlang package registry (hex.pm)",
        "endpoints": [
            "/v1/package",
            "/v1/releases",
            "/v1/release",
            "/v1/search",
            "/v1/meta"
        ]
    },
    "meta": {
        "timestamp": "2026-05-31T12:44:33.346Z",
        "request_id": "95090d5f-18dd-4ce2-a142-f875445e3bf1"
    },
    "status": "ok",
    "message": "Meta retrieved",
    "success": true
}
```


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