Skip to content
Wikimedia Enterprise

Wikidata logo

Wikidata API

Structured access to the world's largest Open Knowledge Graph

The Wikidata API gives you programmatic access to Wikidata, the Wikimedia project that stores the structured data behind Wikipedia, Wikivoyage, Wiktionary, Wikisource, and every other Wikimedia project. Wikidata contains over 120 million entities, each a machine-readable concept connected to others through typed statements, in a collaborative multilingual Linked Open Data knowledge graph that anyone can edit.

Wikidata is available across the Wikimedia Enterprise APIs: Snapshots deliver every QID in the Main Graph and every PID, the On-demand API returns single entities, and the Realtime API delivers changes as a data stream or as hourly batches. Use a single access token to query structured entity data, multilingual labels, aliases, statements, and sitelinks alongside the full text of Wikipedia, Wikivoyage, and every other Wikimedia project. Power semantic search, ground AI applications in provable facts, feed knowledge graphs, and build data-driven applications on top of the Linked Open Web.

Why Wikidata is machine readable

The content on Wikipedia and most other Wikimedia projects is written for humans. Wikidata is different. It stores information as Items, Properties, and Values, structured as triples in a graph database: Subject → Predicate → Object. That structure is machine-readable, highly interoperable, and language-agnostic by default.

A diagram of Wikidata items as cards linked by dotted arrows: Leonardo da Vinci, Frida Kahlo and Mona Lisa connect through properties such as instance of (P31), notable work (P800) and place of birth (P19) to items for human, painting, Mexico City and Louvre Museum.

How Wikidata items link to each other through properties, Wikibase illustration by Wikimedia Deutschland.

Wikidata as linked data

Wikidata functions as the largest online knowledge graph by assigning every concept a universal Linked Open Data identifier. Every item has a unique Q-number (such as Q42 for Douglas Adams) and every property has a P-number (like P31 for 'instance of'), forming machine-readable statements like Q42 → P31 → Q5 (human). A single global identifier represents a concept universally while supporting labels and descriptions in hundreds of languages. Because the data is structured as a graph rather than HTML or wikitext, algorithms can traverse it for rich context without parsing prose.

What you can build with Wikidata

Every item in Wikidata is verifiable, backed by cited references and a transparent public edit history. All Wikidata content is released under a CC0 waiver, so the full interconnected web of data is freely available for AI grounding, model training, and research at scale.

Some examples Wikidata unlocks:

  • Normalize and deduplicate data: A QID refers to a single language-agnostic concept. Use Wikidata labels, descriptions, and aliases to match variant spellings or translations of names, places, events, and time periods against its unique identifier.
  • Answer questions no one has asked before: Traverse the graph to ground AI agents and applications in provable facts. For example, "which animal species have the forest as their natural habitat and have at one point been awarded 'Animal of the Year'?"
  • Surface the right information per concept type: Use common properties like 'instance of' to classify an entity, then retrieve the statements that matter for that class: dates for events, birth and death for people, Latin names for species.
  • Connect disparate databases: Wikidata works as a pivot database via external identifiers. Map your existing datasets to Wikidata QIDs to link against VIAF, AAT, GND, ISNI, the Library of Congress, WorldCat, and hundreds of authority files.

Unify across Wikimedia projects: Wikidata is the structured data glue that connects Wikimedia projects. Most Wikipedia infoboxes are built on it, and every Wikidata item has sitelinks to the corresponding page on Wikipedia, Wikivoyage, Wikisource, Wiktionary, and more, across every available language.

How to access Wikidata

Access Wikidata through the Wikimedia Enterprise API suite. The Snapshot API delivers all items in the Wikidata Main Graph and every single property, as a monthly download on free accounts and up to daily on paid ones. The On-demand API looks up single entities or labels, and the Realtime API streams changes as they happen or as fetchable hourly batches. All Wikidata endpoints are in Beta.

The three On-demand endpoints are:

  • Wikidata Item Lookup. Retrieve all available data for a Wikidata item by Q-number, including labels, descriptions, aliases, statements, references, and sitelinks.
  • Wikidata Property Lookup. Retrieve the definition and metadata for a Wikidata property by P-number.
  • Wikidata Labels List. Translate machine-readable identifiers into human-readable labels in any available language.
visual showing how data from all different Wikimedia projects are embedded in Wikidata

Wikidata as the central instance that every other Wikimedia project draws on. Wikibase illustration by Wikimedia Deutschland.

Example call to get structured data for Douglas Adams (Q42):

curl -L 'https://api.enterprise.wikimedia.com/v2/wikidata/items/Q42' -H 'Authorization: Bearer ACCESS_TOKEN'

