{
  "openapi": "3.0.1",
  "info": {
    "title": "CJK PDF to RAG Chunks – Traditional Chinese & Japanese OCR",
    "description": "Convert Traditional Chinese and Japanese PDFs (including scans) into heading-aware, sentence-safe chunks with page numbers for RAG and vector DBs. Parallel OCR, header/footer removal, optional Markdown tables, estimate mode. Pay per page.",
    "version": "0.1",
    "x-build-id": "WHPqLogJGF0fTp86E"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/robertwang~cjk-pdf-rag-chunker/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-robertwang-cjk-pdf-rag-chunker",
        "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/robertwang~cjk-pdf-rag-chunker/runs": {
      "post": {
        "operationId": "runs-sync-robertwang-cjk-pdf-rag-chunker",
        "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/robertwang~cjk-pdf-rag-chunker/run-sync": {
      "post": {
        "operationId": "run-sync-robertwang-cjk-pdf-rag-chunker",
        "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": {
          "pdfUrls": {
            "title": "PDF URLs",
            "type": "array",
            "description": "Public PDF URLs",
            "default": [
              "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
            ],
            "items": {
              "type": "string"
            }
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "extract",
              "estimate"
            ],
            "type": "string",
            "description": "estimate = count pages / OCR pages only",
            "default": "extract"
          },
          "chunkChars": {
            "title": "Target chunk size (chars)",
            "type": "integer",
            "description": "Approx characters per chunk",
            "default": 500
          },
          "maxPages": {
            "title": "Max pages per PDF",
            "type": "integer",
            "description": "Hard cap",
            "default": 200
          },
          "forceOcr": {
            "title": "Force OCR on all pages",
            "type": "boolean",
            "description": "Testing: OCR even if text layer exists",
            "default": false
          },
          "ocrLang": {
            "title": "OCR languages",
            "type": "string",
            "description": "Tesseract langs. Empty = auto (jpn+chi_tra for Japanese docs, else chi_tra+jpn)"
          },
          "ocrDpi": {
            "title": "OCR DPI",
            "type": "integer",
            "description": "Render DPI for OCR",
            "default": 150
          },
          "ocrWorkers": {
            "title": "OCR parallel workers",
            "type": "integer",
            "description": "Default: CPU count (min 2)"
          },
          "detectTables": {
            "title": "Detect tables",
            "type": "boolean",
            "description": "Off by default (slow, ~7 s/page). Emit tables as markdown chunks with type=table",
            "default": false
          },
          "pageBreak": {
            "title": "Break chunks at page end",
            "type": "boolean",
            "description": "Flush at page end (unfinished sentence carried over)",
            "default": true
          },
          "uploadStore": {
            "title": "Upload key-value store",
            "type": "string",
            "description": "Key-value store holding uploaded PDFs (use when the source site blocks download)."
          },
          "uploadKeys": {
            "title": "Uploaded PDF keys",
            "type": "array",
            "description": "Record keys in the upload store (or this run's default store if no store chosen).",
            "items": {
              "type": "string"
            }
          },
          "verticalText": {
            "title": "Vertical text (直書)",
            "enum": [
              "auto",
              "on",
              "off"
            ],
            "type": "string",
            "description": "Scanned pages: detect vertical (top-to-bottom, right-to-left) text and OCR with jpn_vert / chi_tra_vert.",
            "default": "auto"
          },
          "deskew": {
            "title": "Deskew scans",
            "type": "boolean",
            "description": "Straighten scanned pages tilted 0.8–4.5°.",
            "default": true
          },
          "denoise": {
            "title": "Denoise scans",
            "type": "boolean",
            "description": "Median filter, applied only to pages with heavy speckle noise.",
            "default": true
          },
          "trustOcrLayer": {
            "title": "Trust existing invisible OCR layer",
            "type": "boolean",
            "description": "Scanned PDFs often carry a hidden OCR text layer of poor quality for CJK. By default such pages are re-OCRed; enable to use the existing layer (cheaper, billed as text pages).",
            "default": false
          },
          "maxRunSeconds": {
            "title": "Max run seconds / 最長執行秒數",
            "minimum": 30,
            "type": "integer",
            "description": "Stop early (marking results 'truncated') before this many seconds. The platform run timeout is always respected too. / 超過秒數前提早停止並標記 truncated；平台逾時也會自動遵守。"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}