# JokeAPI API

> Returns safe jokes by category, type, language or id, plus joke categories and database statistics.

Category: Entertainment & Books. Region: global. 5 endpoints at `https://api.hoshime.com/v1/jokeapi/<endpoint>`, `GET` with query parameters, answering `{data, meta}` (see https://hoshime.com/docs/responses.md). Reference: https://hoshime.com/docs/platforms/jokeapi
## GET /v1/jokeapi/joke

A random safe joke, optionally from one category or containing a text.

Scope: `social:read` · Units: 1

| Parameter | Type | Required | Description |
|---|---|---|---|
| `category` | string | no | Joke category. (one of Any, Programming, Misc, Dark, Pun, Spooky, Christmas; default Any) |
| `contains` | string | no | Text the joke must contain, such as cat. |
| `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: `category` (string), `delivery` (string), `id` (string), `language` (string), `setup` (string), `text` (string), `type` (string)

```bash
curl "https://api.hoshime.com/v1/jokeapi/joke" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/jokeapi/byId

One safe joke by its JokeAPI id.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | integer | yes | Joke id, such as 10. (e.g. 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: `category` (string), `delivery` (string), `id` (string), `language` (string), `setup` (string), `text` (string), `type` (string)

```bash
curl "https://api.hoshime.com/v1/jokeapi/byId?id=10" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/jokeapi/jokes

Up to ten random safe jokes in one answer, optionally by category, type and language.

Scope: `social:read` · Units: 1 · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `amount` | integer | no | Number of jokes, from 1 to 10. (default 5; e.g. 2) |
| `category` | string | no | Joke category. (one of Any, Misc, Programming, Dark, Pun, Spooky, Christmas; default Any) |
| `type` | string | no | A one-liner or a setup with its delivery. (one of single, twopart) |
| `lang` | string | no | Language of the jokes: cs, de, en, es, fr or pt. (one of cs, de, en, es, fr, pt) |
| `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: `category` (string), `delivery` (string), `id` (string), `language` (string), `setup` (string), `text` (string), `type` (string)

```bash
curl "https://api.hoshime.com/v1/jokeapi/jokes?amount=2" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/jokeapi/categories

The joke categories JokeAPI knows.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `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)

```bash
curl "https://api.hoshime.com/v1/jokeapi/categories" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/jokeapi/info

How many jokes JokeAPI holds, with its categories, content flags and version.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `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: `categories` (Category[]), `categories[].name` (string), `flags` (Flag[]), `flags[].name` (string), `totalCount` (integer (int64)), `version` (string)

```bash
curl "https://api.hoshime.com/v1/jokeapi/info" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
