Wikipedia:Finding a Wikidata ID

Source: Wikipedia, the free encyclopedia.
A Wikipedia page, with the Wikidata link highlighted

Every Wikipedia article (and many other pages, such as templates) should have an ID on our sister project, Wikidata. The ID is a series of digits prefixed "Q".

This page is a simple guide to finding that ID.

In the desktop view of Wikipedia, in the default skin and most others, the left-hand panel has a "Wikidata item" link, under "tools".

Copy the URL of that link, paste it into a text editor, and read (or copy) the ID from it.

For example for Kofoworola Abeni Pratt, that URL is https://www.wikidata.org/wiki/Q25796287, and so the ID is Q25796287.

Alternatively, click on the "Wikidata item" link to visit the item directly, and read the ID from the top of that page (or its URL).

You can also use the API: for example, the url https://en.wikipedia.org/w/api.php?action=query&prop=pageprops&titles=Kofoworola_Abeni_Pratt&format=json will return "Q25796287" as the value of the "wikibase_item" key.

Please note: if the name you are looking for is an alias that redirects to another page, it won't respond with the ID in your first try. For example, https://en.wikipedia.org/w/api.php?action=query&prop=pageprops&titles=Persia&format=json will return an empty "nonewsectionlink" element. Then, you must add a redirection parameter with value 1 to your request to get the desired information: https://en.wikipedia.org/w/api.php?action=query&prop=pageprops&titles=Persia&format=json&redirects=1 and also some details on the actual article that has that ID.

If you're looking for the ID of something that doesn't (yet) have a Wikipedia article, then you can search for it on Wikidata.

For more about working with Wikidata, see Wikipedia:Wikidata.

Shortcut

A shortcut for this page is: http://enwp.org/WP:FindID