{
  "openapi": "3.0.1",
  "info": {
    "title": "Telegram Channel Scraper & Analytics",
    "description": "Export posts, views and reactions from public Telegram channels, get channel stats (reach, engagement rate, posting frequency), search keywords and monitor new posts. No login, no account. $1 per 1,000 posts.",
    "version": "0.1",
    "x-build-id": "kopUykHSRzToPSgis"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/thelastscraper~telegram-channel-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-thelastscraper-telegram-channel-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/thelastscraper~telegram-channel-scraper/runs": {
      "post": {
        "operationId": "runs-sync-thelastscraper-telegram-channel-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/thelastscraper~telegram-channel-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-thelastscraper-telegram-channel-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",
        "required": [
          "channels"
        ],
        "properties": {
          "mode": {
            "title": "What to get",
            "enum": [
              "posts",
              "channel_report",
              "estimate"
            ],
            "type": "string",
            "description": "<b>Posts</b>: every post of the channels in a date range or up to N per channel, with numeric views and reactions; add keywords to search inside the channels; add a monitor name to get only new posts on a schedule. <b>Channel report</b>: one row per channel with exact subscribers, median and average views, reach (ERR), engagement rate, posting frequency and trend. <b>Estimate</b>: free; reads one page per channel and tells you how many posts and what each mode would cost.",
            "default": "posts"
          },
          "channels": {
            "title": "Channels",
            "type": "array",
            "description": "Public channel usernames or links: <code>telegram</code>, <code>@telegram</code>, <code>t.me/telegram</code>, <code>https://t.me/s/telegram</code>. A post link such as <code>t.me/telegram/441</code> starts from that post. Up to 500. Invite links and private chats are skipped; people, bots and groups are not read (channels only).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Keywords (search inside the channels)",
            "type": "array",
            "description": "Optional. Only posts that match, through Telegram's own in-channel search. All keywords of a channel are searched and merged: a post that matches two keywords is delivered and charged once, with both in <code>matched_keywords</code>. Each keyword query costs one lookup. Up to 20, 2-64 characters each.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "keywordMatch": {
            "title": "Keyword match",
            "enum": [
              "telegram",
              "strict"
            ],
            "type": "string",
            "description": "<b>strict</b> also requires the keyword in the post text (case- and accent-insensitive); after 2 pages in a row with no strict match the search of that keyword ends.",
            "default": "telegram"
          },
          "maxPostsPerChannel": {
            "title": "Max posts per channel",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Posts delivered per channel (newest first). 0 = the whole history, which can take hours: about 900 pages (7,000-18,000 posts) an hour.",
            "default": 100
          },
          "dateFrom": {
            "title": "From date",
            "type": "string",
            "description": "Optional: <code>YYYY-MM-DD</code> or <code>N days</code> (e.g. <code>30 days</code>). Posts older than this are not delivered.",
            "default": ""
          },
          "dateTo": {
            "title": "To date",
            "type": "string",
            "description": "Optional: <code>YYYY-MM-DD</code> or <code>N days</code>, inclusive. The Actor jumps to that date with at most 8 probes per channel, each charged as a lookup (with keywords too: Telegram's search has no date filter, so the search starts from that date).",
            "default": ""
          },
          "includeChannelInfo": {
            "title": "Include the channel card",
            "type": "boolean",
            "description": "Posts mode: one row per channel in the <code>channels</code> dataset with the exact subscriber count, title and description (charged as one channel card).",
            "default": true
          },
          "metricsSamplePosts": {
            "title": "Report: posts sampled",
            "minimum": 20,
            "maximum": 200,
            "type": "integer",
            "description": "Channel report: how many of the newest posts the metrics use (20-200).",
            "default": 100
          },
          "metricsMinPostAgeHours": {
            "title": "Report: minimum post age (hours)",
            "minimum": 0,
            "maximum": 168,
            "type": "integer",
            "description": "Posts younger than this are left out of the view statistics (their views are still growing).",
            "default": 24
          },
          "includePosts": {
            "title": "Report: also deliver the sampled posts",
            "type": "boolean",
            "description": "Channel report: the sampled posts go to the <code>posts</code> dataset (each charged as a post).",
            "default": false
          },
          "monitorName": {
            "title": "Monitor name",
            "type": "string",
            "description": "Turns the run into a monitor: schedule it and each run delivers only the new posts, plus a change row (views, reactions, edits, missing, deleted) for every recent post it re-checks, and the subscriber change. Lowercase letters, digits and hyphens. The state lives in your key-value store <code>tg-monitor-&lt;name&gt;</code>. In the channel report mode it records the subscriber history for growth.",
            "default": ""
          },
          "monitorTrackViewsDays": {
            "title": "Monitor: re-check posts younger than (days)",
            "minimum": 0,
            "maximum": 30,
            "type": "integer",
            "description": "Each run re-checks the posts younger than this (one change row each: post-update when it changed, post-snapshot when not), at most the newest 500 per channel (on a channel posting 100 a day, 30 days means about 5). 0 = new posts only.",
            "default": 3
          },
          "monitorFirstRun": {
            "title": "Monitor: first run",
            "enum": [
              "deliver",
              "baseline_only"
            ],
            "type": "string",
            "description": "The first run of a monitor delivers posts like a normal run, or only records where to start (charging only the channel cards).",
            "default": "deliver"
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "spreadsheet",
              "full_json"
            ],
            "type": "string",
            "description": "Flat rows for CSV/Excel, or the full nested records.",
            "default": "spreadsheet"
          },
          "includeTextHtml": {
            "title": "Include the text as HTML",
            "type": "boolean",
            "description": "Adds <code>text_html</code> (the post's formatting and links).",
            "default": false
          },
          "delaySeconds": {
            "title": "Pause between requests (seconds)",
            "minimum": 2,
            "maximum": 6,
            "type": "integer",
            "description": "A polite pace: 2-6 s between requests, plus up to 1 s of random jitter. If t.me rate-limits, the Actor slows down once (never beyond 6 s) and then stops with what it has.",
            "default": 3
          },
          "maxRequests": {
            "title": "Max requests",
            "minimum": 0,
            "type": "integer",
            "description": "A hard cap on t.me requests in this run, retries included (0 = no cap). Use Max charge per run for a money cap.",
            "default": 0
          },
          "jitterSeconds": {
            "title": "Jitter (seconds)",
            "minimum": 0,
            "maximum": 1,
            "type": "integer",
            "description": "Random extra pause, 0-1 s.",
            "default": 1
          },
          "useApifyDatacenterProxy": {
            "title": "Use Apify datacenter proxy (experimental)",
            "type": "boolean",
            "description": "Experimental: route requests through Apify's datacenter proxy. Off by default.",
            "default": false
          },
          "recordEgressIp": {
            "title": "Record the egress IP (validation)",
            "type": "boolean",
            "description": "Validation only: asks Apify's own api.apify.com/v2/browser-info (not t.me) for the run's public IP and writes it to RUN_REPORT.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}