{
  "openapi": "3.0.1",
  "info": {
    "title": "Discord Server Scraper — Messages, Members & Channels",
    "description": "Export a Discord server via your bot token: messages, members, channels, roles & full structure. HTTP-only, no proxy. MCP-ready Apify Actor.",
    "version": "0.1",
    "x-build-id": "uXhgJ8IFXUntEHIEu"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/khadinakbar~discord-server-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-khadinakbar-discord-server-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/khadinakbar~discord-server-scraper/runs": {
      "post": {
        "operationId": "runs-sync-khadinakbar-discord-server-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/khadinakbar~discord-server-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-khadinakbar-discord-server-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",
        "properties": {
          "botToken": {
            "title": "Discord bot token",
            "type": "string",
            "description": "Your Discord bot token (Developer Portal -> Applications -> your app -> Bot -> Reset Token). The bot must already be a member of the target server. REQUIRED. Example format: 'MTA1Nz...long.string'. Stored encrypted and masked in logs. This is a Bot token, NOT a user token (self-bot scraping violates Discord ToS) and NOT the application Client Secret."
          },
          "serverId": {
            "title": "Server (guild) ID",
            "type": "string",
            "description": "The Discord server (guild) ID to export. Enable Developer Mode in Discord (Settings -> Advanced), then right-click the server icon -> Copy Server ID. REQUIRED. Example: '613425648685547541'. The bot named in botToken must be a member of this server. NOT a channel ID, NOT an invite code or URL."
          },
          "resources": {
            "title": "What to scrape",
            "uniqueItems": true,
            "type": "array",
            "description": "Which data types to export from the server. 'server' returns the server profile (name, member count, owner, features, boosts). 'channels' returns the full channel/category/thread tree. 'roles' returns the role list. 'members' returns the member roster (needs the SERVER MEMBERS INTENT enabled on the bot). 'messages' returns channel message history. Defaults to all five. Charged events fire only for members and messages.",
            "items": {
              "type": "string",
              "enum": [
                "server",
                "channels",
                "roles",
                "members",
                "messages"
              ],
              "enumTitles": [
                "Server profile (name, counts, owner, features)",
                "Channels & threads (full tree)",
                "Roles (name, color, position)",
                "Members (roster — needs Server Members Intent)",
                "Messages (channel history)"
              ]
            },
            "default": [
              "server",
              "channels",
              "roles",
              "members",
              "messages"
            ]
          },
          "channelIds": {
            "title": "Channel IDs for messages (optional)",
            "uniqueItems": true,
            "type": "array",
            "description": "Restrict message scraping to these channel IDs. Right-click a channel -> Copy Channel ID (Developer Mode on). Example: ['974519864045756446']. Leave empty to scrape messages from every text and announcement channel the bot can read. Only used when 'messages' is in the resources list. NOT server IDs.",
            "items": {
              "type": "string"
            }
          },
          "maxMessagesPerChannel": {
            "title": "Max messages per channel",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Upper bound on messages fetched from each channel, newest first. Each message returned costs one 'message-scraped' event. Keep small on first runs to verify output before scaling. Set 0 to skip message bodies entirely. Defaults to 100. Max 10000.",
            "default": 100
          },
          "maxMembers": {
            "title": "Max members",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Upper bound on members fetched from the roster. Each member returned costs one 'member-scraped' event. Discord pages members 1000 at a time. Set 0 to skip the roster. Defaults to 1000. Max 100000.",
            "default": 1000
          },
          "messagesNewerThan": {
            "title": "Only messages after this date (optional)",
            "type": "string",
            "description": "ISO 8601 date or datetime; messages older than this are skipped. Example: '2026-01-01' or '2026-01-01T00:00:00Z'. Because messages are fetched newest-first, this also stops pagination early once older messages are reached. Leave empty for no lower time bound. Only used when 'messages' is scraped."
          },
          "includeThreads": {
            "title": "Include threads",
            "type": "boolean",
            "description": "When true (default), active threads are listed as channels and, when scraping messages, their messages are included too. Disable to scrape only top-level text channels. Archived threads are not fetched in this version.",
            "default": 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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}