{
  "openapi": "3.0.1",
  "info": {
    "title": "Twitter (X) Trends Scraper & API: Trending Topics by Country",
    "description": "Scrape Twitter (X) trends without login: top 50 trending topics and hashtags in 467 locations (worldwide, 62 countries, 400+ cities), with the last 24 hours of every trend, trends of any past day since 2023, top hashtags of the week, month or year, and new trend alerts.",
    "version": "0.1",
    "x-build-id": "21AmbVO6fHRSCjqXt"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/s_actors~x-trends-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-s_actors-x-trends-scraper",
        "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/s_actors~x-trends-scraper/runs": {
      "post": {
        "operationId": "runs-sync-s_actors-x-trends-scraper",
        "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/s_actors~x-trends-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-s_actors-x-trends-scraper",
        "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 scrape",
            "enum": [
              "now",
              "history",
              "top"
            ],
            "type": "string",
            "description": "Trending now: the current top 50 of each location, with the last 24 hours of every trend (best rank, hours trending, first seen, rank an hour ago). Past days: the trends of any day or hour since June 2023 (countries and worldwide). Top hashtags: the hashtags that trended most in the last day, week, month or year.",
            "default": "now"
          },
          "locations": {
            "title": "Locations",
            "type": "array",
            "description": "Worldwide, countries and cities, one per line: \"worldwide\", a country name or ISO code (\"United States\", \"US\", \"UK\", \"India\"), a city (\"London\", \"Mumbai\", \"Los Angeles\", \"Birmingham, United States\") or a trends24.in link. 467 locations: worldwide, 62 countries and 400+ cities. Past days and top hashtags: worldwide and countries only.",
            "default": [
              "worldwide"
            ],
            "items": {
              "type": "string"
            }
          },
          "maxTrendsPerLocation": {
            "title": "Trends per location",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Top N of each list. Trending now and past days: up to 50 (X shows 50), with the daily summary the trends that reached this top N in any hour. Top hashtags: up to 100.",
            "default": 50
          },
          "keywords": {
            "title": "Must contain",
            "type": "array",
            "description": "Only trends that contain one of these words (brand monitoring), e.g. \"nike\", \"election\". Empty = all trends.",
            "items": {
              "type": "string"
            }
          },
          "hashtagsOnly": {
            "title": "Hashtags only",
            "type": "boolean",
            "description": "Only trends that start with #.",
            "default": false
          },
          "includeHourlyRanks": {
            "title": "Hourly ranks",
            "type": "boolean",
            "description": "Add the rank of every hour the trend was in the top 50 (hourlyRanks) to each row.",
            "default": true
          },
          "onlyNew": {
            "title": "Only new trends",
            "type": "boolean",
            "description": "Output only trends that were not in this location's list in the previous runs (with the same monitor name). Schedule the Actor every hour to get new trends as alerts. Every row also has isNew and previousRank.",
            "default": false
          },
          "monitorName": {
            "title": "Monitor name",
            "type": "string",
            "description": "Keeps the memory of new trends apart for different schedules."
          },
          "dates": {
            "title": "Dates",
            "type": "array",
            "description": "Days to get (What to scrape = Past days), UTC: YYYY-MM-DD from 2023-06-03, \"yesterday\", \"today\" or \"7 days ago\". Default: yesterday.",
            "items": {
              "type": "string"
            }
          },
          "hours": {
            "title": "Hours (UTC)",
            "type": "array",
            "description": "Hours of the day, 0-23 UTC. Empty = all 24 hours.",
            "items": {
              "type": "string"
            }
          },
          "historyOutput": {
            "title": "Past days output",
            "enum": [
              "daily",
              "hourly"
            ],
            "type": "string",
            "description": "Daily summary: one row per trend per day with its best rank, hours in the top 50, first and last hour. Hourly lists: one row per trend per hour (50 rows an hour).",
            "default": "daily"
          },
          "topType": {
            "title": "Top list",
            "enum": [
              "tweeted",
              "longest"
            ],
            "type": "string",
            "description": "Most tweeted: by the trend score of getdaytrends. Longest trending: by the total time in the trends.",
            "default": "tweeted"
          },
          "topPeriod": {
            "title": "Period",
            "enum": [
              "day",
              "week",
              "month",
              "year"
            ],
            "type": "string",
            "description": "Period of the top list.",
            "default": "day"
          },
          "debugLog": {
            "title": "Debug log",
            "type": "boolean",
            "description": "Log every request retry.",
            "default": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}