> ## Documentation Index
> Fetch the complete documentation index at: https://adp-doc.laiye.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 创建文档抽取异步任务

> 创建文档抽取任务并立即返回 task_id。适用于大文档或长时间抽取任务。

启用人机协同时，data.metadata.collaboration_task_id 是协同任务 ID，data.task_id 是异步抽取任务 ID，二者不能互换。高速自定义抽取不支持人机协同。




## OpenAPI

````yaml api-reference/adp-api.yaml POST /open/agentic_doc_processor/{tenant_name}/v1/app/doc/extract/create/task
openapi: 3.1.0
info:
  title: ADP API
  version: 1.0.0
  description: >-
    Laiye ADP 官方 OpenAPI
    接口规范，覆盖文档抽取、解析与转换，抽取应用管理、Webhook、人机协同、积分查询，以及工作流发现、运行、导出和文件管理。
  license:
    name: MIT
    identifier: MIT
servers:
  - url: https://adp.laiye.com
    description: ADP 生产环境
security: []
tags:
  - name: 文档抽取
    description: 从上传的文档中抽取结构化字段。
  - name: 文档解析
    description: 识别上传文档中的文字、版面块和位置信息。
  - name: 文档转换
    description: 将 PDF、Office、OFD 和图片转换为页面图片或电子表格结构。
  - name: 应用管理
    description: 创建、修改、删除和查询抽取应用及配置。
  - name: Webhook
    description: 查询事件目录并管理事件回调。
  - name: 账户
    description: 查询账户积分和使用情况。
  - name: 工作流
    description: 查询业务工作流模板、运行工作流应用并查询执行结果。
  - name: 工作流文件
    description: 上传和管理工作流应用使用的文件。
  - name: 人机协同
    description: 配置审核触发规则，查询协同任务并提交人工修正。
paths:
  /open/agentic_doc_processor/{tenant_name}/v1/app/doc/extract/create/task:
    post:
      tags:
        - 文档抽取
      summary: 创建文档抽取异步任务
      description: >
        创建文档抽取任务并立即返回 task_id。适用于大文档或长时间抽取任务。


        启用人机协同时，data.metadata.collaboration_task_id 是协同任务 ID，data.task_id
        是异步抽取任务 ID，二者不能互换。高速自定义抽取不支持人机协同。
      operationId: createDocumentExtractTask
      parameters:
        - $ref: '#/components/parameters/TenantName'
        - $ref: '#/components/parameters/AcceptLanguage'
      requestBody:
        $ref: '#/components/requestBodies/DocumentExtractRequest'
      responses:
        '200':
          $ref: '#/components/responses/TaskCreateResponse'
        '422':
          $ref: '#/components/responses/ValidationError'
      security:
        - ApiKeyAuth: []
components:
  parameters:
    TenantName:
      name: tenant_name
      in: path
      required: true
      description: 租户名称，默认 laiye。
      schema:
        type: string
        default: laiye
    AcceptLanguage:
      name: accept-language
      in: header
      required: false
      description: 返回字段名称的语言。默认 zh 返回中文字段名；设置为 en 返回英文字段名。
      schema:
        type: string
        enum:
          - zh
          - en
        default: zh
  requestBodies:
    DocumentExtractRequest:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DocumentExtractRequest'
          examples:
            fileUrl:
              value:
                app_id: app_abc123
                file_url: >-
                  https://adp.laiye.com/web/agentic_doc_processor/laiye/file/2003c711818811f1a36200163e358400
                with_rec_result: false
            fileBase64:
              value:
                app_id: app_abc123
                file_base64: JVBERi0xLjQKJcfs...
                with_rec_result: true
  responses:
    TaskCreateResponse:
      description: 任务创建结果。
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/SimpleResponse'
              - type: object
                properties:
                  data:
                    type: object
                    properties:
                      task_id:
                        type: string
                      metadata:
                        type: object
                        additionalProperties: true
                        description: 文档处理任务元数据。
                        properties:
                          collaboration_task_id:
                            type:
                              - string
                              - 'null'
                            description: >-
                              启用协同时返回的协同任务主键 ID，用于查询协同任务及提交 file_task_id。与外层
                              task_id 不同。
          example:
            code: success
            message: ''
            data:
              task_id: 94fe9b74e0e311f091505e345594c618
              metadata: {}
    ValidationError:
      description: 参数校验错误。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/HTTPValidationError'
          example:
            detail:
              - type: greater_than
                loc:
                  - query
                  - limit
                msg: Input should be greater than 0
                input: 0
                ctx:
                  gt: 0
  schemas:
    DocumentExtractRequest:
      oneOf:
        - title: 使用文件 URL
          type: object
          additionalProperties: false
          properties:
            app_id:
              default: app_abc123
              type: string
              description: 应用的唯一标识。
            file_url:
              default: >-
                https://adp.laiye.com/web/agentic_doc_processor/laiye/file/2003c711818811f1a36200163e358400
              type: string
              format: uri
              description: 待处理文件 URL，与 file_base64 二选一。
            file_name:
              type: string
              description: 文件名称。使用 Base64 或无法从 URL 判断文件名时可传入。
            with_rec_result:
              type: boolean
              description: 是否返回文档解析结果。高速版抽取不返回解析结果。
              default: false
          required:
            - app_id
            - file_url
        - title: 使用文件 Base64
          type: object
          additionalProperties: false
          properties:
            app_id:
              default: app_abc123
              type: string
              description: 应用的唯一标识。
            file_base64:
              default: JVBERi0xLjQKJcfs...
              type: string
              description: 待处理文件 Base64，与 file_url 二选一。
            file_name:
              type: string
              description: 文件名称。使用 Base64 或无法从 URL 判断文件名时可传入。
            with_rec_result:
              type: boolean
              description: 是否返回文档解析结果。高速版抽取不返回解析结果。
              default: false
          required:
            - app_id
            - file_base64
    SimpleResponse:
      type: object
      properties:
        code:
          oneOf:
            - type: string
            - type: integer
          description: 业务码。成功通常为 success 或 200。
        message:
          type: string
          description: 返回信息。
        tips:
          type:
            - string
            - 'null'
          description: 详细信息，默认为空。
    HTTPValidationError:
      type: object
      description: FastAPI/Pydantic 请求参数校验错误。
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorItem'
      required:
        - detail
    ValidationErrorItem:
      type: object
      additionalProperties: true
      properties:
        type:
          type: string
          description: 校验错误类型。
        loc:
          type: array
          description: 错误字段在请求中的位置。
          items:
            oneOf:
              - type: string
              - type: integer
        msg:
          type: string
          description: 可读的错误说明。
        input:
          description: 导致校验失败的输入值。
        ctx:
          type: object
          additionalProperties: true
          description: 校验器提供的补充上下文。
        url:
          type: string
          format: uri
          description: Pydantic 错误说明链接。
      required:
        - type
        - loc
        - msg
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: 生产环境 API Key，可在 ADP 平台的「我的 API」中查看。请确保 API Key 有效且属于生产环境。

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.