Wikidata API

Open Data / OAuth Advanced HTTPS
48 D
Measured Score 0 50 100 Speed 2/30 Consistency 20/20 Security 18/20 Browser access 0/15 Transparency 8/15 TESTED 2026-08-10

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.

Measurement Record

What actually happened when we called this API from our own infrastructure. Every value below was recorded by the request, not copied from the provider's documentation.

Request
GET https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q42&format=json&languages=en
Result
HTTP 200 · application/json · 284,276 bytes · compressed
Response time
1322 ms (median of 3) · fastest 1286 ms
Transport
TLSv1.3 · TLS_AES_128_GCM_SHA256 · certificate issued by Let's Encrypt
Browser CORS
No Access-Control-Allow-Origin header — call it from a server, not the browser
Served by
mw-api-ext.eqiad.main-7c8544589d-ndgvx
Recorded
2026-08-10

Fields Returned

Top-level fields present in the response we captured, with the type and value we actually received.

Field Type Value received
entities object {1 fields}
success integer 1

Captured Response

Captured from a real request to https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q42&format=json&languages=en on 2026-08-10. Long arrays and nested objects are truncated to keep the shape readable.

JSON Response · Captured
{
  "entities": {
    "Q42": {
      "pageid": 138,
      "ns": 0,
      "title": "Q42",
      "lastrevid": 2528906229,
      "modified": "2026-08-08T20:03:20Z",
      "type": "item",
      "id": "Q42",
      "labels": {},
      "descriptions": {
        "…": "(1 more fields)"
      },
      "aliases": {},
      "claims": {
        "…": "(312 more fields)"
      },
      "sitelinks": {
        "…": "(132 more fields)"
      }
    }
  },
  "success": 1
}

Field Reference

entities Map of entity IDs (e.g., Q42) to their full data objects.

Implementation Example

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

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

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

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.

Measured Score Breakdown

Live HTTP request to the API endpoint

Speed 2/30
Consistency 20/20
Security 18/20
Browser access 0/15
Transparency 8/15
Endpoint Response Time 1322ms

Fully tested on Aug 10, 2026

Technical Specifications

Auth OAuth
HTTPS REQUIRED
CORS UNKNOWN
Category Open Data
Difficulty Advanced
Endpoint last called: 2026-08-10

Similar APIs

View All →