> ## 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 查询文档抽取状态和结果。 人机协同完成后，extraction_result 保留原始抽取值，output_result 返回最终修正值；协同状态请使用协同任务查询接口确认。



## OpenAPI

````yaml api-reference/adp-api.yaml GET /open/agentic_doc_processor/{tenant_name}/v1/app/doc/extract/query/task/{task_id}
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/query/task/{task_id}:
    get:
      tags:
        - 文档抽取
      summary: 查询文档抽取任务结果
      description: >-
        根据创建任务接口返回的 task_id 查询文档抽取状态和结果。 人机协同完成后，extraction_result
        保留原始抽取值，output_result 返回最终修正值；协同状态请使用协同任务查询接口确认。
      operationId: queryDocumentExtractTask
      parameters:
        - $ref: '#/components/parameters/TenantName'
        - $ref: '#/components/parameters/TaskId'
      responses:
        '200':
          $ref: '#/components/responses/DocumentExtractResponse'
        '422':
          $ref: '#/components/responses/ValidationError'
      security:
        - ApiKeyAuth: []
components:
  parameters:
    TenantName:
      name: tenant_name
      in: path
      required: true
      description: 租户名称，默认 laiye。
      schema:
        type: string
        default: laiye
    TaskId:
      name: task_id
      in: path
      required: true
      description: 任务 ID。
      schema:
        type: string
  responses:
    DocumentExtractResponse:
      description: 文档抽取结果。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DocumentExtractResponse'
          example:
            code: success
            message: ''
            data:
              task_id: 94fe9b74e0e311f091505e345594c618
              file_url: ''
              message: ''
              status: 4
              doc_recognize_result: []
              extraction_result: []
              extract_config_version: v1
              metadata: {}
              aigc: null
    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:
    DocumentExtractResponse:
      allOf:
        - $ref: '#/components/schemas/SimpleResponse'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/DocumentExtractData'
    HTTPValidationError:
      type: object
      description: FastAPI/Pydantic 请求参数校验错误。
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorItem'
      required:
        - detail
    SimpleResponse:
      type: object
      properties:
        code:
          oneOf:
            - type: string
            - type: integer
          description: 业务码。成功通常为 success 或 200。
        message:
          type: string
          description: 返回信息。
        tips:
          type:
            - string
            - 'null'
          description: 详细信息，默认为空。
    DocumentExtractData:
      type: object
      properties:
        task_id:
          type: string
        file_url:
          type: string
        message:
          type: string
          description: 任务状态或处理结果说明。
        status:
          type: integer
          enum:
            - 0
            - 1
            - 2
            - 4
            - 5
            - 6
          description: 0=未知，1=就绪，2=运行中，4=成功，5=失败，6=取消或拒绝。
        doc_recognize_result:
          type: array
          items:
            $ref: '#/components/schemas/RecognizePage'
        extraction_result:
          description: 原始机器抽取结果，人工修正后仍保留。
          type: array
          items:
            $ref: '#/components/schemas/ExtractionField'
        extract_config_version:
          type: string
          description: 本次抽取使用的配置版本。
        collaboration_result:
          description: 人机协同审核详情。人工是否完成请查询协同任务 task_state。
          type: array
          items:
            type: object
            additionalProperties: true
        output_result:
          description: 最终结果；人工完成后包含修正值，请确认协同任务已通过或完成。
          type: array
          items:
            type: object
            additionalProperties: true
        metadata:
          type:
            - object
            - 'null'
          additionalProperties: true
          description: 文档处理任务元数据。
          properties:
            collaboration_task_id:
              type:
                - string
                - 'null'
              description: 协同任务主键 ID；仅在启用人机协同时存在。
        aigc:
          oneOf:
            - $ref: '#/components/schemas/AigcLabel'
            - type: 'null'
          description: AI 生成内容合规标识。
        spreadsheet_manifest_file_id:
          type: string
          description: Excel 原生预览 Manifest 文件 ID；非 Excel 文档通常返回空字符串。
        spreadsheet_manifest_url:
          type: string
          description: Excel 原生预览 Manifest 下载地址；非 Excel 文档通常返回空字符串。
        spreadsheet_billing:
          type:
            - object
            - 'null'
          additionalProperties: true
          description: Excel 工作表与内嵌图片计费信息。
    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
    RecognizePage:
      type: object
      properties:
        page_num:
          type: integer
        document_content:
          type: string
        document_details:
          type: array
          items:
            $ref: '#/components/schemas/DocumentDetail'
        stamps:
          type: array
          description: 印章识别结果。仅在开启 enable_stamp_recognition 且识别到印章时返回。
          items:
            type: object
            additionalProperties: true
    ExtractionField:
      type: object
      additionalProperties: true
      properties:
        field_key:
          type: string
        field_name:
          type: string
        field_values:
          type: array
          items:
            type: object
            additionalProperties: true
        references:
          type: array
          items:
            type: object
            additionalProperties: true
        table_values:
          type: array
          items:
            type: array
            items:
              type: object
              additionalProperties: true
    AigcLabel:
      type: object
      properties:
        Label:
          type: string
          description: 内容标识类型。
        ContentProducer:
          type: string
          description: 内容生成服务提供者编码。
        ProduceID:
          type: string
          description: 内容制作编号。
        ReservedCode1:
          type: string
          description: 内容生成侧预留校验码。
        ContentPropagator:
          type: string
          description: 内容传播服务提供者编码。
        PropagateID:
          type: string
          description: 内容传播编号。
        ReservedCode2:
          type: string
          description: 内容传播侧预留校验码。
        ProcessingTypes:
          type: array
          description: 本次响应涉及的 AI 处理类型。
          items:
            type: string
    DocumentDetail:
      type: object
      properties:
        type:
          type: string
        text:
          type: string
        position:
          type: array
          items:
            type: object
            properties:
              points:
                type: array
                items:
                  $ref: '#/components/schemas/Point'
        ocr_confidence:
          type: object
          properties:
            ocr_mean_confidence:
              type: number
            ocr_min_confidence:
              type: number
            is_overall_confidence:
              type: integer
    Point:
      type: object
      properties:
        x:
          type: number
        'y':
          type: number
  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.