{
  "openapi": "3.0.1",
  "info": {
    "title": "Wikipedia Pageviews: Topic Trends, Top Articles by Country",
    "description": "Reader interest from the official Wikimedia pageviews API: one row per article and date with exact views, share of the wiki's traffic and change against the previous bucket. Also the most-read articles of a language edition, the top articles opened in a country, and which countries read a wiki.",
    "version": "0.1",
    "x-build-id": "47mdvEfwQrlNu06Gs"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/yadroo~wikipedia-pageviews-trends/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-yadroo-wikipedia-pageviews-trends",
        "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/yadroo~wikipedia-pageviews-trends/runs": {
      "post": {
        "operationId": "runs-sync-yadroo-wikipedia-pageviews-trends",
        "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/yadroo~wikipedia-pageviews-trends/run-sync": {
      "post": {
        "operationId": "run-sync-yadroo-wikipedia-pageviews-trends",
        "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": {
          "mode": {
            "title": "What to read",
            "enum": [
              "articleTrends",
              "topArticles",
              "topByCountry",
              "countryBreakdown"
            ],
            "type": "string",
            "description": "One run answers one question. `articleTrends`: interest in the titles you list over a date range. `topArticles`: ranks every article of one wiki per day or month in the range. `topByCountry`: ranks what readers in a country opened on a day, across all Wikimedia projects (per day only). `countryBreakdown`: ranks the countries behind one wiki's traffic (per month only). Every row names its mode in `mode`; fields that do not apply to it are left empty.",
            "default": "articleTrends"
          },
          "articles": {
            "title": "Article titles (article trends)",
            "maxItems": 50,
            "type": "array",
            "description": "One page title per line, as the wiki writes it: `Artificial intelligence`, `Bitcoin`, `Kazakhstan`. Spaces and underscores are the same, and a pasted article link is reduced to its title. On Wikipedia editions the first letter is capitalised as the wiki does (`bitcoin` is read as `Bitcoin`); the rest is matched letter by letter (`McDonald's`, `DNA`), and a redirect counts separately from its target. An unknown title gives one `found: false` row. One request per title. Article-trends mode only.",
            "items": {
              "type": "string"
            }
          },
          "project": {
            "title": "Wiki (language edition or sister project)",
            "type": "string",
            "description": "Which wiki the views are counted on, as `<code>.<project>`: `en.wikipedia`, `ru.wikipedia`, `kk.wikipedia`, `commons.wikimedia`, `www.wikidata`. Pick a suggestion or type any project the API serves. A trailing `.org`, a pasted wiki address, case, spaces, the bare language code and the English language name (`ru`, `russian`) are accepted; anything else stops the run with the closest ids named. Empty reads `en.wikipedia` and the status says so. Ignored by the top-by-country mode."
          },
          "countries": {
            "title": "Countries (top articles in a country)",
            "maxItems": 10,
            "type": "array",
            "description": "One two-letter country code per line (`US`, `DE`, `GB`, `JP`, `BR`; ISO 3166-1 alpha-2). Lower case and the English names of about a hundred large countries (`United States`, `Germany`) are accepted; any other value stops the run with the closest codes named. The API withholds data for small or at-risk territories: a country with nothing in the whole range comes back as one `found: false` row. Top-by-country mode only.",
            "items": {
              "type": "string"
            }
          },
          "granularity": {
            "title": "One row per",
            "enum": [
              "daily",
              "monthly"
            ],
            "type": "string",
            "description": "`daily`: one bucket per calendar day (UTC), for spikes and week-day patterns. `monthly`: one bucket per calendar month, steadier for long ranges; a range starting or ending mid-month is widened to whole months and a month not over yet is left out. Two modes have one resolution only (country breakdown per month, top by country per day): this field is ignored there and the run status says so.",
            "default": "daily"
          },
          "sinceDays": {
            "title": "Last N days",
            "minimum": 1,
            "maximum": 3650,
            "type": "integer",
            "description": "Rolling window counted back from the newest finished day (UTC) when no fixed dates are given: `7` for last week, `30` for last month, `365` for a year. Made for schedules - the window moves with every run, so a task never needs editing. The API publishes a day about one day after it ends, so the newest bucket of a daily run is normally yesterday (UTC); early in the UTC day it may be the day before.",
            "default": 30
          },
          "startDate": {
            "title": "From date (YYYY-MM-DD)",
            "pattern": "^[0-9]{4}-[0-9]{2}(-[0-9]{2})?$",
            "type": "string",
            "description": "Fixed start of the range, in UTC. Set it together with the end date to pin a period a report refers to; on its own it is combined with the newest published day. `2026-01` is accepted as shorthand for the first day of that month."
          },
          "endDate": {
            "title": "To date (YYYY-MM-DD)",
            "pattern": "^[0-9]{4}-[0-9]{2}(-[0-9]{2})?$",
            "type": "string",
            "description": "Fixed end of the range, in UTC, inclusive. On its own it is combined with the rolling window above. A date after the newest published day is pulled back to it, and the run status says which day it actually ended on. `2026-01` is read as the last day of that month."
          },
          "access": {
            "title": "Device type",
            "enum": [
              "all-access",
              "desktop",
              "mobile-web",
              "mobile-app"
            ],
            "type": "string",
            "description": "Counts views made through one channel. Running the same titles twice, once with `desktop` and once with `mobile-web`, shows how a topic is read - news-driven topics are heavily mobile, reference topics much less so. Every mode supports this filter and every row repeats the value in `access`.",
            "default": "all-access"
          },
          "agent": {
            "title": "Who viewed (article trends)",
            "enum": [
              "user",
              "all-agents",
              "spider",
              "automated"
            ],
            "type": "string",
            "description": "`user` leaves out traffic Wikimedia classified as crawlers or automated clients, which keeps a curve comparable over months. `all-agents` keeps everything and is higher, sometimes much higher after a bot wave. `spider` and `automated` isolate those two classes, to check whether a spike was human. The ranking modes have no such filter (their numbers include every agent): applies to article trends only, left empty in other rows.",
            "default": "user"
          },
          "excludeNonArticles": {
            "title": "Drop main pages and special pages from rankings",
            "type": "boolean",
            "description": "On (default): the ranking modes skip titles that are not articles - the wiki's own front page, the search page, and anything in a namespace such as `Special:`, `Wikipedia:`, `Portal:`, `Talk:` or their translated forms. Those entries normally hold the first ranks and crowd out the topics a ranking is wanted for. Ranks are kept as the API numbered them, so a gap in the numbers shows where something was dropped. Off: every entry is written as received.",
            "default": true
          },
          "includeShare": {
            "title": "Add share of the wiki's traffic (article trends)",
            "type": "boolean",
            "description": "On (default): each article row also carries `projectViews` - everything the wiki served in that bucket - and `shareOfProjectPct`, the article's percentage of it. The share is what makes two years, two wikis or two topics comparable, because it cancels the seasonal rise and fall of Wikipedia traffic as a whole. It costs one extra request per run, not per article. Off: both columns are left empty.",
            "default": true
          },
          "onlyNew": {
            "title": "Only buckets this input has not returned before",
            "type": "boolean",
            "description": "Remember which wiki, article or country and date each row covered, and on the next run of the same actor or task write only buckets that were not written before - so a daily schedule appends yesterday instead of resending the whole history. The first run writes everything in range. Memory belongs to the actor or task, so two tasks watching two wikis never mix. A bucket the API later revises is not resent.",
            "default": false
          },
          "maxItems": {
            "title": "Maximum rows",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Hard cap on the rows this run writes, and so on what it costs. The cap is spread over the titles, countries and buckets you asked for, newest bucket first, so a capped run holds the most recent data of every entity instead of all of the first one. In the ranking modes one request returns up to 1,000 ranks of one bucket, so a cap of 50 on a single day answers with the top 50.",
            "default": 50
          },
          "fields": {
            "title": "Only these columns",
            "type": "array",
            "description": "Keep only the named columns, in this order - for example `article, date, views, shareOfProjectPct`. Empty = every column. `mode`, `project`, `article`, `date`, `views`, `found`, `url` and `fetchedAt` are always written; name one of them here and it moves to the position you gave it. An unknown name is reported in the run status rather than dropped in silence.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}