# Wikidata API

> Returns Wikidata items by search, Q id or Wikimedia page, with labels, descriptions, aliases and property statements.

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

Items whose label or alias matches a search, best match first, 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 Douglas Adams. (e.g. Douglas Adams) |
| `lang` | string | no | Language of the labels, such as en or de. (default en) |
| `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: `aliases` (Alias[]), `aliases[].name` (string), `description` (string), `id` (string), `label` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/wikidata/search?query=Douglas+Adams" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/wikidata/item

One item by its Q id: its label, description and aliases in one language.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Wikidata item id such as Q42, or a wikidata.org/wiki/Q42 URL. (e.g. Q42) |
| `lang` | string | no | Language of the label, such as en or de. (default en) |
| `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: `aliases` (Alias[]), `aliases[].name` (string), `description` (string), `id` (string), `label` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/wikidata/item?id=Q42" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/wikidata/itemsByIds

Several items by their Q ids in one call, up to 50, each with its label and description.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `ids` | string | yes | Wikidata item ids separated by \| or commas, such as Q42\|Q5. (e.g. Q42\|Q5) |
| `lang` | string | no | Language of the labels, such as en or de. (default en) |
| `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: `aliases` (Alias[]), `aliases[].name` (string), `description` (string), `id` (string), `label` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/wikidata/itemsByIds?ids=Q42%7CQ5" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/wikidata/fromSite

The Wikidata item of a page on a Wikimedia site, such as the English Wikipedia article Douglas Adams.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `site` | string | yes | Wiki database name such as enwiki, dewiki or idwiki. (e.g. enwiki) |
| `title` | string | yes | Page title on that wiki, such as Douglas Adams. (e.g. Douglas Adams) |
| `lang` | string | no | Language of the label, such as en or de. (default en) |
| `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: `aliases` (Alias[]), `aliases[].name` (string), `description` (string), `id` (string), `label` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/wikidata/fromSite?site=enwiki&title=Douglas+Adams" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/wikidata/statements

The statements an item makes for one property, such as P31 (instance of), with their values.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Wikidata item id such as Q42, or a wikidata.org/wiki/Q42 URL. (e.g. Q42) |
| `property` | string | yes | Property id such as P31 (instance of) or P569 (date of birth). (e.g. P31) |
| `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: `property` (string), `rank` (string), `type` (string), `value` (string)

```bash
curl "https://api.hoshime.com/v1/wikidata/statements?id=Q42&property=P31" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/wikidata/propertySearch

Wikidata properties whose label or alias matches a search, such as P31 for instance of, 20 per page.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `query` | string | yes | Words to search for, such as date of birth. (e.g. instance of) |
| `lang` | string | no | Language of the labels, such as en or de. (default en) |
| `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: `aliases` (Alias[]), `aliases[].name` (string), `description` (string), `id` (string), `label` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/wikidata/propertySearch?query=instance+of" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/wikidata/sitelinks

The Wikipedia articles and other wiki pages about an item, in every language or the wikis you name, with their page addresses.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Wikidata item id such as Q42, or a wikidata.org/wiki/Q42 URL. (e.g. Q42) |
| `sites` | string | no | Wiki database names separated by \|, such as enwiki\|dewiki. Omit it for every wiki. |
| `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: `site` (string), `title` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/wikidata/sitelinks?id=Q42" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
