# Wikimedia Commons File Search API

Search Wikimedia Commons File 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 commons page identifier, file page title, and search-result index to discover source media, build an editorial shortlist, and connect to file metadata.

Documentation: https://openany.si/wikipedia/wikimedia-commons-file-search/
API ID: c0967425-5e95-4bc7-b102-f85adbbb6620
Provider: wikimedia
Contract revision: 7
Method: GET
Endpoint: https://api.openany.si/v1/agent-apis/wikimedia/commons/search
Page update time: 2026-12-03T02:36:40.006Z
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:36:40.006Z. 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 Search API

This Action API request uses generator=search within file namespace 6. Matching pages appear under query.pages with titles and page identifiers; the request limit is between 1 and 10.

## What You Can Build

- **Discover source media**: Find file pages relevant to a topic before reviewing media details.
- **Build an editorial shortlist**: Keep page IDs and file titles with research notes.
- **Connect to file metadata**: Use the discovered file title in a separate metadata workflow for URLs and rights information.

## Returned Data

| Field | Meaning |
| --- | --- |
| `query.pages[].pageid` | Commons page identifier |
| `query.pages[].title` | File page title |
| `query.pages[].ns` | Namespace identifier; 6 denotes files |
| `query.pages[].index` | Search-result index |

## Request parameters
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Wikimedia Commons File Search 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"
          ]
        },
        "generator": {
          "type": "string",
          "description": "Set to search.",
          "enum": [
            "search"
          ]
        },
        "gsrnamespace": {
          "type": "string",
          "description": "Set to 6.",
          "enum": [
            "6"
          ]
        },
        "gsrlimit": {
          "type": "integer",
          "description": "Maximum number of files to return.",
          "minimum": 1,
          "maximum": 10
        },
        "gsrsearch": {
          "type": "string",
          "description": "Search keywords.",
          "minLength": 1,
          "maxLength": 255
        },
        "format": {
          "type": "string",
          "description": "Set to json.",
          "enum": [
            "json"
          ]
        },
        "formatversion": {
          "type": "string",
          "description": "Set to 2.",
          "enum": [
            "2"
          ]
        }
      },
      "required": [
        "action",
        "generator",
        "gsrnamespace",
        "gsrlimit",
        "gsrsearch",
        "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"
    },
    "continue": {
      "type": "object",
      "properties": {
        "continue": {
          "type": "string"
        },
        "gsroffset": {
          "type": "integer"
        }
      }
    },
    "query": {
      "type": "object",
      "properties": {
        "pages": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "index": {
                "type": "integer"
              },
              "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/search?action=query&format=json&formatversion=2&generator=search&gsrlimit=2&gsrnamespace=6&gsrsearch=Isaac+Newton' \
  -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,
  "continue": {
    "continue": "gsroffset||",
    "gsroffset": 2
  },
  "query": {
    "pages": [
      {
        "index": 1,
        "ns": 6,
        "pageid": 6364764,
        "title": "File:Sir Isaac Newton by Sir Godfrey Kneller, Bt.jpg"
      },
      {
        "index": 2,
        "ns": 6,
        "pageid": 62394615,
        "title": "File:Sir Isaac Newton bust in METU Campus Ankara Turkey.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
### Does this endpoint return direct image downloads?
It returns matching Commons file-page records. Direct media URLs are outside the documented business fields of this operation.

### How many file pages can I request?
Use gsrlimit from 1 to 10.

### Is a search result proof that a file is free to reuse?
No. Check the individual file page for its license, attribution and other reuse requirements.

### Can I filter by image dimensions or license?
The current request contract provides keyword search and a file namespace constraint, not size or license filters.

### Can I use the returned continuation token?
The reference response includes continuation data, but this implementation declares no continuation request input.

### Does namespace 6 contain only photographs?
It is the file namespace. Search results can refer to different media types rather than photographs alone.

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