Getting a 403: Forbidden (You are not authorized to access this resource) error? Don't forget to sign up for a free Wikimedia Enterprise account and use the Login endpoint to get an access token.

Wikidata properties

Items are the things Wikidata knows about; properties are how it describes them. Every item carries a Q-number (Q42 is Douglas Adams) and every property carries a P-number (P31 is 'instance of'). A property never stands on its own: it is the predicate in a statement, joining an item to a value. Q42 → P106 → Q36180 says Douglas Adams has the occupation writer.

Wikidata has thousands of properties, but a small set carries most of the graph. These are the ones worth knowing before you write an extractor:

PropertyP-numberWhat it tells you
instance ofP31What class of thing the item is: human, city, film, species
subclass ofP279Where the item sits in the class hierarchy above it
occupationP106What a person does or did
date of birthP569When a person was born
date of deathP570When a person died
countryP17The sovereign state the item belongs to
located inP131The administrative territorial entity containing a place
coordinate locationP625Latitude and longitude
imageP18The item's main image on Wikimedia Commons
authorP50Who wrote a work
publication dateP577When a work was first published
official websiteP856The item's own URL

Start with P31. Classifying an item is what tells you which of the other properties are worth reading: birth and death dates for a human, coordinates for a place, author and publication date for a book.

Wikidata Property Lookup returns the definition and metadata for any property by P-number, including its labels in every available language and its data type, which is what tells you whether the value will be another item, a string, a date, a quantity, or a URL.

curl -L 'https://api.enterprise.wikimedia.com/v2/wikidata/properties/P31' -H 'Authorization: Bearer ACCESS_TOKEN'

Request and response details are in the Property Lookup reference and the On-demand API guide.

What's inside the Wikidata API response?

  • Items: the main unit of information in Wikidata, representing concepts, topics, objects, people, and events.
  • Labels: the human-readable name the item is most commonly known by. Items are language agnostic, so most have labels in many languages.
  • Descriptions: short neutral phrases that describe the item. Great to display under a Label, and also available per language.
  • Aliases: other names an item is known by, including variant spellings and translations. A single item may have many aliases per language.
  • Statements: the graph's connective tissue. Each statement links an item to a value through a property. For example: Marie Curie (item identifier Q7186) has the occupation (property identifier P106) of physicist (item identifier Q169470). Values are themselves Wikidata items, so each statement links two Wikidata items through a property predicate.
  • References: pointers to verifiable sources that back up a statement. References work similarly to statements: they link a statement to a value using a property, such as 'stated in' or 'reference URL'. They ensure that knowledge stored in Wikidata is always linked to a source of truth. Because statements can carry conflicting information when each is properly sourced, Wikidata captures how knowledge evolves and how consensus forms, not just a single flattened answer.
  • Sitelinks: the connection points between Wikidata and every other Wikimedia project. Sitelinks link a Wikidata item to the corresponding article on Wikipedia, Wikisource, Wikivoyage, and others, across all available languages. They power the "see this article in other languages" links on Wikipedia and make it easy to navigate between language versions for that item.
  • External Identifiers: unique identifiers linking a Wikidata item to records in external databases, authority files, archives, and encyclopedias. This turns Wikidata into a central hub of the Linked Open Web. If your datasets contain unique identifiers from other sources, you can enrich them by looking those identifiers up in Wikidata and joining the knowledge stored there.
a detailed look at the Douglas Adams Wikidata item

Source: Douglas Adams (Q42) on Wikidata

Wikidata API example payload

The first fields of a Wikidata Item Lookup response for Q42 (Douglas Adams) return identifying info and metadata about the current and previous version of the item:

{
"name": "Q42",
"identifier": 138,
"date_created": "2025-12-09T20:13:59Z",
"date_modified": "2025-12-09T20:13:59Z",
"version": {
"identifier": 2440217749,
"comment": "/* wbsetdescription-set:1|nl */ Engelse schrijver (1952–2001)"
},
"previous_version": {
"identifier": 2440217365
},
"url": "https://www.wikidata.org/wiki/Q42",
"namespace": {
"identifier": 0
},
"is_part_of": {
"identifier": "wikidatawiki"
},
"visibility": {
"text": true,
"editor": true,
"comment": true
},
"event": {
"identifier": "a5a43df6-3977-4f8e-8a1e-f9e0d2b7b5b7",
"type": "update",
"date_created": "2025-12-09T20:14:00.193403Z",
"date_published": "2025-12-09T20:14:00.193403Z"
}
}
}

