按规则或语义规划把一份 PDF 拆成多份
POST/open/v1/documents:split异步任务预览scope: document.write
这是预览能力:字段与行为可能在后续 minor 版本中调整,调整会写进更新日志。近 30 天内新增的能力,或在生产环境 90 天内没有调用记录的能力,标为「预览」;其余为「稳定」。预览能力的字段与行为可能在后续 minor 版本中调整,调整会写进更新日志。
原四种规则保持原行为。semantic 需服务端开启,先 plan 自动识别材料或章节边界,再 execute 提交确认范围;低把握边界返回 needs_confirmation,不静默丢弃空白页。语义执行绑定规划和源文件摘要,批量发布分件;不保证原 PDF 数字签名在分件中有效。每份拆分件落成新文档并返回 doc_id;任何一份失败整单失败,不产半套产物。Job 结果里的 split_manifest 记录每份的起止页、拆分依据、doc_id 与状态;另返回 duration_ms。加密、损坏、规则无效、关键词零命中均为 input_invalid。
请求
请求体
| 字段 | 类型 | 约束 | 说明 |
|---|---|---|---|
| doc_id必填 | integer | ≥1 | |
| rule必填 | string | 枚举 "page_ranges" / "fixed_pages" / "bookmarks" / "keyword" / "semantic" | |
| action | string | 枚举 "plan" / "execute" | semantic 专用,必须显式指定规划或执行阶段。 |
| split_goal | string | 枚举 "documents" / "chapters";默认 "documents" | 规划目标:独立材料或顶层章节;执行时沿用规划值。 |
| plan_job_id | string | 正则 ^[a-f0-9]{32}$ | execute 必填,同身份、同 Space 的已完成规划 Job。 |
| plan_sha256 | string | 正则 ^[a-f0-9]{64}$ | execute 必填,规划结果返回的版本摘要。 |
| confirmed_page_ranges | array<array<integer>> | 项数≥1 | execute 必填;确认或调整后的完整范围,必须原序、无漏页、无重页。 |
| page_ranges | array<array<integer>> | 项数≥1 | rule=page_ranges 时必填:[[起,止],…],1 基闭区间,不得重叠。 |
| fixed_pages | integer | ≥1 | rule=fixed_pages 时必填:每份页数。 |
| bookmark_level | integer | 默认 1;≥1 | rule=bookmarks 时按该层级的书签切。 |
| keyword | string | 长度≤200 | rule=keyword 时必填:关键词首次出现的页开新份;需文本层。 |
| file_name_prefix | string | 长度≤80 | 拆分件文件名前缀,默认取原文件名。 |
| client_request_id必填 | string | 长度≥1;长度≤128;正则 ^[A-Za-z0-9._:-]+$ | 调用方生成的幂等请求标识;相同调用方重试时保持不变。 |
| owner_ref | string | 长度≤128 |
响应
202任务已受理;请使用 job_id 查询进度和结果
展开 data 结构(57 个字段)
| 字段 | 类型 | 约束 | 说明 |
|---|---|---|---|
| data | object | 不接受额外字段 | |
| job_id必填 | string | 长度≥32;长度≤32;正则 ^[a-f0-9]{32}$ | 异步任务唯一 ID;刷新页面或跨请求查询时保持不变。 |
| operation必填 | string | 任务类型;当前主要为 upload、parse 或 extract。 | |
| status必填 | string | 枚举 "queued" / "running" / "succeeded" / "failed" / "cancelled" / "unknown" | queued=排队中,running=处理中,succeeded=已完成,failed/cancelled/unknown=终态异常。 |
| phase必填 | string | null | 当前处理阶段;服务未提供细分阶段时为 null。 | |
| progress必填 | integer | null | ≥0;≤100 | 0 到 100 的处理进度;无法计算时为 null。 |
| progress_detail必填 | 任一 | 可核验的真实进度分子、分母;无法度量时为 null。 | |
| unit必填 | string | 枚举 "bytes" / "documents" / "items" / "pages" | |
| current必填 | integer | ≥0 | |
| total必填 | integer | ≥1 | |
| sequence必填 | integer | ≥0 | 状态事件单调序号;客户端用它丢弃乱序轮询结果。 |
| attempt必填 | integer | ≥0 | worker 执行尝试次数;上传直接执行时固定为 1。 |
| poll_after_ms必填 | integer | ≥100 | 服务端建议的下次轮询间隔。 |
| result_ref必填 | string | null | 任务成功后的结果引用,通常为 /open/v1/job/{job_id}/result。 | |
| owner_ref | string | 长度≤128 | 上传任务创建时固化的业务归属;非上传任务通常不返回。 |
| error必填 | 任一 | ||
| code必填 | string | 枚举 "conversion_failed" / "embedding_access_denied" / "embedding_output_invalid" / "embedding_unavailable" / "feature_disabled" / "forbidden" / "index_config_conflict" / "index_incomplete" / "input_invalid" / "input_too_large" / "internal_error" / "method_not_allowed" / "model_access_denied" / "model_output_invalid" / "model_unavailable" / "not_acceptable" / "not_found" / "payload_too_large" / "precondition_failed" / "precondition_required" / "processor_budget" / "processor_failed" / "processor_invalid_response" / "processor_rejected" / "processor_timeout" / "processor_unauthorized" / "processor_unavailable" / "queue_capacity_exceeded" / "rate_limited" / "resource_conflict" / "resource_not_found" / "semantic_unavailable" / "service_unavailable" / "source_ambiguous" / "source_changed" / "source_invalid" / "source_unavailable" / "source_writeback_unavailable" / "unauthorized" / "unsupported_media_type" / "upstream_rejected" / "upstream_timeout" / "upstream_unavailable" | |
| message必填 | string | 长度≥1 | |
| retryable必填 | boolean | ||
| created_at必填 | string(date-time) | ||
| updated_at必填 | string(date-time) | ||
| finished_at必填 | string(date-time) | null(date-time) | ||
| document_parse_diagnostics_v1 | object | 不接受额外字段 | |
| schema_version必填 | 常量 "document_parse_diagnostics_v1" | ||
| requested_provider必填 | string | 枚举 "auto" / "docparse" / "tencent" / "local" / "mineru";默认 "auto" | 解析 Provider 策略。auto 按服务端启用列表和顺序执行;MinerU 默认禁用;指定 Provider 时严格执行该 Provider,不静默切换。 |
| requested_mode必填 | string | 枚举 "standard" / "high_accuracy" / "structure_preserving" | |
| result_source必填 | string | 枚举 "fresh" / "reused" | |
| pipeline_stage必填 | string | 枚举 "completed" / "failed" | |
| worker_attempt_count必填 | integer | ≥1 | |
| fallback_occurred必填 | boolean | ||
| isolation_used必填 | boolean | ||
| attempts必填 | array<object> | 项数≤32 | |
| [ ] | object | 不接受额外字段 | |
| provider必填 | string | 枚举 "docparse" / "tencent" / "local" / "mineru" / "unknown" | |
| status必填 | string | 枚举 "succeeded" / "failed" / "unknown" | |
| scope必填 | string | 枚举 "group" / "page" / "isolation" / "unknown" | |
| page_count | integer | ≥0 | |
| duration_ms | integer | ≥0 | |
| safe_error_code | string | 长度≤64 | |
| retryable | boolean | ||
| fallback_allowed | boolean | ||
| attempts_truncated必填 | boolean | ||
| page_summary | object | 不接受额外字段 | |
| total必填 | integer | ≥0 | |
| ready必填 | integer | ≥0 | |
| degraded必填 | integer | ≥0 | |
| by_provider必填 | object | 不接受额外字段 | |
| docparse | integer | ≥0 | |
| tencent | integer | ≥0 | |
| local | integer | ≥0 | |
| warnings必填 | object | 不接受额外字段 | |
| count必填 | integer | ≥0 | |
| codes必填 | array<string> | 项数≤32;元素不重复 | |
| source_format | string | 长度≥1;长度≤32 | |
| canonicalized | boolean | ||
| content_version | string | 长度≥1;长度≤128 | |
| failure_stage | string | 枚举 "precondition" / "source_read" / "convert" / "split" / "provider_parse" / "persist" / "unknown" |
异步接口:返回 202 后,用 data.job_id 调用 getJob 轮询;状态 succeeded 后调用 getJobResult 读取结果。详见异步任务。
错误状态
| HTTP | 含义 |
|---|---|
| 400 | 请求参数无效 |
| 401 | API Key 无效 |
| 403 | API Key 无权限 |
| 404 | 文档、任务或其他资源不存在 |
| 409 | 幂等键、任务状态或资源状态冲突 |
| 413 | 请求体过大 |
| 415 | 请求媒体类型不支持 |
| 429 | 队列或模型并发额度已满,请稍后重试 |
| 500 | 服务内部异常 |
| 502 | 上游服务异常 |
| 503 | 能力暂不可用 |
| 504 | 上游服务超时 |