{
  "openapi": "3.0.1",
  "info": {
    "title": "Telegram Channel Scraper: Posts, Messages, Comments, Search",
    "description": "Get posts from public Telegram channels by username or t.me link: text, date, views, reactions, media links, forwards, replies, comments and channel info. Search inside a channel, read full history or a date range, or return only new posts. No login. $0.90 per 1,000 posts; errors are free.",
    "version": "0.2",
    "x-build-id": "gzfE3bLCNzeqYc7Mn"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/data-for-agents~telegram-channel-posts/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-data-for-agents-telegram-channel-posts",
        "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/data-for-agents~telegram-channel-posts/runs": {
      "post": {
        "operationId": "runs-sync-data-for-agents-telegram-channel-posts",
        "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/data-for-agents~telegram-channel-posts/run-sync": {
      "post": {
        "operationId": "run-sync-data-for-agents-telegram-channel-posts",
        "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": {
          "channels": {
            "title": "Channels",
            "type": "array",
            "description": "Public Telegram channels, one per line: a username (durov), @durov, or a link (https://t.me/durov, t.me/s/durov).",
            "items": {
              "type": "string"
            }
          },
          "postUrls": {
            "title": "Exact posts",
            "type": "array",
            "description": "Links to single posts, like https://t.me/durov/548: each post is returned as it is now (views, reactions, comments). Optional; use it with or without channels.",
            "items": {
              "type": "string"
            }
          },
          "discoverKeywords": {
            "title": "Find channels by keyword",
            "type": "array",
            "description": "Topics to find channels for on Google (site:t.me), for example 'crypto news'. Each channel found is read with the settings below; rows have discovered: true and discovered_by. Charged per Google results page read.",
            "items": {
              "type": "string"
            }
          },
          "googlePagesPerKeyword": {
            "title": "Google pages per keyword",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "About 10 results per page.",
            "default": 1
          },
          "maxRelatedChannels": {
            "title": "Also read related channels",
            "minimum": 0,
            "maximum": 500,
            "type": "integer",
            "description": "Find up to this many more channels that your channels' posts forward from, link to or mention, and read them with the same settings (search terms, dates, filters). Rows from them have discovered: true. 0 means off.",
            "default": 0
          },
          "maxPostsPerChannel": {
            "title": "Max posts per channel",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "How many posts to return from each channel, newest first. With search terms or filters, how many matching posts.",
            "default": 100
          },
          "dateFrom": {
            "title": "Posts from",
            "type": "string",
            "description": "Oldest post date to include: 2026-01-31, 2026-01-31T08:00:00Z, or relative like 7 days, 24 hours, 3 months. Optional."
          },
          "dateTo": {
            "title": "Posts until",
            "type": "string",
            "description": "Newest post date to include, same formats. A bare date includes that whole day. Optional; empty means now."
          },
          "searchTerms": {
            "title": "Search terms",
            "type": "array",
            "description": "Return only posts that contain these words, searched inside every channel above. Two words need both words; put a phrase in quotes for the exact phrase. Optional.",
            "items": {
              "type": "string"
            }
          },
          "searchDepth": {
            "title": "Search depth",
            "enum": [
              "deep",
              "fast"
            ],
            "type": "string",
            "description": "Fast: Telegram's own search, which stops at about the 22 newest matches per term. Deep: Telegram's search, then the channel's older posts are read and matched too, up to 'Max posts to scan'.",
            "default": "deep"
          },
          "wholeWords": {
            "title": "Whole words only",
            "type": "boolean",
            "description": "Match search and exclude terms as whole words: 'ton' then does not match 'Boston'.",
            "default": false
          },
          "excludeTerms": {
            "title": "Exclude posts containing",
            "type": "array",
            "description": "Skip posts that contain any of these words. Optional.",
            "items": {
              "type": "string"
            }
          },
          "mediaTypes": {
            "title": "Only posts with",
            "uniqueItems": true,
            "type": "array",
            "description": "Return only posts that have at least one of these. Empty means all posts.",
            "items": {
              "type": "string",
              "enum": [
                "photo",
                "video",
                "round_video",
                "voice",
                "audio",
                "document",
                "sticker",
                "poll",
                "link_preview",
                "location",
                "no_media"
              ],
              "enumTitles": [
                "Photo",
                "Video",
                "Round video",
                "Voice message",
                "Audio file",
                "Document or file",
                "Sticker",
                "Poll",
                "Link preview",
                "Location",
                "Text only (no media)"
              ]
            }
          },
          "minViews": {
            "title": "Minimum views",
            "minimum": 0,
            "type": "integer",
            "description": "Return only posts with at least this many views. 0 means no minimum.",
            "default": 0
          },
          "minComments": {
            "title": "Minimum comments",
            "minimum": 0,
            "type": "integer",
            "description": "Return only posts with at least this many comments. Reads one small comments page per candidate post. 0 means no minimum.",
            "default": 0
          },
          "maxPostsToScan": {
            "title": "Max posts to scan per channel",
            "minimum": 20,
            "maximum": 1000000,
            "type": "integer",
            "description": "With search terms or filters, how many posts of a channel are read at most while looking for matches. Posts that do not match are free.",
            "default": 5000
          },
          "onlyNewPosts": {
            "title": "Only new posts since the last run",
            "type": "boolean",
            "description": "For scheduled runs. The first run returns the newest posts; later runs return only newer posts, oldest first, and continue exactly where the last run stopped. The memory is kept in your account's key-value store 'telegram-channel-posts-memory'.",
            "default": false
          },
          "memoryKey": {
            "title": "Memory name",
            "type": "string",
            "description": "Separate memories for different schedules or tasks that read the same channels. Optional.",
            "default": "default"
          },
          "afterPostIds": {
            "title": "Only posts after these post ids",
            "type": "object",
            "description": "Your own cursor per channel, for example {\"durov\": 540}: only posts with a higher id are returned, oldest first. Optional."
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "Add each post's comments (channels with comments turned on). One extra page per post, so the run is slower. No extra charge.",
            "default": false
          },
          "maxCommentsPerPost": {
            "title": "Max comments per post",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "How many comments to add to each post, oldest first. 0 adds only the comment count.",
            "default": 50
          },
          "includeServiceMessages": {
            "title": "Include service messages",
            "type": "boolean",
            "description": "Also return the channel's service messages, such as 'Channel photo updated' or a pinned message notice. They have service: true and are charged like posts.",
            "default": false
          },
          "includeRawHtml": {
            "title": "Include raw HTML",
            "type": "boolean",
            "description": "Add each post's HTML as Telegram's page shows it (raw_html), for your own parsing.",
            "default": false
          },
          "downloadMedia": {
            "title": "Save media files",
            "type": "boolean",
            "description": "Copy each photo, video, voice message and sticker to this run's key-value store and add a lasting link (stored_url), the file size and type. Telegram's own links expire. Charged per file saved.",
            "default": false
          },
          "maxMediaSizeMB": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "Files larger than this are not saved; the row says so.",
            "default": 50
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Not needed today: Telegram answers Apify's servers directly. Turn on only if a run reports that Telegram stopped answering.",
            "default": {
              "useApifyProxy": false
            }
          },
          "healthCheck": {
            "title": "Health check",
            "type": "boolean",
            "description": "For the maintainer's weekly check: the run fails if Telegram's pages show markup this Actor does not know, or a channel returns no posts.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}