---
title: "L016 Document Parsing"
method: POST
path: "/rd-llm/v1/documents/doc_parsing"
tags: ["Others"]
---

# L016 Document Parsing

`POST /rd-llm/v1/documents/doc_parsing`

## Request

- Base URL: `https://connect.patsnap.com`
- URL: `https://connect.patsnap.com/rd-llm/v1/documents/doc_parsing`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/patsnap/apis/patsnap-open-platform-api/docs/rd-llm/v1/documents/doc_parsing/post.ts> (a function with typed inputs; its response is checked against the schema)

Run layout detection and OCR on the uploaded file. The file type is inferred from the filename extension. Supported types: png, jpg, jpeg, pdf, doc, docx, ppt, pptx, xls, and xlsx. Each file must not exceed 20 MB or 200 pages; a request times out if processing exceeds 300 seconds and returns the image link is a signed link with a validity period of 7 days. output_format is optional and defaults to markdown.

## Request body `multipart/form-data`

- L016DocumentsDocParsingRequest
  - `file` string, required: File to parse. Supported types: png, jpg, jpeg, pdf, doc, docx, ppt, pptx, xls, and xlsx. Each file must not exceed 20 MB or 200 pages.
  - `output_format` string: Output format: both returns structured JSONL data and Markdown; jsonl returns structured JSONL data only; markdown returns Markdown only. The returned image link is a signed link with a validity period of 7 days. Defaults to markdown if not specified.

## Response `200`

Successful l016 document parsing response.

- L016DocumentsDocParsingResponse
  - `data` L016DocumentsDocParsingDocumentParseResponse, required
    - `state` string, required: Execution state; success indicates that parsing completed successfully.
    - `results` L016DocumentsDocParsingDocumentResultItem[], required: Structured JSONL data; each element represents one document region. An empty array is returned when output_format=markdown.
      - `url` string, uri: URL of the cropped region image, primarily for chemical structures, figures, equations, and tables; null when unavailable. The returned image link is a signed link with a validity period of 7 days.
      - `bbox` unknown[], required: Normalized coordinates [x1, y1, x2, y2, confidence], with every value ranging from 0 to 1.
        - unknown
      - `page` integer, required: Zero-based page index; 0 represents the first page.
      - `type` string, required: Original region type produced by the layout model.
    - `markdown` string: Complete Markdown summary. Returned when output_format is both or markdown; omitted when output_format=jsonl.
    - `file_type` string, required: Input file type inferred from the uploaded filename extension.
    - `total_pages` integer, required: Total number of pages; always 1 for an image.
  - `status` string, required: The request completed successfully.
  - `error_msg` string, required: Always success on success.
  - `error_code` integer, required: Always 0 on success.

## Other responses

- `400`: Invalid request, missing file, empty file, or unsupported file format.
- `413`: File exceeds 20 MB or the document exceeds 200 pages.
- `500`: Internal server error; error_code is INTERNAL_ERROR.
- `502`: Downstream processing failed; error_code may be OCR_FAILED, LAYOUT_DETECTION_FAILED, PDF_PARSE_FAILED, or DOCUMENT_CONVERSION_FAILED.
- `504`: Request processing exceeded 300 seconds; error_code is GATEWAY_TIMEOUT.

---

[API](https://skmtc.dev/patsnap/apis/patsnap-open-platform-api.md) - [All operations](https://skmtc.dev/patsnap/apis/patsnap-open-platform-api/llms.txt) - [OpenAPI document](https://skmtc.dev/patsnap/apis/patsnap-open-platform-api/revisions/c2264a0de595?raw)
