{
  "openapi": "3.0.1",
  "info": {
    "title": "X Trends History Archive: Hourly Timeline & Rank History",
    "description": "Cookieless X (Twitter) trend history by country or city. Returns the last 24 hourly snapshots, dated archive lists, per-trend rank histories across 24 hours, 7 days, 30 days and a year, and longest-trending or most-tweeted leaderboards.",
    "version": "1.0",
    "x-build-id": "V74YbravgSfTy7h13"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/xyrelith-data~twitter-trends-history/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-xyrelith-data-twitter-trends-history",
        "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/xyrelith-data~twitter-trends-history/runs": {
      "post": {
        "operationId": "runs-sync-xyrelith-data-twitter-trends-history",
        "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/xyrelith-data~twitter-trends-history/run-sync": {
      "post": {
        "operationId": "run-sync-xyrelith-data-twitter-trends-history",
        "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": "Mode",
            "enum": [
              "hourlyTimeline",
              "dateRangeArchive",
              "trendLookup",
              "topLists",
              "locations"
            ],
            "type": "string",
            "description": "hourlyTimeline: aggregate the last 24 hourly snapshots per trend. dateRangeArchive: ranked lists for chosen UTC date-hours. trendLookup: rank history for named trends. topLists: most-tweeted or longest-trending leaderboards. locations: supported countries and cities.",
            "default": "hourlyTimeline"
          },
          "locations": {
            "title": "Locations",
            "type": "array",
            "description": "Country or country/city names, slugs or ISO codes, for example United States, US, Japan, United Kingdom/London or united-states/new-york. In trendLookup the first location is the context for currentRank; worldwide rank is always included.",
            "default": [
              "United States"
            ],
            "items": {
              "type": "string"
            }
          },
          "trends": {
            "title": "Trends (trendLookup)",
            "type": "array",
            "description": "Trend names or hashtags to look up, for example Gane, #UFC334, #HookEm.",
            "default": [
              "Gane"
            ],
            "items": {
              "type": "string"
            }
          },
          "startDate": {
            "title": "Start date (dateRangeArchive)",
            "type": "string",
            "description": "First UTC date to archive, in YYYY-MM-DD format. Empty means today (UTC)."
          },
          "endDate": {
            "title": "End date (dateRangeArchive)",
            "type": "string",
            "description": "Last UTC date to archive, inclusive, in YYYY-MM-DD format. Empty means today (UTC)."
          },
          "hours": {
            "title": "UTC hours (dateRangeArchive)",
            "type": "array",
            "description": "Hours of day to fetch, 0-23. Leave empty for every hour. Example: 8, 12, 18.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "trendType": {
            "title": "Trend type",
            "enum": [
              "all",
              "hashtagsOnly",
              "excludeHashtags"
            ],
            "type": "string",
            "description": "Keep all trends, hashtags only, or everything except hashtags.",
            "default": "all"
          },
          "keywordContains": {
            "title": "Keyword contains",
            "type": "string",
            "description": "Keep only trends containing this text (case-insensitive)."
          },
          "keywordExcludes": {
            "title": "Keyword excludes",
            "type": "string",
            "description": "Drop trends containing this text (case-insensitive)."
          },
          "maxRank": {
            "title": "Maximum rank",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "Drop trends ranked below this position (1-50).",
            "default": 50
          },
          "maxItems": {
            "title": "Maximum rows",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Hard cap on dataset rows. The daily prefill uses 3.",
            "default": 500
          },
          "maxSnapshots": {
            "title": "Maximum snapshots",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Hourly timeline: newest snapshots to aggregate (max 25). Date-range archive: total requested date-hours (max 200).",
            "default": 48
          },
          "fillMissingHours": {
            "title": "Fill missing timeline hours",
            "type": "boolean",
            "description": "For countries, fill hours that trends24 does not cover with getdaytrends relative-hour lists, extending the timeline toward a full 24 hours. Cities stay on trends24 only.",
            "default": true
          },
          "groupBy": {
            "title": "Timeline rows",
            "enum": [
              "trend",
              "snapshot"
            ],
            "type": "string",
            "description": "trend: one row per trend with rankHistory and aggregates. snapshot: one row per trend per snapshot.",
            "default": "trend"
          },
          "includeRankHistory": {
            "title": "Include rank history",
            "type": "boolean",
            "description": "Add rankHistory arrays to timeline rows and rankHistory24h/7d/30d/year arrays to trendLookup rows.",
            "default": true
          },
          "includeSearchUrls": {
            "title": "Include search URLs",
            "type": "boolean",
            "description": "Add X search links for every trend.",
            "default": true
          },
          "archiveFallback": {
            "title": "Use Wayback fallback",
            "type": "boolean",
            "description": "When an older dated list is unavailable from getdaytrends, try the Internet Archive's snapshots of trends24.",
            "default": true
          },
          "period": {
            "title": "Top-list period",
            "enum": [
              "day",
              "week",
              "month",
              "year"
            ],
            "type": "string",
            "description": "Leaderboard window for topLists.",
            "default": "week"
          },
          "metric": {
            "title": "Top-list metric",
            "enum": [
              "mostTweeted",
              "longestTrending",
              "both"
            ],
            "type": "string",
            "description": "Most-tweeted leaderboard, longest-trending leaderboard, or both.",
            "default": "both"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}