# CRAN API

> Returns CRAN R package metadata, release history, specific versions, name search results and Task View package lists.

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

The current CRAN release of an R package: version, title, license, maintainer and dependencies.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Package name, such as ggplot2. (e.g. ggplot2) |
| `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: `depends` (PackageRef[]), `depends[].name` (string), `description` (string), `imports` (PackageRef[]), `imports[].name` (string), `license` (string), `maintainer` (string), `name` (string), `publishedAt` (string), `title` (string), `url` (string), `version` (string)

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

## GET /v1/cran/releases

Every CRAN release of an R package, oldest first.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Package name, such as ggplot2. (e.g. ggplot2) |
| `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: `items` (Release[]), `items[].date` (string), `items[].title` (string), `items[].version` (string), `latest` (string), `name` (string)

```bash
curl "https://api.hoshime.com/v1/cran/releases?name=ggplot2" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/cran/version

One CRAN release of an R package, with the metadata that release shipped with.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Package name, such as ggplot2. (e.g. ggplot2) |
| `version` | string | yes | Version, such as 3.5.1. (e.g. 3.5.1) |
| `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: `depends` (PackageRef[]), `depends[].name` (string), `description` (string), `imports` (PackageRef[]), `imports[].name` (string), `license` (string), `maintainer` (string), `name` (string), `publishedAt` (string), `title` (string), `url` (string), `version` (string)

```bash
curl "https://api.hoshime.com/v1/cran/version?name=ggplot2&version=3.5.1" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/cran/find

CRAN packages whose name contains the text, in index order, with their current version. Page with cursor.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `query` | string | yes | Text in the package name, such as ggplot. (e.g. ggplot2) |
| `limit` | integer | no | Items per page, 1 to 100. (default 20) |
| `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: `license` (string), `name` (string), `publishedAt` (string), `version` (string)

```bash
curl "https://api.hoshime.com/v1/cran/find?query=ggplot2" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/cran/taskView

A CRAN Task View: its title and the packages it recommends for one topic.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `view` | string | yes | Task view name, such as Bayesian or TimeSeries. (e.g. Bayesian) |
| `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: `name` (string), `packages` (PackageRef[]), `packages[].name` (string), `title` (string)

```bash
curl "https://api.hoshime.com/v1/cran/taskView?view=Bayesian" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/cran/downloads

Downloads of one R package from CRAN over a period: its total and the count of each day.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Package name, such as ggplot2. (e.g. ggplot2) |
| `period` | string | no | last-day, last-week or last-month. Default last-week. (one of last-day, last-week, last-month; default last-week; e.g. last-month) |
| `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: `daily` (DailyCount[]), `daily[].day` (string), `daily[].downloads` (integer (int64)), `end` (string), `package` (string), `start` (string), `total` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/cran/downloads?name=ggplot2&period=last-month" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
