> ## 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.

# Convert document (sync)

> Convert a PDF, DOC/DOCX, XLS/XLSX, PPT/PPTX, OFD file, or common image into page images. XLSX input may instead return a native spreadsheet structure. Provide exactly one of `file_url` and `file_base64`.

The current implementation accepts at most 50 MiB and 260 pages. A synchronous request may reach the service timeout at approximately 120 seconds, so production integrations should prefer the asynchronous create and query endpoints. A failure branch may return HTTP 200 with `code=success` and `data=null`. Confirm that `data` exists, then inspect `task_id`, `img_detail_list`, or the spreadsheet structure fields. Returned URLs are currently valid for approximately one hour, but this is not a stable SLA; download them promptly.




## OpenAPI

````yaml en/api-reference/adp-api.yaml POST /open/agentic_doc_processor/{tenant_name}/v1/doc/convert
openapi: 3.1.0
info:
  title: ADP API
  version: 1.0.0
  description: >-
    Laiye ADP OpenAPI reference for document extraction, recognition, and
    conversion; extraction application management; webhooks; human
    collaboration; credit usage; workflow discovery, runs, exports, and file
    management.
  license:
    name: MIT
    identifier: MIT
servers:
  - url: https://adp-global.laiye.com
    description: ADP global production endpoint
security: []
tags:
  - name: Document extraction
    description: Extract structured fields from uploaded documents.
  - name: Document recognition
    description: Recognize text, layout blocks, and positions from uploaded documents.
  - name: Document conversion
    description: >-
      Convert PDFs, Office documents, OFD files, and images into page images or
      native spreadsheet structures.
  - name: Application management
    description: >-
      Create, update, delete, and query extraction applications and
      configurations.
  - name: Webhook
    description: List system events and manage event callbacks.
  - name: Account
    description: Query credit usage.
  - name: Workflow
    description: >-
      List business workflow templates, run workflow applications, and query run
      results.
  - name: Workflow files
    description: Upload and manage files used by workflow applications.
  - name: Human collaboration
    description: >-
      Configure review triggers, query collaboration tasks, and submit human
      corrections.
paths:
  /open/agentic_doc_processor/{tenant_name}/v1/doc/convert:
    post:
      tags:
        - Document conversion
      summary: Convert document (sync)
      description: >
        Convert a PDF, DOC/DOCX, XLS/XLSX, PPT/PPTX, OFD file, or common image
        into page images. XLSX input may instead return a native spreadsheet
        structure. Provide exactly one of `file_url` and `file_base64`.


        The current implementation accepts at most 50 MiB and 260 pages. A
        synchronous request may reach the service timeout at approximately 120
        seconds, so production integrations should prefer the asynchronous
        create and query endpoints. A failure branch may return HTTP 200 with
        `code=success` and `data=null`. Confirm that `data` exists, then inspect
        `task_id`, `img_detail_list`, or the spreadsheet structure fields.
        Returned URLs are currently valid for approximately one hour, but this
        is not a stable SLA; download them promptly.
      operationId: convertDocument
      parameters:
        - $ref: '#/components/parameters/TenantName'
      requestBody:
        $ref: '#/components/requestBodies/DocumentConvertRequest'
      responses:
        '200':
          $ref: '#/components/responses/DocumentConvertResponse'
        '422':
          $ref: '#/components/responses/ValidationError'
      security:
        - ApiKeyAuth: []
