Endpoints

April 8, 2026 ยท View on GitHub

The Hex API has two endpoints: an HTTP API, which is used for all administrative tasks and to browse packages; and a repository, which is read-only and used to deliver the registry and package tarballs.

HTTP API

See apiary.apib file at the root of this repository.

Repository

Endpoints

  • /names - Registry v2
  • /versions - Registry v2
  • /packages/PACKAGE - Registry v2
  • /tarballs/PACKAGE-VERSION.tar - Package tarball
  • /docs/PACKAGE-VERSION.tar.gz - (optional) Gzipped tarball containing documentation files for the package release
  • /registry.ets.gz - Registry v1 (DEPRECATED!)
  • /registry.ets.gz.signed - (optional) (DEPRECATED!)
  • /public_key - (optional) Public key of the repository, see "Registry v1 signing" and "Registry v2 signing" sections below

Registry authentication

The repository can require authentication for some resources. Token authentication with the Authorization header as described in the HTTP API should be used. Care needs to be taken by clients to only send the token to the actual repository, when untrusted mirrors are used authentication must be disabled.

Registry v1 signing

A repository can optionally sign its registry. The public key should be provided to clients out-of-band of the registry fetching, for example by shipping the client with a public key or by users manually installing it. The repository signs the SHA-512 digest of the registry and base 16 encodes it with lower case characters. The repository should store the signature on the /registry.ets.gz.signed and update it when the registry is updated. For performance reasons the signature can also be provided in either the x-hex-signature or the x-amz-meta-signature header on the /registry.ets.gz endpoint.

Registry v2 signing

The signing is defined in the registry v2 specification as it is not part of the resource delivery.

Mirroring

The repository can be mirrored by setting up a caching proxy in front of it. All repository endpoints support standard HTTP caching headers including ETag and Last-Modified for conditional requests. A mirror should:

  • Proxy all requests to the upstream repository (e.g., https://repo.hex.pm)
  • Respect Cache-Control headers from the upstream
  • Support conditional requests (If-None-Match, If-Modified-Since) to minimize bandwidth

Since the registry is signed, mirrors do not need to be trusted, clients can verify the authenticity of registry data using the repository's public key.

Note: Private repository endpoints (/repos/REPO/*) require authentication and should not be mirrored on public infrastructure.

Hex.pm

Hex.pm uses the following root endpoints:

Private repositories

Hex.pm supports private repositories for organizations, they can be accessed at the following endpoints, where REPO is the repository name:

  • /repos/REPO/names
  • /repos/REPO/versions
  • /repos/REPO/packages/PACKAGE
  • /repos/REPO/tarballs/PACKAGE-VERSION.tar
  • /repos/REPO/docs/PACKAGE-VERSION.tar.gz - (optional)

Private key

Go to https://hex.pm/docs/public_keys to get Hex.pm's public key used to sign the registry.

Client Implementation Reference

This section documents which endpoints are required to implement common Hex client operations.

Dependency Resolution

Used by: mix deps.get, mix deps.update, rebar3 get-deps, gleam add

TypeEndpointPurpose
Repo/namesList all package names (optional, for full registry sync)
Repo/versionsList all package versions with retirement info (optional)
Repo/packages/PACKAGEGet package releases, dependencies, and checksums
Repo/tarballs/PACKAGE-VERSION.tarDownload package tarball

The registry endpoints return signed protobuf data as specified in Registry v2.

Package Publishing

Used by: mix hex.publish, rebar3 hex publish, gleam publish

TypeEndpointPurpose
APIPOST /publishPublish package and docs (combined endpoint)
APIPOST /packages/NAME/releasesPublish a new release
APIPOST /packages/NAME/releases/VERSION/docsPublish documentation
APIDELETE /packages/NAME/releases/VERSIONRevert a release
APIDELETE /packages/NAME/releases/VERSION/docsRevert documentation
APIGET /packages/NAMECheck if package exists
APIGET /users/meGet current user (for new packages)
APIPUT /packages/NAME/owners/USERNAMEAdd first owner (for new packages)

Package Retirement

Used by: mix hex.retire, rebar3 hex retire, gleam retire

TypeEndpointPurpose
APIPOST /packages/NAME/releases/VERSION/retireRetire a release
APIDELETE /packages/NAME/releases/VERSION/retireUnretire a release

Package Ownership

Used by: mix hex.owner, rebar3 hex owner, gleam owner

TypeEndpointPurpose
APIGET /packages/NAME/ownersList owners
APIGET /packages/NAME/owners/USERNAMEGet owner details
APIPUT /packages/NAME/owners/USERNAMEAdd or transfer owner
APIDELETE /packages/NAME/owners/USERNAMERemove owner

Authentication

OAuth2 Device Authorization (used by: mix hex.user auth, gleam authenticate):

TypeEndpointPurpose
APIPOST /oauth/device_authorizationStart device authorization flow
APIPOST /oauth/tokenPoll for token / refresh token
APIPOST /oauth/revokeRevoke token
APIPOST /oauth/revoke_by_hashRevoke token by hash

API Key Generation (used by: rebar3 hex user auth):

TypeEndpointPurpose
APIPOST /keysCreate API key (with Basic Auth)

API Key Management

Used by: mix hex.organization key, rebar3 hex user key, rebar3 hex organization key

TypeEndpointPurpose
APIGET /keysList keys
APIGET /keys/NAMEGet specific key
APIPOST /keysCreate key
APIDELETE /keys/NAMEDelete key
APIDELETE /keysDelete all keys
APIGET /authTest key permissions

For organization keys, use /orgs/ORG/keys instead.

Package Information

Used by: mix hex.info, mix hex.search, rebar3 pkgs, rebar3 hex search

TypeEndpointPurpose
APIGET /packages/NAMEGet package metadata
APIGET /packages/NAME/releases/VERSIONGet release details
APIGET /packages?search=QUERYSearch packages

SBoM Generation

Used by: mix sbom.cyclonedx, ORT (OSS Review Toolkit)

TypeEndpointPurpose
APIGET /packages/NAMEGet package metadata (licenses, links, description, owners)
APIGET /packages/NAME/releases/VERSIONGet release checksum for source artifact verification
APIGET /users/NAMEGet author details (full name, email) from package owners
Repo/tarballs/PACKAGE-VERSION.tarDownload source tarball

Documentation Download

Used by: mix hex.docs

TypeEndpointPurpose
Repo/docs/PACKAGE-VERSION.tar.gzDownload documentation tarball
APIGET /packages/NAMEGet package info to find latest version

User Management

Used by: rebar3 hex user register, rebar3 hex user reset_password

TypeEndpointPurpose
APIPOST /usersCreate new user account
APIGET /users/NAMEGet user information
APIGET /users/meGet authenticated user
APIPOST /users/NAME/resetRequest password reset