{
  "openapi": "3.0.1",
  "info": {
    "title": "Telegram Group Scraper",
    "description": "Extract all members from any Telegram supergroup. Get username, phone, bio, premium status, last seen and more. Built on User API — not Bot API. Pay-per-result, no monthly fee. MCP/AI Agent compatible.",
    "version": "0.0",
    "x-build-id": "yNstzHFGpQ9AQoFvd"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/opportunity-biz~telegram-group-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-opportunity-biz-telegram-group-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/opportunity-biz~telegram-group-scraper/runs": {
      "post": {
        "operationId": "runs-sync-opportunity-biz-telegram-group-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/opportunity-biz~telegram-group-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-opportunity-biz-telegram-group-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": [
          "groupUrl",
          "sessionString"
        ],
        "properties": {
          "groupUrl": {
            "title": "Telegram Group URL or Username",
            "type": "string",
            "description": "The URL or @username of the Telegram group. Examples: @mygroup, t.me/mygroup.\n\n⚠️ Works only with SUPERGROUPS (where you can see the member list in the Telegram app). Does NOT work with broadcast channels."
          },
          "sessionString": {
            "title": "Session String (Telethon StringSession)",
            "type": "string",
            "description": "Your Telethon StringSession. Generate it locally by running the script in the README. Required for every run."
          },
          "maxMembers": {
            "title": "Max Members to Scrape",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Maximum number of members to extract. Default: 1000. Max: 50000.",
            "default": 1000
          },
          "startPage": {
            "title": "Start Page",
            "minimum": 1,
            "type": "integer",
            "description": "Page number to start scraping from (each page = 200 members). Useful to resume interrupted runs.",
            "default": 1
          },
          "fetchBio": {
            "title": "Fetch Bio",
            "type": "boolean",
            "description": "Enable to fetch each member's bio (profile description).\n\n⚠️ Significantly slower: ~8 minutes for 500 members vs ~30 seconds without. Increases API calls and flood-wait risk. Only enable if bio data is required for your use case.",
            "default": false
          },
          "excludeBots": {
            "title": "Exclude Bots",
            "type": "boolean",
            "description": "If true, bot accounts are excluded from results.",
            "default": false
          },
          "excludeDeleted": {
            "title": "Exclude Deleted Accounts",
            "type": "boolean",
            "description": "If true, deleted/deactivated accounts are excluded from results.",
            "default": true
          },
          "proxyIp": {
            "title": "Proxy IP",
            "type": "string",
            "description": "Optional SOCKS5 proxy IP address."
          },
          "proxyPort": {
            "title": "Proxy Port",
            "type": "integer",
            "description": "Optional SOCKS5 proxy port."
          },
          "proxyUsername": {
            "title": "Proxy Username",
            "type": "string",
            "description": "Optional proxy authentication username."
          },
          "proxyPassword": {
            "title": "Proxy Password",
            "type": "string",
            "description": "Optional proxy authentication password."
          },
          "webhookNotificationUrl": {
            "title": "Webhook Notification URL (Agent Mode)",
            "type": "string",
            "description": "[AGENT MODE] Optional. If set, the Actor will POST a structured JSON payload to this URL at the end of every run. Use with n8n, Make, or Zapier to trigger automations based on new members or signals.\n\nPayload includes: run_id, dataset_id, stats, signals, new_members_preview."
          },
          "previousRunId": {
            "title": "Previous Run ID (Agent Mode — Diff)",
            "type": "string",
            "description": "[AGENT MODE] Optional. The Apify run ID of a previous scrape of the same group. When set, the Actor computes a diff and includes only NEW members (not seen in the previous run) in the webhook payload.\n\nUse this in scheduled runs to detect group growth over time."
          },
          "alertRules": {
            "title": "Alert Rules (Agent Mode)",
            "type": "array",
            "description": "[AGENT MODE] Optional. List of conditions that trigger signals in the webhook payload.\n\nEach rule is an object with:\n- field: the member field to check (e.g. 'bio', 'username', 'member_count_delta')\n- contains: keyword to look for (string match, case-insensitive)\n- gt: numeric threshold for 'member_count_delta'\n\nExamples:\n[{\"field\": \"bio\", \"contains\": \"investor\"}]\n[{\"field\": \"member_count_delta\", \"gt\": 50}]"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}