# Wikimedia Commons File Details API

Get Wikimedia Commons File Details via REST or OpenAny MCP—with pay-per-use pricing and no subscription. Powered by Wikimedia, pass parameters such as action, format, formatversion, and retrieve structured data including original media URL, thumbnail URL, original width in pixels, original height in pixels, and media MIME type to build media previews, keep attribution context, and inspect file properties.

Documentation: https://openany.si/wikipedia/wikimedia-commons-file-details/
API ID: 5ad52970-3694-41a8-a95e-ec6057f14773
Provider: wikimedia
Contract revision: 7
Method: GET
Endpoint: https://api.openany.si/v1/agent-apis/wikimedia/commons/file
Page update time: 2026-12-03T02:37:00.845Z
Access: OpenAny REST
OpenAny MCP: availability is not supplied by this REST contract. Check get_api on the configured OpenAny MCP server before execution.
Request content type: none
Execution mode: sync
Authentication: Authorization: Bearer $OPENANY_API_KEY

## Billing
Price: $0 / call
The published contract currently has no usage charge. Authentication and service limits still apply.
Price source: OpenAny public API contract.
Contract update time: 2026-12-03T02:37:00.845Z. This is not a price-change timestamp.
```json
{
  "currency": "USD",
  "mode": "fixed",
  "priceMicroUsd": "0",
  "rounding": null,
  "unit": "call",
  "unitQuantity": null
}
```

## Usage and limits
## Wikimedia Commons File Details API

Request imageinfo for a title including the File: prefix, with iiurlwidth from 1 to 1024. The response groups original and thumbnail URLs, size and MIME data, and selected extended metadata under imageinfo.

## What You Can Build

- **Build media previews**: Use the thumbnail URL and returned dimensions in a preview card.
- **Keep attribution context**: Retain available artist and license metadata with the source page.
- **Inspect file properties**: Check file size and MIME type before a separate media download.

## Returned Data

| Field | Meaning |
| --- | --- |
| `query.pages[].imageinfo[].url` | Original media URL |
| `query.pages[].imageinfo[].thumburl` | Thumbnail URL |
| `query.pages[].imageinfo[].width` | Original width in pixels |
| `query.pages[].imageinfo[].height` | Original height in pixels |
| `query.pages[].imageinfo[].mime` | Media MIME type |
| `query.pages[].imageinfo[].size` | File size in bytes |
| `query.pages[].imageinfo[].descriptionurl` | Commons file-description page |
| `query.pages[].imageinfo[].extmetadata.Artist.value` | Artist metadata, potentially containing markup |
| `query.pages[].imageinfo[].extmetadata.LicenseShortName.value` | Available license label |

