{
  "openapi": "3.0.1",
  "info": {
    "title": "Telegram Scraper",
    "description": "Telegram scraper for public channels: messages, views, reactions, media, links, polls, comments, subscriber counts and engagement stats, with keyword and date filters. No login. Export JSON, CSV or Excel.",
    "version": "1.1",
    "x-build-id": "k2IKUyqFujbezFToA"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/crawl_craft~telegram-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-crawl_craft-telegram-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/crawl_craft~telegram-scraper/runs": {
      "post": {
        "operationId": "runs-sync-crawl_craft-telegram-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/crawl_craft~telegram-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-crawl_craft-telegram-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": {
          "urls": {
            "title": "📡 Channels, links or usernames",
            "type": "array",
            "description": "One entry per line: a channel username (durov), an @handle, a channel link (https://t.me/telegram), a post link (https://t.me/durov/528) or a channel search link (https://t.me/s/durov?q=ton). Every entry runs on its own.",
            "items": {
              "type": "string"
            }
          },
          "maxItems": {
            "title": "🔢 Max messages per channel",
            "minimum": 0,
            "type": "integer",
            "description": "The most messages saved for each input. Three channels with 50 give up to 150 messages. 0 means every matching message.",
            "default": 10
          },
          "collectMessages": {
            "title": "💬 Collect messages",
            "type": "boolean",
            "description": "On: saves the channel messages. Off: saves only the channel profiles (name, description, subscribers).",
            "default": true
          },
          "dateFrom": {
            "title": "⏪ Messages newer than",
            "type": "string",
            "description": "Only messages posted on or after this date. Pick a date, or a relative value such as 7 days, 12 hours or 1 month."
          },
          "dateTo": {
            "title": "⏩ Messages older than",
            "type": "string",
            "description": "Only messages posted on or before this date. Same options as above."
          },
          "scrapeLastNDays": {
            "title": "📆 Messages from the last N days",
            "minimum": 0,
            "type": "integer",
            "description": "1 = today only, 2 = yesterday and today, and so on. If a start date is set too, the more recent of the two is used."
          },
          "searchQueries": {
            "title": "🔍 Search inside channels",
            "type": "array",
            "description": "Search words that Telegram's own channel search runs on every channel. Leave empty to read the channel feed.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "includeKeywords": {
            "title": "🏷️ Keep messages containing",
            "type": "array",
            "description": "A message is kept only if it contains one of these words (or all of them, see match mode).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "excludeKeywords": {
            "title": "🚫 Drop messages containing",
            "type": "array",
            "description": "Messages containing any of these words are skipped.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "keywordMatch": {
            "title": "🧩 Keyword match mode",
            "enum": [
              "any",
              "all"
            ],
            "type": "string",
            "description": "Whether a message needs any one or all of the \"Keep messages containing\" words.",
            "default": "any"
          },
          "keywordRegex": {
            "title": "🧪 Keywords are regular expressions",
            "type": "boolean",
            "description": "Treat the keyword lists as regular expressions instead of plain words.",
            "default": false
          },
          "caseSensitive": {
            "title": "🔠 Case-sensitive keywords",
            "type": "boolean",
            "description": "Match upper and lower case letters exactly.",
            "default": false
          },
          "contentTypes": {
            "title": "🖼️ Only these content types",
            "type": "array",
            "description": "Keep only messages that contain one of the selected content types. Leave empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "text",
                "photo",
                "video",
                "gif",
                "document",
                "audio",
                "voice",
                "round_video",
                "sticker",
                "poll",
                "link_preview"
              ],
              "enumTitles": [
                "Text",
                "Photo",
                "Video",
                "GIF",
                "Document",
                "Audio",
                "Voice message",
                "Round video",
                "Sticker",
                "Poll",
                "Link preview"
              ]
            },
            "default": []
          },
          "minViews": {
            "title": "👁️ Minimum views",
            "minimum": 0,
            "type": "integer",
            "description": "Skip messages with fewer views than this.",
            "default": 0
          },
          "minReactions": {
            "title": "❤️ Minimum reactions",
            "minimum": 0,
            "type": "integer",
            "description": "Skip messages with fewer reactions in total than this.",
            "default": 0
          },
          "forwards": {
            "title": "🔀 Forwarded messages",
            "enum": [
              "include",
              "exclude",
              "only"
            ],
            "type": "string",
            "description": "Include, hide or keep only messages forwarded from other channels.",
            "default": "include"
          },
          "includeServiceMessages": {
            "title": "🛎️ Include service messages",
            "type": "boolean",
            "description": "Also save notices such as \"channel created\" or \"photo updated\".",
            "default": false
          },
          "messageIdFrom": {
            "title": "🏁 First message ID",
            "minimum": 1,
            "type": "integer",
            "description": "Only messages with this ID or higher."
          },
          "messageIdTo": {
            "title": "🚩 Last message ID",
            "minimum": 1,
            "type": "integer",
            "description": "Only messages with this ID or lower."
          },
          "exactSubscriberCount": {
            "title": "👥 Exact subscriber count",
            "type": "boolean",
            "description": "Shows 10459608 instead of the rounded 10.4M.",
            "default": true
          },
          "channelStats": {
            "title": "📊 Channel statistics",
            "type": "boolean",
            "description": "Adds average views, engagement, posting frequency, top hashtags and more to the Channels table.",
            "default": true
          },
          "extractEntities": {
            "title": "🔗 Extract hashtags, links and contacts",
            "type": "boolean",
            "description": "Adds hashtags, mentions, links, emails, phone numbers and crypto addresses found in each message.",
            "default": true
          },
          "includeHtml": {
            "title": "🧾 Include message HTML",
            "type": "boolean",
            "description": "Adds the formatted text (bold, links) of each message.",
            "default": false
          },
          "collectComments": {
            "title": "🗨️ Collect comments",
            "type": "boolean",
            "description": "Saves the public comments of messages whose channel has a discussion group.",
            "default": false
          },
          "maxCommentsPerPost": {
            "title": "💭 Max comments per message",
            "minimum": 0,
            "type": "integer",
            "description": "0 means every comment.",
            "default": 10
          },
          "discoverRelatedChannels": {
            "title": "🧭 Discover related channels",
            "type": "boolean",
            "description": "Also scrapes channels found in forwards, mentions and links of the messages.",
            "default": false
          },
          "discoveryDepth": {
            "title": "🪜 Discovery depth",
            "minimum": 1,
            "maximum": 3,
            "type": "integer",
            "description": "How many levels of related channels to follow.",
            "default": 1
          },
          "maxDiscoveredChannels": {
            "title": "🛰️ Max discovered channels",
            "minimum": 1,
            "type": "integer",
            "description": "Upper limit of related channels added to the run.",
            "default": 20
          },
          "downloadMedia": {
            "title": "📥 Save media files",
            "type": "boolean",
            "description": "Telegram media links expire. Turn this on to save the files to the run storage.",
            "default": false
          },
          "mediaTypesToDownload": {
            "title": "📼 Media types to save",
            "type": "array",
            "description": "Which kinds of media files to save.",
            "items": {
              "type": "string",
              "enum": [
                "photo",
                "video",
                "gif",
                "voice",
                "round_video",
                "sticker"
              ],
              "enumTitles": [
                "Photos",
                "Videos",
                "GIFs",
                "Voice messages",
                "Round videos",
                "Stickers"
              ]
            },
            "default": [
              "photo"
            ]
          },
          "maxMediaSizeMB": {
            "title": "📏 Max file size (MB)",
            "minimum": 0,
            "type": "integer",
            "description": "Files larger than this are skipped. 0 uses the 200 MB safety limit.",
            "default": 20
          },
          "incrementalMode": {
            "title": "🔔 Only new messages since the last run",
            "type": "boolean",
            "description": "Remembers the newest message of every channel and returns only newer ones on the next run. Ideal for scheduled runs.",
            "default": false
          },
          "outputMode": {
            "title": "🗂️ Result layout",
            "enum": [
              "messages",
              "legacy"
            ],
            "type": "string",
            "description": "Messages: one rich row per message. Compact: one row per message in a flat layout (username, fullName, followers, message).",
            "default": "messages"
          },
          "concurrency": {
            "title": "🚀 Parallel requests",
            "minimum": 1,
            "maximum": 32,
            "type": "integer",
            "description": "How many pages load at the same time. Lower it if many pages fail.",
            "default": 8
          },
          "maxRetries": {
            "title": "🔄 Retries",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How often a failed page is tried again.",
            "default": 3
          },
          "requestTimeout": {
            "title": "⏲️ Timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "How long to wait for one page.",
            "default": 40
          },
          "maxScanned": {
            "title": "🧮 Max messages checked per channel",
            "minimum": 100,
            "type": "integer",
            "description": "Safety limit when filters are strict: stops after this many messages were checked.",
            "default": 20000
          },
          "proxyConfiguration": {
            "title": "🌐 Proxy",
            "type": "object",
            "description": "Optional. Leave as is for automatic handling, or choose your own proxy settings.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}