{
  "openapi": "3.0.1",
  "info": {
    "title": "Telegram Scraper + AI Analysis — Posts, Sentiment, MCP-Ready",
    "description": "Scrape any public Telegram channel and enrich each post with Gemini AI — sentiment, topics, summaries, translation, entities, and image descriptions. Built-in content moderation. MCP-ready for Claude Desktop and AI agents.",
    "version": "0.0",
    "x-build-id": "7lsjVtCzrLT5Y7MvB"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ml_boost~tg-apify-actor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ml_boost-tg-apify-actor",
        "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/ml_boost~tg-apify-actor/runs": {
      "post": {
        "operationId": "runs-sync-ml_boost-tg-apify-actor",
        "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/ml_boost~tg-apify-actor/run-sync": {
      "post": {
        "operationId": "run-sync-ml_boost-tg-apify-actor",
        "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",
            "type": "array",
            "description": "One or more public Telegram channel identifiers. Accepts plain usernames (`durov`), @-prefixed (`@durov`), or t.me URLs (`https://t.me/durov`). Private channels, users and bots are not supported.",
            "items": {
              "type": "string"
            }
          },
          "maxMessagesPerChannel": {
            "title": "Max messages per channel",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum number of messages to scrape per channel. Iterates from newest to oldest. Hard-capped at 5,000 regardless of this value. Use a smaller number (50-200) for fast exploratory queries.",
            "default": 200
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "json",
              "markdown",
              "both"
            ],
            "type": "string",
            "description": "`json` returns one structured record per message with all fields (recommended for programmatic consumers and AI agents). `markdown` returns a compact YAML-frontmatter + body string ideal for RAG pipelines. `both` includes both.",
            "default": "json"
          },
          "includeChannelInfo": {
            "title": "Include channel info record",
            "type": "boolean",
            "description": "When true, emits one extra record per channel containing channel-level metadata (title, description, subscribers, photos/videos/links counts, verified, avatar). The record has `recordType: \"channel_info\"`.",
            "default": true
          },
          "incrementalMode": {
            "title": "Incremental mode",
            "type": "boolean",
            "description": "When true, only fetches messages newer than the highest message ID scraped in a previous run of this actor. The cursor is stored per channel in the actor's key-value store. Use this for scheduled monitoring (combine with Apify Schedules).",
            "default": false
          },
          "enrichSentiment": {
            "title": "AI: Sentiment analysis",
            "type": "boolean",
            "description": "Classify each post as positive / neutral / negative with confidence score and one-line rationale. Adds a `sentiment: {label, score, rationale}` field. Token-metered ($3 per 1M input, $15 per 1M output).",
            "default": false
          },
          "enrichTopics": {
            "title": "AI: Topic tags",
            "type": "boolean",
            "description": "Assign 1-5 topic tags from this controlled vocabulary: politics, tech, finance, crypto, ai, sports, entertainment, science, business, lifestyle, news, other. Adds a `topics: [string]` field.",
            "default": false
          },
          "enrichSummary": {
            "title": "AI: One-line summary",
            "type": "boolean",
            "description": "Produce a single-sentence summary of each post. Adds a `summary: string` field. Useful for digests, briefings, and timeline views where the full text is too long.",
            "default": false
          },
          "enrichTranslation": {
            "title": "AI: Translation",
            "type": "boolean",
            "description": "Translate each post's text into the language specified by `translationTarget`. Adds a `translation: string` field. URLs, hashtags and @mentions are preserved verbatim.",
            "default": false
          },
          "translationTarget": {
            "title": "Translation target language",
            "type": "string",
            "description": "ISO-639-1 language code for translations (e.g. `en`, `es`, `de`, `fr`, `ru`, `zh`, `ja`, `pt`). Only used when `enrichTranslation` is true.",
            "default": "en"
          },
          "enrichEntities": {
            "title": "AI: Named entity extraction",
            "type": "boolean",
            "description": "Extract named entities mentioned in each post. Adds an `entities: {companies, people, places, tokens}` field, where `tokens` are crypto tickers like BTC, ETH, SOL.",
            "default": false
          },
          "enrichImageDescriptions": {
            "title": "AI: Image descriptions (vision)",
            "type": "boolean",
            "description": "Generate 1-2 sentence descriptions for each image attached to a post, using Gemini multimodal. Adds `imageDescriptions: [{url, description, contains_text}]`. Capped at 4 images per post and 6 MB per image. Vision tokens (~1,000+ per image) cost more than text — enable only when you actually need visual content extracted.",
            "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}