{
  "openapi": "3.0.1",
  "info": {
    "title": "百度贴吧 API | Baidu Tieba Search, Comments & User Posts",
    "description": "社媒数据助手 SocialDataX 提供百度贴吧帖子搜索、吧内搜索、贴吧帖子列表、评论与回复、用户资料及发帖。Baidu Tieba API for post search, search within a forum, forum threads, comments, replies and user posts. Export JSON, CSV, Excel. 无需配置 SocialDataX API Key。",
    "version": "0.1",
    "x-build-id": "78zNS4if8XFb2tnpZ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/socialdatax~socialdatax-baidu-tieba-data-api/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-socialdatax-socialdatax-baidu-tieba-data-api",
        "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/socialdatax~socialdatax-baidu-tieba-data-api/runs": {
      "post": {
        "operationId": "runs-sync-socialdatax-socialdatax-baidu-tieba-data-api",
        "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/socialdatax~socialdatax-baidu-tieba-data-api/run-sync": {
      "post": {
        "operationId": "run-sync-socialdatax-socialdatax-baidu-tieba-data-api",
        "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": [
          "operation"
        ],
        "properties": {
          "operation": {
            "title": "操作 / Operation",
            "enum": [
              "search_posts",
              "search_general",
              "search_posts_in_forum",
              "search_users",
              "search_suggestions",
              "get_post_detail",
              "get_post_comments",
              "get_comment_replies",
              "get_user_info",
              "list_user_posts",
              "list_user_followed_forums",
              "get_forum_detail",
              "list_forum_posts"
            ],
            "type": "string",
            "description": "选择能力；仅填写对应字段。详情和资料查询支持 ID 或链接二选一。",
            "default": "search_posts"
          },
          "keyword": {
            "title": "keyword",
            "type": "string",
            "description": "搜索词或关键词短语，例如 方便面、旅行攻略；不要传帖子链接、帖子 ID 或分页令牌。需要限定某个贴吧时使用吧内帖子搜索。",
            "default": "美食"
          },
          "page_token": {
            "title": "page_token",
            "type": "string",
            "description": "首页留空；续页原样传回同一操作的完整 next_page_token，保持搜索词、ID、排序和筛选条件不变。"
          },
          "sort_type": {
            "title": "sort_type",
            "enum": [
              "newest",
              "oldest",
              "relevance",
              "relevant",
              "hot",
              "default",
              "latest_reply"
            ],
            "type": "string",
            "description": "可留空使用操作默认值：帖子/吧内搜索 newest；评论 hot；吧内列表 default。各操作只接受其支持的排序；精华帖只支持 default。"
          },
          "forum_name": {
            "title": "forum_name",
            "type": "string",
            "description": "准确贴吧名称，例如 方便面；直接使用结果中的 forum_name，不要自行追加“吧”字；不要传 URL 或数字 ID，无需 URL 编码。"
          },
          "thread_id": {
            "title": "thread_id",
            "pattern": "^[0-9]+$",
            "type": "string",
            "description": "主题帖数字 ID，可取贴吧搜索结果的 thread_id；不要传帖子链接。"
          },
          "url": {
            "title": "url",
            "pattern": "https?://",
            "type": "string",
            "description": "填写所选操作对应的完整链接，与该操作的 ID 二选一。不要同时填写 ID 和链接。"
          },
          "comment_id": {
            "title": "comment_id",
            "pattern": "^[1-9][0-9]*$",
            "type": "string",
            "description": "一级评论 ID，取一级评论结果的 comment_id 或本工具结果的 parent_comment_id；不要传楼中楼回复自身的 comment_id。"
          },
          "user_id": {
            "title": "user_id",
            "pattern": "^[1-9][0-9]{0,18}$",
            "type": "string",
            "description": "百度贴吧数字用户 ID：用户搜索结果取 user_id；帖子搜索、帖子详情或评论结果中的作者取 author_user_id。不是主页链接中的 portrait 或 tieba_uid。"
          },
          "profile_url": {
            "title": "profile_url",
            "type": "string",
            "description": "填写所选操作对应的完整链接，与该操作的 ID 二选一。不要同时填写 ID 和链接。"
          },
          "featured_only": {
            "title": "featured_only",
            "type": "boolean",
            "description": "是否仅查看精华帖，false 表示不筛选（仍可包含精华帖）；true 时 sort_type 必须为 default，按贴吧精华列表顺序返回。",
            "default": false
          },
          "max_items": {
            "title": "最大结果数 / Max items",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "列表总导出上限；详情与资料最多1条。仅成功写入 Dataset 的结果按条计费，另有启动费。",
            "default": 20
          },
          "auto_paginate": {
            "title": "自动翻页 / Auto paginate",
            "type": "boolean",
            "description": "有分页能力时自动续页，直到达到上限或令牌为空；空页有令牌仍会继续。无分页能力的操作只请求一次。",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}