## Request parameters
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Wikimedia Commons File Details API request inputs",
  "$comment": "Declared input types grouped by HTTP location. Path, query and header values describe decoded inputs and are serialized as text on the wire; body is the payload. This is not an exhaustive provider contract or a schema for the raw HTTP request.",
  "type": "object",
  "properties": {
    "path": {
      "type": "object",
      "properties": {}
    },
    "query": {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "description": "Set to query.",
          "enum": [
            "query"
          ]
        },
        "prop": {
          "type": "string",
          "description": "Set to imageinfo.",
          "enum": [
            "imageinfo"
          ]
        },
        "iiprop": {
          "type": "string",
          "description": "Set to url|size|mime|extmetadata.",
          "enum": [
            "url|size|mime|extmetadata"
          ]
        },
        "iiextmetadatafilter": {
          "type": "string",
          "description": "Set to Artist|LicenseShortName|LicenseUrl.",
          "enum": [
            "Artist|LicenseShortName|LicenseUrl"
          ]
        },
        "iiurlwidth": {
          "type": "integer",
          "description": "Requested thumbnail width in pixels.",
          "minimum": 1,
          "maximum": 1024
        },
        "titles": {
          "type": "string",
          "description": "Commons file title including the File: prefix.",
          "minLength": 1,
          "maxLength": 255
        },
        "format": {
          "type": "string",
          "description": "Set to json.",
          "enum": [
            "json"
          ]
        },
        "formatversion": {
          "type": "string",
          "description": "Set to 2.",
          "enum": [
            "2"
          ]
        }
      },
      "required": [
        "action",
        "prop",
        "iiprop",
        "iiextmetadatafilter",
        "iiurlwidth",
        "titles",
        "format",
        "formatversion"
      ]
    },
    "headers": {
      "type": "object",
      "properties": {}
    }
  },
  "required": [
    "path",
    "query",
    "headers"
  ]
}
```

## Response fields
Source: Inferred from examples; not an exhaustive provider schema.
```json
{
  "type": "object",
  "properties": {
    "batchcomplete": {
      "type": "boolean"
    },
    "query": {
      "type": "object",
      "properties": {
        "pages": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "imageinfo": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "descriptionshorturl": {
                      "type": "string"
                    },
                    "descriptionurl": {
                      "type": "string"
                    },
                    "extmetadata": {
                      "type": "object",
                      "properties": {
                        "Artist": {
                          "type": "object",
                          "properties": {
                            "source": {
                              "type": "string"
                            },
                            "value": {
                              "type": "string"
                            }
                          }
                        },
                        "LicenseShortName": {
                          "type": "object",
                          "properties": {
                            "hidden": {
                              "type": "string"
                            },
                            "source": {
                              "type": "string"
                            },
                            "value": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "height": {
                      "type": "integer"
                    },
                    "mime": {
                      "type": "string"
                    },
                    "responsiveUrls": {
                      "type": "object",
                      "properties": {
                        "2": {
                          "type": "string"
                        }
                      }
                    },
                    "size": {
                      "type": "integer"
                    },
                    "thumbattribs": {
                      "type": "object",
                      "properties": {
                        "decoding": {
                          "type": "string"
                        },
                        "height": {
                          "type": "integer"
                        },
                        "loading": {
                          "type": "string"
                        },
                        "src": {
                          "type": "string"
                        },
                        "srcset": {
                          "type": "string"
                        },
                        "width": {
                          "type": "integer"
                        }
                      }
                    },
                    "thumbheight": {
                      "type": "integer"
                    },
                    "thumburl": {
                      "type": "string"
                    },
                    "thumbwidth": {
                      "type": "integer"
                    },
                    "url": {
                      "type": "string"
                    },
                    "width": {
                      "type": "integer"
                    }
                  }
                }
              },
              "imagerepository": {
                "type": "string"
              },
              "ns": {
                "type": "integer"
              },
              "pageid": {
                "type": "integer"
              },
              "title": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
```

## Request example
Scenario: Documentation example
```bash
curl \
  'https://api.openany.si/v1/agent-apis/wikimedia/commons/file?action=query&format=json&formatversion=2&iiextmetadatafilter=Artist%7CLicenseShortName%7CLicenseUrl&iiprop=url%7Csize%7Cmime%7Cextmetadata&iiurlwidth=320&prop=imageinfo&titles=File%3ASir+Isaac+Newton+by+Sir+Godfrey+Kneller%2C+Bt.jpg' \
  -X GET \
  -H "Authorization: Bearer $OPENANY_API_KEY" \
  -H 'Content-Type: application/json'
```

## Response example
Published documentation example. Verify the actual response after an approved call.
Sample response · Documented HTTP 200
```json
{
  "batchcomplete": true,
  "query": {
    "pages": [
      {
        "imageinfo": [
          {
            "descriptionshorturl": "https://commons.wikimedia.org/w/index.php?curid=6364764",
            "descriptionurl": "https://commons.wikimedia.org/wiki/File:Sir_Isaac_Newton_by_Sir_Godfrey_Kneller,_Bt.jpg",
            "extmetadata": {
              "Artist": {
                "source": "commons-desc-page",
                "value": "<bdi><a href=\"https://en.wikipedia.org/wiki/en:Godfrey_Kneller\" class=\"extiw\" title=\"w:en:Godfrey Kneller\"><span title=\"German-born British painter (1646–1723)\">Godfrey Kneller</span></a></bdi>"
              },
              "LicenseShortName": {
                "hidden": "",
                "source": "commons-desc-page",
                "value": "Public domain"
              }
            },
            "height": 2912,
            "mime": "image/jpeg",
            "responsiveUrls": {
              "2": "https://thumb.wikimedia.org/wikipedia/commons/thumb/5/50/Sir_Isaac_Newton_by_Sir_Godfrey_Kneller%2C_Bt.jpg/960px-Sir_Isaac_Newton_by_Sir_Godfrey_Kneller%2C_Bt.jpg?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=thumbnail"
            },
            "size": 1212861,
            "thumbattribs": {
              "decoding": "async",
              "height": 388,
              "loading": "lazy",
              "src": "https://thumb.wikimedia.org/wikipedia/commons/thumb/5/50/Sir_Isaac_Newton_by_Sir_Godfrey_Kneller%2C_Bt.jpg/330px-Sir_Isaac_Newton_by_Sir_Godfrey_Kneller%2C_Bt.jpg?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=thumbnail",
              "srcset": "https://thumb.wikimedia.org/wikipedia/commons/thumb/5/50/Sir_Isaac_Newton_by_Sir_Godfrey_Kneller%2C_Bt.jpg/960px-Sir_Isaac_Newton_by_Sir_Godfrey_Kneller%2C_Bt.jpg?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=thumbnail 2x",
              "width": 320
            },
            "thumbheight": 388,
            "thumburl": "https://thumb.wikimedia.org/wikipedia/commons/thumb/5/50/Sir_Isaac_Newton_by_Sir_Godfrey_Kneller%2C_Bt.jpg/330px-Sir_Isaac_Newton_by_Sir_Godfrey_Kneller%2C_Bt.jpg?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=thumbnail",
            "thumbwidth": 320,
            "url": "https://upload.wikimedia.org/wikipedia/commons/5/50/Sir_Isaac_Newton_by_Sir_Godfrey_Kneller%2C_Bt.jpg?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=original",
            "width": 2400
          }
        ],
        "imagerepository": "local",
        "ns": 6,
        "pageid": 6364764,
        "title": "File:Sir Isaac Newton by Sir Godfrey Kneller, Bt.jpg"
      }
    ]
  }
}
```

## Error handling
400: Check the request fields.
401 / 403: Verify credentials and access permissions.
402: Inspect payment requirements and balance.
429: Respect returned retry guidance.
5xx: Inspect the error and usage record before retrying a paid operation.

## Common questions
### Which title format should I use?
Provide the Commons file title including File:, such as a title returned by the Commons File Search API.

### Does this download the media bytes?
It returns metadata and media URLs. Downloading a media file is a separate request.

### Is the returned thumbnail width always exactly the request?
Use the returned thumbwidth and thumbheight for layout rather than assuming a particular generated rendition.

### Can artist metadata contain HTML?
Yes. Escape or sanitize external metadata before inserting it into your interface.

### Is LicenseUrl guaranteed?
No. Requested extended metadata can be absent for an individual file. Check the file-description page when reuse conditions matter.

### Does a returned license label settle every reuse question?
Review the file page and applicable conditions, including attribution and any additional rights relevant to your use.

Integration guide: https://openany.si/docs/
Agent setup: https://openany.si/SKILL.md
