> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hanji.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Parse a document by URL

> Download the document at `url`, parse it, and return text, table, and image chunks in reading order. Every chunk carries its page number and bounding box. Billed per page.



## OpenAPI

````yaml /openapi.json post /v1/parse
openapi: 3.1.0
info:
  title: Hanji
  summary: Parse documents into structured data. Text, tables, and figures in one call.
  version: 0.1.0
servers:
  - url: https://api.hanji.dev
    description: production
security:
  - APIKeyHeader: []
paths:
  /v1/parse:
    post:
      tags:
        - v1
      summary: Parse a document by URL
      description: >-
        Download the document at `url`, parse it, and return text, table, and
        image chunks in reading order. Every chunk carries its page number and
        bounding box. Billed per page.
      operationId: extract_v1
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExtractRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExtractResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    ExtractRequest:
      properties:
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
          description: >-
            HTTP(S) URL of the document to parse (URL route only). Input type is
            detected from the file itself; the extension is a hint.
        extract_text:
          type: boolean
          title: Extract Text
          description: >-
            Include text chunks in the response. Set false to skip text spans;
            table chunks (and figures, when extract_images is true) are still
            returned.
          default: true
        extract_images:
          type: boolean
          title: Extract Images
          description: >-
            Include figure (image) chunks in the response. Set false to skip
            figure extraction; text and table chunks are still returned.
          default: true
        ocr:
          type: string
          enum:
            - auto
            - never
            - force
          title: Ocr
          description: >-
            Deprecated. Accepted for backward compatibility but currently has no
            effect.
          default: auto
        table_output_format:
          type: string
          enum:
            - markdown
            - cell_grid
            - html
          title: Table Output Format
          description: >-
            How table chunks are structured. 'html' puts an HTML table in
            page_content; 'cell_grid' returns true per-cell bounding boxes.
            Echoed on each table chunk (falls back to 'markdown' if localization
            fails).
          default: markdown
        chunking:
          type: string
          enum:
            - none
            - semantic
          title: Chunking
          description: >-
            'none' (default): response unchanged. 'semantic': additionally
            return `segments` — elements grouped toward chunk_size characters at
            semantic/structural boundaries (headings, gaps, page breaks), each
            segment carrying embed-ready markdown content plus member records
            with page numbers and bounding boxes.
          default: none
        chunk_size:
          type: integer
          title: Chunk Size
          description: >-
            Target segment size in characters of segment content. Segments land
            in a +/-25% band around this target (default 750-1250). Only
            meaningful when chunking is enabled; validated (200-8000) only in
            that case and ignored otherwise.
          default: 1000
        include_content:
          type: boolean
          title: Include Content
          description: >-
            false (default): response unchanged. true: additionally return
            `content` — the entire parsed document as a single text string,
            concatenated in reading order. Not reformatted as structured
            markdown; it is the document's own text content end to end.
          default: false
      type: object
      title: ExtractRequest
      description: |-
        Input to a parse request.

        Server-side limits (page count, file size) are not user-configurable.
        Unknown fields are accepted and ignored for backward compatibility.
        The ``ocr`` knob is deprecated and currently has no effect.
    ExtractResponse: {}
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-KEY

````