The entity object contains labels, descriptions, and aliases for the item, for describing the item and finding variant spellings and translations:

"entity": {
"identifier": "Q42",
"type": "item",
"labels": {
"ar": "دوغلاس آدمز",
"mul": "Douglas Adams",
},
"descriptions": {
"de": "britischer Science-Fiction-Autor und Humorist",
"en-us": "English science fiction writer and humorist (1952–2001)",
},
"aliases": {
"eo": [
"Douglas ADAMS",
"Douglas Noël ADAMS"
],
"he": [
"דגלס אדמס",
"דאגלס נואל אדמס"
],
}
}

The statements object contains every subject - predicate - object link for the item. Statements objects are often long, with tens or hundreds of entries. This example shows a single statement: the property P101 "Field of Work" connects Q42 to the value Q3238422 ("science fiction literature"). Statements can also carry qualifiers that refine the value and references that back up the claim.

"statements": {
"P101": [
{
"identifier": "Q42$0C5C0A36-7389-4E16-969B-851D25C94AC2",
"rank": "normal",
"property": {
"identifier": "P101",
"data_type": "wikibase-item",
"labels": {
"en": "field of work"
}
},
"value": {
"type": "value",
"content_data": {
"entity-type": "item",
"id": "Q3238422",
"numeric-id": "3.238422e+06"
},
"labels": {}
},
"qualifiers": null,
"references": [{}]
}]
}

The sitelinks object is one of the most powerful sections of the Wikidata payload. It connects the Wikidata item to its corresponding article or page on every other Wikimedia project, in every available language.

"sitelinks": {
"enwiki": {
"title": "Douglas Adams",
"badges": null,
"url": "https://en.wikipedia.org/wiki/Douglas_Adams"
},
"enwikiquote": {
"title": "Douglas Adams",
"badges": null,
"url": "https://en.wikiquote.org/wiki/Douglas_Adams"
},
}

Frequently Asked Questions

What's the difference between Wikipedia and Wikidata?

Wikipedia contains articles written for humans, collecting knowledge as textual encyclopedia entries. Wikidata contains the structured facts and relationships behind that same knowledge, stored as triples in a graph database that machines and humans can both read. When pulling a Wikipedia article through the Wikimedia Enterprise APIs, as raw article data or pre-parsed through Structured Contents, you can boost your knowledge graph or AI grounding pipeline by joining it to the Wikidata Q-number in the additional_entities array. That QID links to every other language version of the article, and to the same concept on Wiktionary, Wikivoyage, and other Wikimedia projects.

Example: get the Wikidata QID from a Wikipedia article response.

curl -L 'https://api.enterprise.wikimedia.com/v2/articles/NASA' -H 'Authorization: Bearer ACCESS_TOKEN'

From the response, pull the QID from additional_entities:

"additional_entities": [
{
"identifier": "Q309751",
"url": "https://www.wikidata.org/entity/Q309751",
"aspects": ["C.P18", "S", "T"]
}
]

Then query Wikidata directly:

curl -L 'https://api.enterprise.wikimedia.com/v2/wikidata/items/Q309751' -H 'Authorization: Bearer ACCESS_TOKEN'

Is the Wikidata API free?

Yes. A free Wikimedia Enterprise account includes a monthly Snapshot of the entire Wikidata Main Graph and access to the Wikidata endpoints on the On-demand API, with monthly request limits. All Wikidata endpoints are in Beta. For daily Snapshots, higher volume, real-time streaming, or production SLAs, paid accounts are available. Sign up for a free account or contact sales.

What Wikidata endpoints are available?

Three On-demand endpoints in Beta: Wikidata Item Lookup, Wikidata Property Lookup, and Wikidata Labels List (reference). On the Snapshot API, download Wikidata Snapshots to get every item in the Main Graph and every property, all in one go or in chunks. On the Realtime API, the Wikidata stream delivers changes live and hourly Wikidata batches deliver them as files.

What happened to Freebase?

Google retired Freebase in 2016 and worked with the Wikidata community to migrate its data across. Wikidata is the general-purpose open knowledge graph that succeeded it, and these endpoints are how you query that graph at scale.

Is Wikidata content openly licensed?

Yes. Wikidata is released under a CC0 public domain waiver, which makes it the most permissively licensed data in the Wikimedia ecosystem. You can use Wikidata content for any purpose, including commercial applications and model training, without attribution requirements (though attribution is always appreciated).

Get Started

Access Wikidata, Wikipedia, and other Wikimedia project data through one unified API delivering consistent JSON output. Scale your knowledge-based applications with high-availability infrastructure; get started with free instant access today.