{
  "openapi": "3.0.1",
  "info": {
    "title": "Chinese AI Training Corpus Engine",
    "description": "Turn China's public web into AI-training-ready text. Pulls Weibo, Bilibili, Xueqiu, Douban & RedNote, then deduplicates, quality-scores, PII-scrubs and provenance-stamps every document. From $0.025/doc, pay-as-you-go. For LLM training-data teams, data vendors & academic NLP researchers.",
    "version": "0.1",
    "x-build-id": "4v1oT5isGRsbSvakO"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/zhorex~chinese-corpus-engine/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-zhorex-chinese-corpus-engine",
        "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/zhorex~chinese-corpus-engine/runs": {
      "post": {
        "operationId": "runs-sync-zhorex-chinese-corpus-engine",
        "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/zhorex~chinese-corpus-engine/run-sync": {
      "post": {
        "operationId": "run-sync-zhorex-chinese-corpus-engine",
        "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": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "corpus_pull",
              "dedup_merge",
              "provenance_audit"
            ],
            "type": "string",
            "description": "corpus_pull scrapes fresh documents. dedup_merge and provenance_audit run the pipeline over datasets you already own (set inputDatasetIds) — no scraping, cheaper per record.",
            "default": "corpus_pull"
          },
          "topics": {
            "title": "Topics / keywords",
            "type": "array",
            "description": "Search keywords fanned out to every selected source. Mix brands, categories, and themes for corpus diversity. Required in corpus_pull mode.",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "title": "Sources",
            "type": "array",
            "description": "weibo / bilibili / xueqiu / douban are HTTP sources billed at the corpus-doc rate. rednote is a browser source — it only runs when 'Include browser sources' is enabled and bills at the higher corpus-doc-browser rate.",
            "items": {
              "type": "string",
              "enum": [
                "weibo",
                "bilibili",
                "xueqiu",
                "douban",
                "rednote"
              ]
            },
            "default": [
              "weibo",
              "bilibili",
              "xueqiu",
              "douban"
            ]
          },
          "maxDocs": {
            "title": "Max documents (raise for bulk corpus pulls)",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Global cap on BILLABLE documents per run. Typical patterns: 500-1,000 to evaluate corpus quality, 10,000-50,000 for an SFT dataset build, 100,000+ for a foundation-corpus pull. Only documents passing the quality floor, char floor, and dedup are counted or charged — rejects are free. See the Pricing tab for per-document cost.",
            "default": 1000
          },
          "minQuality": {
            "title": "Minimum quality score",
            "enum": [
              "0.0",
              "0.2",
              "0.35",
              "0.5",
              "0.65"
            ],
            "type": "string",
            "description": "Documents scoring below this (0-1 heuristic: length, charset, diversity, punctuation sanity, sentence structure) are dropped — not returned, not billed.",
            "default": "0.35"
          },
          "minCharCount": {
            "title": "Minimum characters per document",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Documents whose cleaned text is shorter than this are dropped — not returned, not billed.",
            "default": 40
          },
          "languages": {
            "title": "Language filter",
            "type": "array",
            "description": "Keep only documents detected as these languages.",
            "items": {
              "type": "string",
              "enum": [
                "zh-CN",
                "mixed",
                "en"
              ]
            },
            "default": [
              "zh-CN",
              "mixed"
            ]
          },
          "includeBrowserSources": {
            "title": "Include browser sources (RedNote) — higher-priced event",
            "type": "boolean",
            "description": "Enables JS-rendered sources (currently RedNote full post bodies). These need a headless browser + residential proxy and bill at the corpus-doc-browser rate instead of corpus-doc. Recommended run memory with this on: 4096 MB.",
            "default": false
          },
          "piiScrub": {
            "title": "PII scrub",
            "type": "boolean",
            "description": "Replace emails, phone numbers, Chinese resident IDs (checksum-validated), and passport numbers in document text with [EMAIL]/[PHONE]/[CN_ID]/[PASSPORT] tokens. Counts are always reported per document in the pii field.",
            "default": true
          },
          "deltaStateKey": {
            "title": "Corpus refresh key (delta state)",
            "type": "string",
            "description": "Set a stable key (e.g. 'ev-corpus-weekly') to make scheduled runs grow one corpus: documents already collected under this key are skipped — not returned, not billed."
          },
          "inputDatasetIds": {
            "title": "Input dataset IDs (dedup_merge / provenance_audit)",
            "type": "array",
            "description": "Dataset IDs from this actor or any Chinese Digital Intelligence Suite actor to re-process. Ignored in corpus_pull mode.",
            "items": {
              "type": "string"
            }
          },
          "cookieStrings": {
            "title": "Cookie strings (optional, per platform)",
            "type": "object",
            "description": "Optional logged-in cookies keyed by platform name to improve recall and rate limits, e.g. {\"xueqiu\": \"xq_a_token=...\"}. Never stored or logged."
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Datacenter works for Weibo/Bilibili/Xueqiu. Douban and RedNote work best with RESIDENTIAL (country CN).",
            "default": {
              "useApifyProxy": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}