Wikidata API

Open Data / OAuth Advanced HTTPS
Varies by plan (check documentation)

Overview

Wikidata is a free, collaboratively edited knowledge base maintained by the Wikimedia Foundation that stores structured data behind Wikipedia and other Wikimedia projects. You can query its billions of facts using the SPARQL query language or the simpler Action API—read-only queries do not require authentication. It is the go-to source for structured, multilingual, open knowledge about people, places, events, and concepts.

Beginner Tip

Start with the Wikidata Query Service (https://query.wikidata.org) to interactively build and test SPARQL queries before integrating them into your app—it provides autocomplete and instant results without any setup.

Available Data

Wikidata data via REST API

Example Response

JSON Response
{
  "status": "success",
  "data": {
    "result": "Data from Wikidata",
    "description": "Collaboratively edited knowledge base operated by the Wikimedia Foundation",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

entities Map of entity IDs (e.g., Q42) to their full data objects.
entities[id].labels Human-readable names for the entity in multiple languages, keyed by language code.
entities[id].descriptions Short descriptions of the entity in multiple languages.
entities[id].claims Structured statements about the entity, organized by property ID (P-numbers).
entities[id].sitelinks Links to corresponding pages on Wikimedia sites like Wikipedia, keyed by wiki name.

Implementation Example

Request
const url = "https://www.wikidata.org/w/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "Authorization": "Bearer YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

SPARQL query timeout Query is too broad and scans too many triples, exceeding the 60-second limit.
Add LIMIT clauses (e.g., LIMIT 100) and use more specific filters on entity types or properties to narrow the search.
Unexpected entity structure in response Wikidata entities use numeric property IDs (P31, P279) rather than readable names.
Use the SPARQL endpoint with SERVICE wikibase:label to resolve labels automatically, or look up property IDs on wikidata.org.
403 or rate limiting on write operations Attempting to edit without OAuth authentication or exceeding anonymous request limits.
Register an OAuth app on Wikimedia, complete the auth flow, and include the access token for any write or high-volume read requests.

Metadata Score Breakdown

Estimated from metadata — endpoint not independently tested

This score is estimated from observable metadata — HTTPS support, authentication model, declared CORS, and documentation reachability — because the API requires authentication or exposes no publicly testable endpoint. The five-signal breakdown is only shown for live-tested APIs.

Metadata estimate · endpoint not independently tested

Technical Specifications

Auth OAuth
HTTPS REQUIRED
CORS UNKNOWN
Category Open Data
Difficulty Advanced
Verified: 2026-04-04

Similar APIs

View All →