# Wiktionary API

> Returns Wiktionary word definitions by language and part of speech, entry search, categories and random entries.

Category: Search & Knowledge. Region: global. 4 endpoints at `https://api.hoshime.com/v1/wiktionary/<endpoint>`, `GET` with query parameters, answering `{data, meta}` (see https://hoshime.com/docs/responses.md). Reference: https://hoshime.com/docs/platforms/wiktionary
## GET /v1/wiktionary/definition

The definitions of a word per language and part of speech, as Wiktionary lists them.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `word` | string | yes | The word to look up, such as hello. (e.g. hello) |
| `lang` | string | no | Only this language, by its name in Wiktionary, such as English or French. |
| `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: `definitions` (Definition[]), `definitions[].text` (string), `language` (string), `partOfSpeech` (string)

```bash
curl "https://api.hoshime.com/v1/wiktionary/definition?word=hello" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/wiktionary/search

Entries whose headword or text matches a search, 20 per page.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `query` | string | yes | Words to search for, such as serendipity. (e.g. serendipity) |
| `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: `pageId` (string), `snippet` (string), `title` (string), `url` (string)

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

## GET /v1/wiktionary/categories

Categories of one entry, such as its language and part of speech.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `word` | string | yes | The word to look up, such as serendipity. (e.g. serendipity) |
| `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: `title` (string)

```bash
curl "https://api.hoshime.com/v1/wiktionary/categories?word=serendipity" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/wiktionary/random

Random Wiktionary entries, 1 to 10 at a time. Each call returns new ones, so it is not cached.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `limit` | integer | no | Items per page, 1 to 10. (default 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: `pageId` (string), `snippet` (string), `title` (string), `url` (string)

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