Wikipedia Media API
Images, audio and other media on a page, with captions and source sets.
GET /v1/wikipedia/pages/{title}/media1 credit Failed requests are free
About this endpoint
GET /v1/wikipedia/pages/{title}/media?lang=en returns data.items and the data.revision the list belongs to. Each item has title, type, leadImage, sectionId, showInGallery, audioType, galleryId, srcset and caption. type is usually image, but audio and video appear too.
srcset lists the available sources, each with a src and a scale such as 2x. Image URLs can carry the file host's own tracking parameters; strip them when you need a clean URL. caption has both html and plain text. leadImage marks the page's lead image, and showInGallery tells you whether the item appears in a gallery.
limit accepts 1 to 500 rows and cursor continues with data.page.nextCursor. A page with no media is found with empty: true. A missing title is not_found.
Wikipedia Media API FAQ
Are these image URLs ready to use?
src is an absolute https URL, and hrefs inside caption.html are absolute too. srcset can offer more than one scale. Check the file's own licence before republishing an image.
Does this include audio and video?
Sometimes. type reports image, audio, video or another kind when the page uses it, and audioType adds the audio kind. Most items are images.
What if a page has no media?
The list is empty and empty is true while lookupStatus is found. A missing page is different: lookupStatus is not_found and items is empty.
How is media paging billed?
Pricing is documented on the operation in the API registry (shown on this page). Confirm on every response with meta.creditsCharged: that field is the billing source of truth. Each paginated page is a separate billed request.
Other Wikipedia endpoints
- PageGET /v1/wikipedia/pages/{title}
- Pages by titleGET /v1/wikipedia/pages
- Page contentGET /v1/wikipedia/pages/{title}/content
- RevisionsGET /v1/wikipedia/pages/{title}/revisions
- History statsGET /v1/wikipedia/pages/{title}/history-stats
- BacklinksGET /v1/wikipedia/pages/{title}/backlinks
- LinksGET /v1/wikipedia/pages/{title}/links
- LanguagesGET /v1/wikipedia/pages/{title}/languages