{
  "openapi": "3.0.1",
  "info": {
    "title": "Telegram Media Downloader & Scraper",
    "description": "Download photos, videos, voice notes and stickers from public Telegram channels, with direct media URLs and optional file saving to Apify storage. No API key or login needed.",
    "version": "0.2",
    "x-build-id": "GQ6ezsLehcviiAWLk"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/khadinakbar~telegram-media-downloader/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-khadinakbar-telegram-media-downloader",
        "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/khadinakbar~telegram-media-downloader/runs": {
      "post": {
        "operationId": "runs-sync-khadinakbar-telegram-media-downloader",
        "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/khadinakbar~telegram-media-downloader/run-sync": {
      "post": {
        "operationId": "run-sync-khadinakbar-telegram-media-downloader",
        "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": "Telegram channels",
            "type": "array",
            "description": "Public Telegram channels to pull media from. Accepts usernames, @handles or t.me links (e.g. 'durov', '@telegram', 'https://t.me/telegram'). Each channel needs its public web preview on (open https://t.me/s/USERNAME in a browser to check). Private or invite-only channels are not supported. Add single posts in 'Post links' instead.",
            "items": {
              "type": "string"
            }
          },
          "postUrls": {
            "title": "Post links",
            "type": "array",
            "description": "Specific Telegram post links to pull media from, like 'https://t.me/telegram/123'. Use this to grab one post or one album without scanning a whole channel. You can combine it with Telegram channels.",
            "items": {
              "type": "string"
            }
          },
          "maxMediaPerChannel": {
            "title": "Max media items per channel",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum number of media items (photos, videos, etc.) to collect per channel before stopping. Counts individual media — an album of 10 photos counts as 10. Defaults to 50; set higher for bulk archival. Each collected item is billed at the media-extracted rate.",
            "default": 50
          },
          "mediaTypes": {
            "title": "Media types to include",
            "type": "array",
            "description": "Which media types to collect. Allowed values: 'photo', 'video', 'roundvideo', 'voice', 'sticker', 'document'. Defaults to photo, video, roundvideo, voice, and document. Pass a subset to filter (e.g. ['photo'] for images only); 'sticker' is excluded by default because channels post many.",
            "default": [
              "photo",
              "video",
              "roundvideo",
              "voice",
              "document"
            ],
            "items": {
              "type": "string"
            }
          },
          "oldestMediaDate": {
            "title": "Oldest media date",
            "type": "string",
            "description": "Only collect media from messages posted on or after this date. Use ISO format 'YYYY-MM-DD' (e.g. '2024-01-01'). Leave empty to collect the most recent media with no date floor. Pagination stops once messages older than this date are reached."
          },
          "expandAlbums": {
            "title": "Return every item in albums",
            "type": "boolean",
            "description": "When on (default), every photo or video in an album is returned as its own row. Turn off to return only the first item of each post.",
            "default": true
          },
          "minViews": {
            "title": "Minimum views",
            "minimum": 0,
            "type": "integer",
            "description": "Only keep media from posts with at least this many views. Leave empty for no filter."
          },
          "minDurationSecs": {
            "title": "Minimum duration (seconds)",
            "minimum": 0,
            "type": "integer",
            "description": "Only keep videos and voice notes at least this long. Items without a known length are skipped when this is set."
          },
          "maxDurationSecs": {
            "title": "Maximum duration (seconds)",
            "minimum": 0,
            "type": "integer",
            "description": "Only keep videos and voice notes up to this length. Items without a known length are skipped when this is set."
          },
          "minItemSizeMb": {
            "title": "Minimum file size (MB)",
            "minimum": 0,
            "type": "number",
            "description": "Only keep documents at least this large, using the size shown on the card. Items with no shown size are kept."
          },
          "maxItemSizeMb": {
            "title": "Maximum file size (MB)",
            "minimum": 0,
            "type": "number",
            "description": "Only keep documents up to this size, using the size shown on the card. Items with no shown size are kept."
          },
          "keywords": {
            "title": "Caption keywords",
            "type": "array",
            "description": "Only keep media whose post text contains at least one of these words (not case sensitive). Leave empty for no filter.",
            "items": {
              "type": "string"
            }
          },
          "downloadFiles": {
            "title": "Download files to storage",
            "type": "boolean",
            "description": "When true, the actor fetches each media file's bytes and saves them to this run's key-value store, returning a permanent Apify download URL in 'apify_download_url'. When false (default), only the direct media URL is returned (cheaper, faster). Files without a direct preview URL (large videos, documents) cannot be downloaded and are flagged.",
            "default": false
          },
          "maxFileSizeMb": {
            "title": "Max file size to download (MB)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Skip downloading any single file larger than this size, in megabytes, to protect compute and storage budget. Only applies when 'Download files to storage' is enabled. Defaults to 25 MB. Items skipped for size still appear in the dataset with their direct media URL.",
            "default": 25
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Proxy settings used to reach Telegram. Defaults to Apify datacenter proxies, which are sufficient for the public t.me web preview. Use residential proxies only if datacenter IPs get blocked. Leave as default for normal use.",
            "default": {
              "useApifyProxy": true
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}