{
  "openapi": "3.0.1",
  "info": {
    "title": "小红书数据 API | SocialDataX Xiaohongshu XHS RedNote",
    "description": "社媒数据助手 SocialDataX 提供只读小红书 / Xiaohongshu / XHS / RedNote data API，支持笔记搜索、商品搜索、商品详情、商品评价、标签页笔记、评论、笔记详情、博主作品列表、博主信息、评论回复和搜索热榜。结果可导出 Apify Dataset、CSV、Excel；无需配置 SocialDataX API Key。",
    "version": "0.1",
    "x-build-id": "jFzpyxiIWKnXCwtNm"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/socialdatax~socialdatax-xhs-data-api/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-socialdatax-socialdatax-xhs-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-xhs-data-api/runs": {
      "post": {
        "operationId": "runs-sync-socialdatax-socialdatax-xhs-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-xhs-data-api/run-sync": {
      "post": {
        "operationId": "run-sync-socialdatax-socialdatax-xhs-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_notes",
              "search_products",
              "get_product_detail",
              "get_product_reviews",
              "get_note_comments",
              "get_note_detail",
              "list_user_notes",
              "get_user_info",
              "get_note_sub_comments",
              "list_topic_notes",
              "search_hot_list"
            ],
            "type": "string",
            "description": "先选择要调用的小红书 / Xiaohongshu / XHS / RedNote 数据能力，然后只填写该 operation 需要的字段；无关字段会被忽略。持续使用需要 Apify paid plan；free plan 用户有 5 次 SocialDataX API request 试用额度。Choose the operation first, then fill only the fields used by that operation.",
            "default": "search_notes"
          },
          "keyword": {
            "title": "关键词 / Keyword",
            "type": "string",
            "description": "operation=search_notes 或 search_products 时必填；分别用于笔记搜索和商品搜索。其它 operation 可留空。",
            "default": "露营"
          },
          "sort_type": {
            "title": "排序 / Sort type",
            "enum": [
              "general",
              "default",
              "hot",
              "time_descending",
              "like_count_descending",
              "comment_count_descending",
              "collect_count_descending"
            ],
            "type": "string",
            "description": "operation=search_notes 时可选 general、time_descending、like_count_descending、comment_count_descending、collect_count_descending；get_note_comments 可选 default、time_descending、like_count_descending；get_product_reviews 可选 general、time_descending；list_topic_notes 可选 hot、time_descending。共享表单兼容：search_notes 和 get_product_reviews 的 default 按 general 处理，get_note_comments 的 general 按 default 处理，list_topic_notes 的 general/default 按 hot 处理。其它 operation 会忽略该字段。",
            "default": "general"
          },
          "note_type": {
            "title": "笔记类型 / Note type",
            "enum": [
              "all",
              "image",
              "video"
            ],
            "type": "string",
            "description": "仅 operation=search_notes 时使用。",
            "default": "all"
          },
          "publish_time_range": {
            "title": "发布时间 / Publish time",
            "enum": [
              "all",
              "day",
              "week",
              "half_year"
            ],
            "type": "string",
            "description": "仅 operation=search_notes 时使用。",
            "default": "all"
          },
          "sku_id": {
            "title": "商品 SKU ID / Product SKU ID",
            "type": "string",
            "description": "operation=get_product_detail 时至少提供 sku_id 或 url 之一，同时提供时优先使用 url；get_product_reviews 时必填 sku_id。用户已提供完整 sku_id 时直接使用，否则从 search_products 或 get_product_detail Dataset 行原样复制；此字段不支持 spu_id、商品链接或搜索词。"
          },
          "url": {
            "title": "商品链接 / Product URL",
            "type": "string",
            "description": "仅 operation=get_product_detail 时使用。小红书商品详情链接、短链接或包含商品链接的完整分享文案；至少提供 url 或 sku_id 之一，同时提供时优先使用 url。不支持笔记链接、博主主页链接或纯分享口令。"
          },
          "has_image": {
            "title": "仅看带图评价 / Reviews with images only",
            "type": "boolean",
            "description": "仅 operation=get_product_reviews 时使用。开启后只返回带图片的商品评价。",
            "default": false
          },
          "note_id": {
            "title": "笔记 ID / Note ID",
            "type": "string",
            "description": "operation=get_note_detail、get_note_comments、get_note_sub_comments 时使用；如果只有笔记链接、短链接或分享文案，请直接填 note_url。详情和评论列表至少提供 note_id 或 note_url 之一，同时提供时优先使用 note_url。误填到 note_id 时，Actor 会尽量自动识别笔记链接。评论回复必须使用 get_note_comments Dataset 行里的真实 note_id + comment_id，不支持链接或分享文案。"
          },
          "note_url": {
            "title": "笔记链接 / Note URL",
            "type": "string",
            "description": "operation=get_note_detail、get_note_comments 时至少提供 note_url 或 note_id 之一；同时提供时优先使用 note_url。推荐直接粘贴小红书笔记链接、短链接或分享文案。评论回复 get_note_sub_comments 不使用 note_url；请先运行 get_note_comments，再复制 Dataset 行里的真实 note_id + comment_id。"
          },
          "user_id": {
            "title": "用户 ID / User ID",
            "type": "string",
            "description": "operation=get_user_info、list_user_notes 时至少提供 user_id 或 profile_url 之一；同时提供时优先使用 profile_url。只填真实 user_id/author_user_id，不要填昵称、主页名称或小红书号；如果只有主页链接、短链接或分享文案，请直接填 profile_url。误填到 user_id 时，Actor 会尽量自动按 profile_url 处理。"
          },
          "profile_url": {
            "title": "主页链接 / Profile URL",
            "type": "string",
            "description": "operation=get_user_info、list_user_notes 时至少提供 profile_url 或 user_id 之一；同时提供时优先使用 profile_url。强烈推荐直接粘贴小红书主页链接、短链接或分享文案。"
          },
          "comment_id": {
            "title": "一级评论 ID / Comment ID",
            "type": "string",
            "description": "仅 operation=get_note_sub_comments 时必填。先运行 get_note_comments，在 Dataset 里找到 reply_count > 0 的一级评论行，复制该行的 comment_id；不要填评论内容、昵称或其它文本。"
          },
          "page_id": {
            "title": "标签页 ID / Topic page ID",
            "type": "string",
            "description": "operation=list_topic_notes 时与 topic_url 二选一。填写完整 page_id；如果只有话题页链接、短链接或分享文案，请填 topic_url。"
          },
          "topic_url": {
            "title": "话题页链接 / Topic URL",
            "type": "string",
            "description": "operation=list_topic_notes 时与 page_id 二选一。推荐直接粘贴小红书话题页链接、短链接或分享文案；同时填写时优先使用 topic_url。"
          },
          "page_token": {
            "title": "分页令牌 / Page token",
            "type": "string",
            "description": "笔记搜索、商品搜索、商品评价、标签页笔记、评论、评论回复、博主作品列表继续翻页时，原样传入上一页 Dataset 行的 page_next_page_token（对应 API 返回的 next_page_token）；第一页留空。auto_paginate=true 时通常不用手动填写。"
          },
          "max_items": {
            "title": "最大结果数 / Max items",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "最多写入多少条 Dataset item。对搜索、商品评价、标签页笔记、评论、评论回复、博主作品列表用于限制自动翻页结果；对搜索热榜用于限制本次导出的热榜条目数。较大的值可能触发多次 SocialDataX API request。",
            "default": 20
          },
          "auto_paginate": {
            "title": "自动翻页 / Auto paginate",
            "type": "boolean",
            "description": "开启后 Actor 会按 next_page_token 继续请求，直到达到 max_items 或没有下一页。关闭时只请求当前 page_token。每翻一页计 1 次 SocialDataX API request。When enabled, each page request counts as one SocialDataX API request.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}