# Wikidata Scraper (`dami_studio/wikidata-scraper`) Actor

Wikidata scraper: search by name, or resolve Q-ids like Q42 into full records. Each row holds the Q-id, label, description, aliases and link; resolved IDs add instance of, occupation, citizenship, a claims summary and the English Wikipedia link. Facts come back as Q-ids. $0.20 per 1,000 entities.

- **URL**: https://apify.com/dami_studio/wikidata-scraper.md
- **Developed by:** [Dami's Studio](https://apify.com/dami_studio) (community)
- **Categories:** Developer tools, AI
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.19 / 1,000 items

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

**Wikidata scraper for a name search, or a list of Q-ids turned into full records**: the label, description and
aliases, what the thing is an instance of, occupation, citizenship, a flattened summary of every
other claim, and the English Wikipedia link. No API key, no login.

The awkward part first, because it changes how you use it. Facts in Wikidata point at other
Wikidata items, so `occupation` comes back as `Q36180`, not as the word "writer". If you want words,
you resolve those IDs in a second pass.

| | |
|---|---|
| **Input** | A search term, or a list of Q-ids |
| **Output** | One row per entity: Q-id, label, description, aliases, link. Resolved IDs add instance of, occupation, citizenship, a claims summary and the English Wikipedia article |
| **Ceiling** | 1,000 entities per run resolving IDs, 50 per search |
| **Account needed** | None, and no API key |
| **Price** | $0.20 per 1,000 entities on the Free plan, a little less on paid plans. The free plan's $5 a month covers about 25,000 |

### 🔍 What Wikidata Scraper does

`search` mode runs one free-text lookup against Wikidata and returns matching items with their
Q-id, label, description and the alias that matched. Wikidata caps this at 50 results, so `maxItems`
above 50 in search mode gets you 50.

`entities` mode takes Q-ids and resolves them properly, 50 IDs at a time, as many rounds as your list
needs. This is the mode with the real detail in it.

Labels are fetched in your `language`, and in Wikidata's multilingual `mul` bucket as well. That
matters more than it sounds: `Q42`'s label lives under `mul`, not under `en`, so asking for English
alone would come back blank.

### 📋 What data you get from each Wikidata entity

| What you get | Field |
|---|---|
| The Q-id and its Wikidata page | `id`, `url` |
| Label and short description, in your language | `label`, `description` |
| Other names it goes by | `aliases` |
| What kind of thing it is (P31) | `instanceOf` |
| Occupation (P106) and country of citizenship (P27) | `occupation`, `countryOfCitizenship` |
| Every other property, flattened to plain values | `claimsSummary` |
| The English Wikipedia article | `enwikiTitle`, `enwikiUrl` |

Everything below `aliases` comes from `entities` mode. A search row stops at the first four lines.

### ▶️ How to scrape Wikidata

1. Open [Wikidata Scraper](https://apify.com/dami_studio/wikidata-scraper) and click
   **Try for free**.
2. Pick a **Mode**. Search if you have names, Entities if you already have Q-ids.
3. Fill in **Search query**, or paste your IDs into **Wikidata Q-ids**.
4. Set a **Language** if English is not what you want, then click **Start**.
5. Download the dataset as JSON, CSV or Excel, or read it from the Apify API.

### 💰 How much does it cost to scrape Wikidata?

**$0.20 per 1,000 entities** on the Free plan. Paid plans pay a little less: $0.198 on Starter, $0.196 on Scale and $0.194 on Business. On the free plan, the $5
Apify gives you each month covers about 25,000 entities.

You pay per entity row delivered. Q-ids that do not exist are skipped rather than charged, and
diagnostic rows are not charged. Set a maximum cost on the run and it stops when it gets there.

### 📥 What you give it

```json
{
  "mode": "entities",
  "ids": ["Q42", "Q5"],
  "language": "en"
}
```

| Field | Default | What it is |
|---|---|---|
| `mode` | `search` | `search` for free text, `entities` to resolve Q-ids. |
| `query` | none, the form starts with `douglas adams` | The term to search for, used in `search` mode only. An API call has to send its own. |
| `ids` | none, the form starts with `Q42` and `Q5` | The Q-ids to resolve, used in `entities` mode only. |
| `language` | `en` | Language code for labels, descriptions and aliases. Falls back to the multilingual value when your language has none. |
| `maxItems` | `50` | 1 to 1,000 in `entities` mode. In `search` mode Wikidata stops at 50 whatever you put here. |
| `notionConnector` | none | Optional. Writes one Notion page per entity when the run finishes. |
| `notionParentId` | none | Optional. The Notion data source to write into. Leave it empty and the pages land privately in your workspace. |
| `proxyConfiguration` | off | Optional network settings. A normal run does not need them. |

### 📤 What you get back

A real `entities` row for `Q42`, from a run on 5 September 2026, with `claimsSummary` cut to eight of
its properties:

```json
{
  "ok": true,
  "id": "Q42",
  "label": "Douglas Adams",
  "description": "British science fiction writer and humorist (1952–2001)",
  "aliases": ["Douglas Noël Adams", "Douglas Noel Adams", "Douglas N. Adams"],
  "instanceOf": ["Q5"],
  "occupation": ["Q214917", "Q28389", "Q6625963", "Q4853732", "Q18844224", "Q245068", "Q36180", "Q639669"],
  "countryOfCitizenship": ["Q145"],
  "claimsSummary": {
    "P31": ["Q5"],
    "P21": ["Q6581097"],
    "P569": ["+1952-03-11T00:00:00Z"],
    "P570": ["+2001-05-11T00:00:00Z"],
    "P19": ["Q350"],
    "P800": ["Q25169", "Q20736364", "Q7758404"],
    "P345": ["nm0010930"],
    "P856": ["https://douglasadams.com"]
  },
  "enwikiTitle": "Douglas Adams",
  "enwikiUrl": "https://en.wikipedia.org/wiki/Douglas_Adams",
  "url": "https://www.wikidata.org/wiki/Q42"
}
```

And a real `search` row for `douglas adams`, from a run on 3 October 2026:

```json
{
  "ok": true,
  "id": "Q28421831",
  "label": "Douglas Adams",
  "description": "American environmental engineer",
  "aliases": [],
  "url": "https://www.wikidata.org/wiki/Q28421831"
}
```

That is not the novelist, and it is a fair warning about search mode: several people share a name and
Wikidata holds all of them. Read `description` before you pick one.

| Field | How to read it |
|---|---|
| `aliases` | Search gives you the one alias that matched your term, often none. Resolving an ID gives you all of them, in your language and in `mul`. |
| `instanceOf`, `occupation`, `countryOfCitizenship` | Q-ids, not words. `Q5` is "human", `Q145` is the United Kingdom. |
| `claimsSummary` | Every other property, as `{ "P569": ["+1952-03-11T00:00:00Z"] }`. An item reference stays a Q-id, a time stays its time string, a quantity becomes its amount, coordinates become `"lat,lon"`. Capped at 60 properties with up to 20 values each. |
| `enwikiTitle`, `enwikiUrl` | The English Wikipedia article, or `null` when there is not one. |

### 🧾 Reading the output

Two kinds of row land in your dataset.

| Row | How to spot it | Billed |
|---|---|---|
| An entity | `ok: true` and an `id` | yes |
| A diagnostic | `ok: false` and an `errorCode` | no |

| Code | What it means |
|---|---|
| `BAD_INPUT` | An empty `query` in search mode, no usable Q-ids in entities mode, or a mode that is not one of the two. The row lists the values it could not read. |
| `NO_RESULTS` | Nothing matched, or none of the Q-ids you sent exist. |
| `NOT_SERVED` | Wikidata did not serve the request on this run. Re-run it later. Runs before 13 October 2026 wrote `BLOCKED` here, and runs from 13 to 17 October wrote `NETWORK`. |
| `RATE_LIMITED` | Wikidata asked the run to slow down and was still asking after several tries. Try again in a few minutes, or ask for fewer entities. |
| `SERVER_ERROR` | Wikidata answered with a server error several times over. It is usually brief, so re-run it later. |
| `NOT_FOUND` | Wikidata answered "not found" to the request itself several times over. Re-run it, and tell us in the Issues tab if it keeps happening. |
| `NETWORK` | Wikidata was unreachable or answered badly. Re-run it. |
| `TIME_LIMIT` | The run got close to its time limit and stopped on its own. The entities delivered before that are complete and charged. Give the run more time, or ask for fewer entities, to get the rest. |

A run that ends on one of these rows still finishes as succeeded, including when the time limit
stopped it before any entity came back: the `TIME_LIMIT` row and an amber status message say so.

Two things worth knowing. **An invalid `language` code comes back as `NETWORK`**, not as a bad-input
error, so check the code first when a run fails for no visible reason. And **judge a run by the rows
it delivered**, not by its status, because a run whose requests all failed can still finish marked as
succeeded.

### 💡 What people use it for

- Turning a column of names into Q-ids, then resolving those IDs in a second run to get the detail.
- Pulling the English Wikipedia link for a list of companies or people in one pass.
- Reading dates, coordinates and identifiers straight out of `claimsSummary` instead of parsing
  article text. `P345` above is the IMDb id, for instance.
- Checking whether an entity exists in Wikidata at all before writing it into your own catalogue.

From a name to readable facts, in three runs:

1. Run `search` mode with the name in `query`, and pick the right `id` by its `description`.
2. Put that id, and any others you have, into `ids` with `mode` set to `entities`.
3. Collect the Q-ids from `occupation` and `countryOfCitizenship` and resolve them in one more
   `entities` run. Their `label` is the word you wanted.

### 🚧 What it does not do

- **Search stops at 50 results.** That is Wikidata's cap, and no `maxItems` raises it. Resolve
  IDs when you need volume.
- **Items only.** Property pages and lexemes are rejected rather than returned.
- **Referenced items stay as Q-ids.** Nothing resolves `Q36180` to "writer" for you.
- **Claims are flattened.** Qualifiers, references and rank are dropped, and the summary is capped
  at 60 properties with 20 values each.
- **Only the English Wikipedia link** comes back, even when the entity has articles in other
  languages.
- **No SPARQL.** This is entity search and entity lookup, not the query service.
- **If a batch fails partway through a long ID list, the run ends with a diagnostic row** and the
  entities already fetched do not land. Split very long lists across runs.
- It is not an official Wikidata tool. Dami's Studio is independent and is not affiliated with or endorsed by Wikidata or the Wikimedia Foundation, or by any other company named on this page.

### 🧭 Which reference scraper do you need?

| If you want | Use |
|---|---|
| Wikipedia search results or article text | [Wikipedia Scraper](https://apify.com/dami_studio/wikipedia-scraper) |
| Wikidata Q-ids, aliases and claims, by name or by ID | This one |
| Book metadata by keyword, title or ISBN | [Books Scraper](https://apify.com/dami_studio/books-scraper) |
| Goodreads ratings and rating counts from a book search | [Goodreads Books Scraper](https://apify.com/dami_studio/goodreads-books-scraper) |
| Books, audio, film and software held on archive.org | [Internet Archive Scraper](https://apify.com/dami_studio/internet-archive-scraper) |
| Papers with readable abstracts and citation counts | [OpenAlex Scraper](https://apify.com/dami_studio/openalex-scraper) |
| Wikipedia, arXiv and OpenAlex searches as tools for an AI agent | [Research MCP Server](https://apify.com/dami_studio/research-mcp-server) |

### ❓ Questions people ask

#### Why is occupation full of Q-ids?

Because that is how Wikidata stores it. Collect the IDs, then run `entities` mode on them to get the
labels.

#### Why did my search return the wrong Douglas Adams?

Search matches names, and several people share one. Use `description` to pick, then resolve that
Q-id.

#### Why did a maxItems of 500 give me 50 rows?

You were in search mode. Wikidata caps it at 50.

#### Can I get labels in French or Japanese?

Yes, set `language`. When a term has no value in your language the multilingual one is used instead,
so rows stay filled rather than going blank.

#### Can I call it from code or connect it to an AI assistant?

The [API tab](https://apify.com/dami_studio/wikidata-scraper/api/python) has code for Python, JavaScript and the CLI.
MCP clients like Claude and ChatGPT use
`https://mcp.apify.com/?tools=fetch-actor-details,dami_studio/wikidata-scraper`; coding assistants can load [our skill
file](https://api.apify.com/v2/key-value-stores/BTBHU3DdiuoF4JOsK/records/apify-open-data-research-SKILL.md). All
three bill your Apify account at the same price.

#### Can I use Wikidata data in my own product?

Wikidata says its data is published under CC0. Crediting it when you redistribute is still good form.
Apify's write-up on [the legality of web scraping](https://blog.apify.com/is-web-scraping-legal/)
covers the wider question, and we are not lawyers.

### 🆘 If something breaks

Open the **Issues** tab on the actor page. Send the mode, the query or the ID list, and the run ID.
The `errorCode` on the diagnostic row usually names the problem on its own.

# Actor input Schema

## `mode` (type: `string`):

What to do. "search" runs a free-text entity search and returns matching Q-ids with their label/description. "entities" takes a list of Q-ids and returns full records (aliases, claims, Wikipedia link).

## `query` (type: `string`):

Free-text term to search Wikidata for, e.g. "douglas adams" or "eiffel tower". Used only in "search" mode. Leave empty when using "entities" mode.

## `ids` (type: `array`):

List of Wikidata item ids to resolve, e.g. \["Q42", "Q5"]. Used only in "entities" mode. Up to 50 ids are fetched per API request automatically.

## `language` (type: `string`):

Language code for labels, descriptions and aliases, e.g. en, fr, de, es, ja. Falls back to the multilingual (mul) value when a term isn't available in this language.

## `maxItems` (type: `integer`):

Maximum number of entities to return. In search mode the API caps results at 50 per query.

## `notionConnector` (type: `string`):

Optional. Write each item as a page into your Notion when the run finishes. Authorize a Notion connector once in Settings → API & Integrations → MCP connectors, then pick it here. Leave empty to skip (default), results are always saved to the dataset regardless.

## `notionParentId` (type: `string`):

Optional. The Notion data source ID of the database to write into (only used if a Notion connector is set). Leave empty to create the pages privately in your workspace instead.

## `proxyConfiguration` (type: `object`):

Optional, and not needed for a normal run.

## Actor input object example

```json
{
  "mode": "search",
  "query": "douglas adams",
  "ids": [
    "Q42",
    "Q5"
  ],
  "language": "en",
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Scraped rows are stored in the default dataset (one row per result). Empty or failed runs return a single uncharged diagnostic row instead.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "douglas adams",
    "ids": [
        "Q42",
        "Q5"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("dami_studio/wikidata-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "query": "douglas adams",
    "ids": [
        "Q42",
        "Q5",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("dami_studio/wikidata-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "douglas adams",
  "ids": [
    "Q42",
    "Q5"
  ]
}' |
apify call dami_studio/wikidata-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dami_studio/wikidata-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/bRBahLIIamB0D0kzB/builds/eYs8oOyKz8CImy72f/openapi.json