components:
  parameters:
    TenantName:
      name: tenant_name
      in: path
      required: true
      description: 'Tenant name. Default: laiye.'
      schema:
        type: string
        default: laiye
  requestBodies:
    DocumentConvertRequest:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DocumentConvertRequest'
          examples:
            fileUrl:
              value:
                file_url: https://example.com/invoice.pdf
                scale: 1
                first_convert_page: 1
                last_convert_page: 5
                result_mode: url
            fileBase64:
              value:
                file_base64: JVBERi0xLjQKJcfs...
                result_mode: base64
  responses:
    DocumentConvertResponse:
      description: >-
        Document conversion result. While processing is in progress or after a
        failure, the service may return an empty result or `data=null`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DocumentConvertResponse'
          example:
            code: success
            message: ''
            tips: null
            data:
              task_id: task_abc123
              img_detail_list:
                - page_num: 1
                  img_base64: ''
                  img_url: https://example.com/temp/task_abc123/page-1.png
                  width: 1240
                  height: 1754
                  preprocess: {}
              total_num: 1
              metadata: {}
              file_type: pdf
              source_file_type: pdf
              spreadsheet_manifest_file_id: ''
              spreadsheet_manifest_url: ''
              view_type: ''
              page_count: 1
              sheet_count: 0
              logical_unit_count: 0
              document_contents: []
              document_details: []
              warnings: []
              billing: {}
    ValidationError:
      description: Validation error.
      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:
    DocumentConvertRequest:
      type: object
      additionalProperties: false
      oneOf:
        - title: Use file URL
          required:
            - file_url
        - title: Use Base64 file
          required:
            - file_base64
      properties:
        file_url:
          type: string
          format: uri
          maxLength: 2048
          description: >-
            Public HTTPS URL of the file to convert. Do not pass an
            internal-network URL or a URL containing long-lived credentials.
        file_base64:
          type: string
          format: byte
          description: >-
            Base64 content of the file to convert. The decoded file can be at
            most 50 MiB.
        scale:
          type: number
          exclusiveMinimum: 0
          default: 1
          description: >-
            Page scale factor. The server currently exposes no stable upper
            bound; use the default value unless necessary.
        first_convert_page:
          type: integer
          minimum: 1
          description: >-
            First page to convert, starting at 1. Omit it to start from the
            first page.
        last_convert_page:
          type: integer
          minimum: 1
          description: >-
            Last page to convert, starting at 1 and not less than the first
            page. Omit it to continue through the last page.
        result_mode:
          type: string
          enum:
            - url
            - base64
          default: url
          description: >-
            How page images are returned. URLs are temporary; Base64
            significantly increases the response size.
    DocumentConvertResponse:
      allOf:
        - $ref: '#/components/schemas/SimpleResponse'
        - type: object
          properties:
            data:
              oneOf:
                - $ref: '#/components/schemas/DocumentConvertData'
                - type: 'null'
    HTTPValidationError:
      type: object
      description: FastAPI/Pydantic request validation error.
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorItem'
      required:
        - detail
    SimpleResponse:
      type: object
      properties:
        code:
          oneOf:
            - type: string
            - type: integer
          description: Business code. A successful response is usually success or 200.
        message:
          type: string
          description: Response message.
        tips:
          type:
            - string
            - 'null'
          description: Details. Defaults to null.
    DocumentConvertData:
      type: object
      properties:
        task_id:
          type: string
        img_detail_list:
          type: array
          items:
            $ref: '#/components/schemas/DocumentConvertImage'
        total_num:
          type: integer
          minimum: 0
        metadata:
          type: object
          additionalProperties: true
        file_type:
          type: string
          description: Conversion result type, such as `pdf`, `image`, or `spreadsheet`.
        source_file_type:
          type: string
          description: Detected source-file extension type.
        spreadsheet_manifest_file_id:
          type: string
        spreadsheet_manifest_url:
          type: string
          description: Temporary download URL for the native Excel preview manifest.
        view_type:
          type: string
          description: Set to `spreadsheet` for native Excel parsing.
        page_count:
          type: integer
          minimum: 0
        sheet_count:
          type: integer
          minimum: 0
        logical_unit_count:
          type: integer
          minimum: 0
        document_contents:
          type: array
          items:
            type: string
        document_details:
          type: array
          items: {}
        warnings:
          type: array
          items:
            type: object
            additionalProperties: true
        billing:
          type: object
          additionalProperties: true
      required:
        - task_id
        - img_detail_list
        - total_num
        - metadata
        - file_type
        - source_file_type
        - spreadsheet_manifest_file_id
        - spreadsheet_manifest_url
        - view_type
        - page_count
        - sheet_count
        - logical_unit_count
        - document_contents
        - document_details
        - warnings
        - billing
    ValidationErrorItem:
      type: object
      additionalProperties: true
      properties:
        type:
          type: string
          description: Validation error type.
        loc:
          type: array
          description: Location of the invalid field in the request.
          items:
            oneOf:
              - type: string
              - type: integer
        msg:
          type: string
          description: Human-readable validation error message.
        input:
          description: Input value that failed validation.
        ctx:
          type: object
          additionalProperties: true
          description: Additional context supplied by the validator.
        url:
          type: string
          format: uri
          description: Link to the Pydantic error documentation.
      required:
        - type
        - loc
        - msg
    DocumentConvertImage:
      type: object
      properties:
        page_num:
          type: integer
          minimum: 0
        img_base64:
          type: string
          description: >-
            Page-image content when `result_mode=base64`; otherwise it is
            generally an empty string.
        img_url:
          type: string
          description: >-
            Temporary page URL when `result_mode=url`; otherwise it is generally
            an empty string.
        width:
          type: integer
          minimum: 0
        height:
          type: integer
          minimum: 0
        preprocess:
          type: object
          additionalProperties: true
      required:
        - page_num
        - img_base64
        - img_url
        - width
        - height
        - preprocess
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        Production API Key. You can find it under My API in the ADP platform.
        Make sure the API Key is active and belongs to the production
        environment.

````

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