{
  "openapi": "3.0.1",
  "info": {
    "title": "Telegram Public Channel Scraper",
    "description": "Scrape posts from public Telegram channels: text, views, reactions, media, polls, forwards and replies. Monitor many channels with only-new-posts mode, date ranges, in-channel search and a webhook.",
    "version": "1.0",
    "x-build-id": "WwzSaQ5IvZH1jk4cs"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/frank_conifer_af4~telegram-channel-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-frank_conifer_af4-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/frank_conifer_af4~telegram-channel-scraper/runs": {
      "post": {
        "operationId": "runs-sync-frank_conifer_af4-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/frank_conifer_af4~telegram-channel-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-frank_conifer_af4-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": {
          "channels": {
            "title": "Channels",
            "minItems": 1,
            "maxItems": 5000,
            "type": "array",
            "description": "One public channel per line. Accepts a username (durov), @durov, t.me/durov, https://t.me/s/durov or a post link like t.me/durov/123 (the channel is taken from it). Only public channels with a web preview work. Private invite links, groups, bots and users get a free status row explaining why.",
            "items": {
              "type": "string"
            }
          },
          "maxPostsPerChannel": {
            "title": "Max posts per channel",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Upper limit of post rows per channel, newest first. This caps your cost: each post row is one charged event. Telegram shows about 20 posts per page, so 100 posts take about 5 page requests (about 5 seconds) per channel.",
            "default": 100
          },
          "dateFrom": {
            "title": "Posts from (oldest date)",
            "type": "string",
            "description": "Only posts published on or after this date (UTC). Paging stops as soon as older posts are reached, so a recent date makes runs faster and cheaper. Use YYYY-MM-DD, a full ISO timestamp, or a relative value like 7 days."
          },
          "dateTo": {
            "title": "Posts until (newest date)",
            "type": "string",
            "description": "Only posts published on or before this date (UTC, a date-only value includes that whole day). For old date ranges the Actor jumps back with a few probe requests (binary search by post ID) instead of paging through every newer post. Leave empty in monitoring mode."
          },
          "searchQuery": {
            "title": "Search within each channel",
            "type": "string",
            "description": "Optional. Returns only posts that match this text, using Telegram's own in-channel search (the same as the search box on t.me/s/name). Works with words, phrases, #hashtags and $cashtags, for example bitcoin, #AI or $TON. Leave empty for all posts."
          },
          "deepSearch": {
            "title": "Deep search (beyond Telegram's ~20 results)",
            "type": "boolean",
            "description": "Telegram's built-in search returns only the ~20 most recent matches per channel. Turn this on to page through the channel history instead and match the search text locally (case-insensitive, every word or \"quoted phrase\" must appear in the text, link preview, poll or file name). Only matching posts are charged, but scanning is slower: about 1 second per 20 posts, at most 10,000 posts per channel. Combine with Posts from to bound the scan.",
            "default": false
          },
          "onlyNewPosts": {
            "title": "Only new posts since the last run",
            "type": "boolean",
            "description": "Monitoring mode. The newest post ID per channel is stored in the named key-value store below. Each run outputs (and charges) only posts newer than that. The first run is the baseline: it returns up to Max posts per channel and remembers where it stopped. Schedule the Actor with the same input to get a feed of new posts.",
            "default": false
          },
          "stateStoreName": {
            "title": "State store name",
            "type": "string",
            "description": "Named key-value store that keeps the last seen post ID per channel between runs (only used with Only new posts). Use a different name per watchlist or schedule to keep separate baselines. A search query gets its own baseline automatically. Lowercase letters, digits and hyphens.",
            "default": "telegram-channel-state"
          },
          "webhookUrl": {
            "title": "Webhook URL for new posts",
            "type": "string",
            "description": "Optional. After the run, a JSON summary (posts per channel, up to 20 latest posts each with URL, date, views and text snippet) is POSTed here, only when at least one post was returned. The payload has a Slack-compatible text field, so a Slack incoming webhook works directly. Not charged."
          },
          "includeChannelInfo": {
            "title": "Include channel info row",
            "type": "boolean",
            "description": "Adds one free row per channel with title, description, exact subscriber count, photo/video/file/link counters, avatar, verified flag and the latest post date. Costs one extra request per channel.",
            "default": true
          },
          "includeTextHtml": {
            "title": "Also include post HTML",
            "type": "boolean",
            "description": "Adds textHtml (the formatted post body with bold, links and custom emoji markup) next to the plain text. Makes the dataset larger.",
            "default": false
          },
          "maxConcurrency": {
            "title": "Channels processed in parallel",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many channels are scraped at the same time. Each channel is paged at most once per second and all requests to t.me are spaced out, so higher values mainly help with long channel lists.",
            "default": 3
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. The public web preview usually works without a proxy. A proxy spreads requests over several IPs for large channel lists or when t.me rate-limits your IP. Leave empty to use direct requests."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}