{
  "openapi": "3.0.1",
  "info": {
    "title": "Wikimedia Commons Image Downloader: Files with License & Credit",
    "description": "Download images from Wikimedia Commons by search, category or file title. Get the files plus license, author, attribution text and description page URL for every image. Filter by license and minimum size, dedupe, convert or resize, and get public links plus one ZIP.",
    "version": "0.1",
    "x-build-id": "UyQvJGA8Pi0syJdfm"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/data-done-right~wikimedia-commons-image-downloader/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-data-done-right-wikimedia-commons-image-downloader",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/data-done-right~wikimedia-commons-image-downloader/runs": {
      "post": {
        "operationId": "runs-sync-data-done-right-wikimedia-commons-image-downloader",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/data-done-right~wikimedia-commons-image-downloader/run-sync": {
      "post": {
        "operationId": "run-sync-data-done-right-wikimedia-commons-image-downloader",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "searchQueries": {
            "title": "Search queries",
            "type": "array",
            "description": "Words to search for in file names, descriptions and categories of Wikimedia Commons, one search per line. Example: lighthouse sunset. Each search fills the free space left by maxFiles.",
            "items": {
              "type": "string"
            }
          },
          "categories": {
            "title": "Commons categories",
            "type": "array",
            "description": "Categories to take files from, with or without the 'Category:' prefix. Example: Lighthouses in France. Only files filed directly in the category are taken unless you raise categoryDepth.",
            "items": {
              "type": "string"
            }
          },
          "fileTitles": {
            "title": "Exact file titles or page links",
            "type": "array",
            "description": "Specific files, as 'File:Name.jpg' or the commons.wikimedia.org/wiki/File:... page link. Example: File:Example.jpg. Handled first, 50 per API request.",
            "items": {
              "type": "string"
            }
          },
          "maxFiles": {
            "title": "Max files",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Most files processed in this run, all sources together (example: 20). Files beyond this are not downloaded and not charged. Only downloaded files are charged.",
            "default": 20
          },
          "categoryDepth": {
            "title": "Sub-category depth",
            "minimum": 0,
            "maximum": 3,
            "type": "integer",
            "description": "0 = only the category itself. 1 to 3 also read its sub-categories that many levels down (at most 100 categories per run). Example: 1.",
            "default": 0
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 0.1,
            "maximum": 100,
            "type": "number",
            "description": "Files larger than this are left out, judged from the size Commons lists. 1 MB = 1,000,000 bytes. Example: 10.",
            "default": 25
          },
          "licenses": {
            "title": "License filter",
            "type": "array",
            "description": "Keep only these license groups. Leave empty for all. public-domain covers CC0 and public domain marks; cc-by and cc-by-sa are the Creative Commons attribution licenses (any version); other covers GFDL, GPL, FAL and similar. Files whose license Commons does not list are kept only when the filter is empty.",
            "items": {
              "type": "string",
              "enum": [
                "public-domain",
                "cc-by",
                "cc-by-sa",
                "other"
              ],
              "enumTitles": [
                "Public domain / CC0",
                "CC BY (any version)",
                "CC BY-SA (any version)",
                "Other free licenses"
              ]
            },
            "default": []
          },
          "minWidth": {
            "title": "Min width (px)",
            "minimum": 0,
            "type": "integer",
            "description": "Skip images narrower than this. 0 = no filter. Example: 800.",
            "default": 0
          },
          "minHeight": {
            "title": "Min height (px)",
            "minimum": 0,
            "type": "integer",
            "description": "Skip images shorter than this. 0 = no filter. Example: 600.",
            "default": 0
          },
          "fileTypes": {
            "title": "File types to keep",
            "type": "array",
            "description": "Image types to download, taken from what Commons lists and checked again on the downloaded bytes. Search results for SVG vector drawings are only included when SVG is selected.",
            "items": {
              "type": "string",
              "enum": [
                "jpg",
                "png",
                "gif",
                "svg",
                "tiff",
                "webp"
              ],
              "enumTitles": [
                "JPG",
                "PNG",
                "GIF",
                "SVG",
                "TIFF",
                "WebP"
              ]
            },
            "default": [
              "jpg",
              "png",
              "gif",
              "svg",
              "tiff",
              "webp"
            ]
          },
          "convertTo": {
            "title": "Convert images to",
            "enum": [
              "original",
              "jpg",
              "png",
              "webp"
            ],
            "type": "string",
            "description": "Keep the original files, or convert raster images to JPG, PNG or WebP with Pillow. Transparency is flattened onto white for JPG. SVG files are kept as they are. Animations keep only the first frame. The credit data always describes the original file.",
            "default": "original"
          },
          "maxWidth": {
            "title": "Max width (px)",
            "minimum": 0,
            "maximum": 20000,
            "type": "integer",
            "description": "Shrink images wider than this, keeping the aspect ratio (never upscales). 0 = original size. Example: 1600.",
            "default": 0
          },
          "quality": {
            "title": "JPG / WebP quality",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "1 to 100, used when images are converted or resized to JPG or WebP. Example: 85.",
            "default": 85
          },
          "dedupe": {
            "title": "Skip duplicate files",
            "type": "boolean",
            "description": "Files with identical content (SHA-256) are delivered once; later copies get status duplicate and are not charged.",
            "default": true
          },
          "zip": {
            "title": "Also make one ZIP",
            "type": "boolean",
            "description": "Also save all delivered files in one images.zip in the key-value store, with manifest.csv and ATTRIBUTION.txt inside and a public link in the SUMMARY record. The ZIP itself is free.",
            "default": false
          },
          "zipMaxMb": {
            "title": "Max ZIP size (MB)",
            "minimum": 1,
            "maximum": 300,
            "type": "number",
            "description": "Files that would push the ZIP over this size are still saved and listed, but left out of the ZIP. Example: 100.",
            "default": 100
          },
          "outputStoreName": {
            "title": "Save files in a named store",
            "type": "string",
            "description": "Optional key-value store name, for example commons-lighthouses. Named stores are kept until you delete them, while a run's own store expires after your plan's retention period."
          },
          "concurrency": {
            "title": "Parallel downloads",
            "minimum": 1,
            "maximum": 8,
            "type": "integer",
            "description": "How many files are downloaded at the same time. Kept low on purpose: Wikimedia asks clients to be gentle. Example: 3.",
            "default": 3
          },
          "perHostDelayMs": {
            "title": "Delay per host (ms)",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Minimum time between two requests to the same Wikimedia host. At most 2 requests run at once per host. Example: 300.",
            "default": 300
          },
          "timeoutSecs": {
            "title": "Timeout per file (seconds)",
            "minimum": 5,
            "maximum": 600,
            "type": "integer",
            "description": "Time allowed for each download attempt. Failed requests are retried up to 3 times with backoff. Example: 60.",
            "default": 60
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Optional. Send requests through Apify Proxy or your own proxies. Usually not needed for Wikimedia. Each retry uses a new session.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}