# Hex.pm API

> Returns Hex package registry data: package search, package details, releases, package lists and user profiles.

Category: Developer & Tech. Region: global. 6 endpoints at `https://api.hoshime.com/v1/hexpm/<endpoint>`, `GET` with query parameters, answering `{data, meta}` (see https://hoshime.com/docs/responses.md). Reference: https://hoshime.com/docs/platforms/hexpm
## GET /v1/hexpm/search

Hex packages matching a search, as the registry ranks them.

Scope: `social:read` · Units: 1 · Cached: 30 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `query` | string | yes | Words to search for, such as phoenix. (e.g. phoenix) |
| `limit` | integer | no | Items per page, 1 to 100. (default 10) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `description` (string), `downloads` (integer (int64)), `latestVersion` (string), `licenses` (Term[]), `licenses[].name` (string), `name` (string), `updatedAt` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/hexpm/search?query=phoenix" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/hexpm/package

One Hex package: its description, latest versions, owners and releases.

Scope: `social:read` · Units: 1 · Cached: 60 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Package name, such as phoenix. (e.g. phoenix) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `createdAt` (string), `description` (string), `docsUrl` (string), `downloads` (integer (int64)), `latestStableVersion` (string), `latestVersion` (string), `licenses` (Term[]), `licenses[].name` (string), `name` (string), `owners` (Term[]), `owners[].name` (string), `repository` (string), `retirements` (Retirement[]), `retirements[].message` (string), `retirements[].reason` (string), `retirements[].version` (string), `updatedAt` (string), `url` (string), `versions` (Version[]), `versions[].version` (string)

```bash
curl "https://api.hoshime.com/v1/hexpm/package?name=phoenix" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/hexpm/release

One release of a Hex package: its checksum, Elixir requirement and dependencies.

Scope: `social:read` · Units: 1 · Cached: 1440 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Package name, such as phoenix. (e.g. phoenix) |
| `version` | string | yes | Version, such as 1.7.14. (e.g. 1.7.14) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `buildTools` (Term[]), `buildTools[].name` (string), `checksum` (string), `elixir` (string), `hasDocs` (boolean), `publishedAt` (string), `requirements` (Requirement[]), `requirements[].app` (string), `requirements[].optional` (boolean), `requirements[].requirement` (string), `version` (string)

```bash
curl "https://api.hoshime.com/v1/hexpm/release?name=phoenix&version=1.7.14" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/hexpm/list

One page of Hex packages in the order you choose, 100 per page. Page with cursor.

Scope: `social:read` · Units: 1 · Cached: 30 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `sort` | string | no | Order of the packages: downloads, recent_downloads, updated_at, inserted_at or name. (one of downloads, recent_downloads, updated_at, inserted_at, name; default downloads; e.g. downloads) |
| `cursor` | string | no | meta.pagination.nextCursor of the previous page. Omit it for the first page. |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `description` (string), `downloads` (integer (int64)), `latestVersion` (string), `licenses` (Term[]), `licenses[].name` (string), `name` (string), `updatedAt` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/hexpm/list?sort=downloads" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/hexpm/user

A Hex user's public profile: links to their profiles and the packages they own.

Scope: `social:read` · Units: 1 · Cached: 60 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `username` | string | yes | Hex username, such as wojtekmach. (e.g. wojtekmach) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `avatarUrl` (string), `bio` (string), `createdAt` (string), `followerCount` (integer (int64)), `followingCount` (integer (int64)), `handles` (map), `id` (string), `name` (string), `packages` (Term[]), `packages[].name` (string), `postCount` (integer (int64)), `url` (string), `username` (string), `verified` (boolean)

```bash
curl "https://api.hoshime.com/v1/hexpm/user?username=wojtekmach" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/hexpm/advisories

The security advisories of one Hex package: id, CVE and GHSA aliases, summary, CVSS score and the versions affected.

Scope: `social:read` · Units: 1 · Cached: 60 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Package name, such as plug. (e.g. plug) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `affected` (string[]), `aliases` (string[]), `cvssRating` (string), `cvssScore` (string), `id` (string), `modifiedAt` (string), `publishedAt` (string), `summary` (string), `url` (string), `withdrawnAt` (string)

```bash
curl "https://api.hoshime.com/v1/hexpm/advisories?name=plug" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
