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

# Render a document as PDF

> Convert a document into a PDF suitable for inline preview.

Accepts a **file upload** (multipart/form-data), a **document URL**, or a **file_id** referencing a document already ingested in the platform (JSON body). The conversion is synchronous — the PDF bytes are returned directly.

**Supported file types:** `.pdf`, `.png`, `.jpg`, `.jpeg`, `.pptx`, `.ppt`, `.odp`, `.docx`, `.odt`, `.doc`, `.html`, `.xhtml`

**Size limit:** 20 MB.



## OpenAPI

````yaml /api-reference/api-console.yaml post /api/v3/preview
openapi: 3.1.0
info:
  title: LightOn API
  version: 3.12.0 (v1)
  description: >-
    LightOn gives you an API to search, parse, and ingest documents at scale.
    Build knowledge-retrieval pipelines without managing vector databases or OCR
    models.
servers:
  - url: https://api.lighton.ai
security: []
tags:
  - name: Ask
    description: >-
      Retrieval-augmented generation: search your indexed corpus and generate an
      LLM answer grounded in the retrieved passages. Supports streaming (SSE)
      and synchronous modes.
  - name: Search
    description: >-
      Hybrid vector + text retrieval over your indexed corpus. Returns ranked
      passages with provenance (file, page range, workspace). Optional reranking
      and vision mode.
  - name: Files
    description: Upload, list, fetch, and delete documents indexed in your workspaces.
  - name: Facets
    description: >-
      Organise documents with hierarchical content types and custom attributes
      per file. Start from starter templates or build your own classification
      schema from scratch.
  - name: Tags
    description: >-
      Manage flat, company-wide labels used to scope search and group content
      across workspaces.
  - name: Workspaces
    description: >-
      Create and manage workspaces — the access-controlled containers your
      documents live in.
  - name: Parse
    description: >-
      Convert documents into structured Markdown — PDFs, images, Office files,
      and HTML. Synchronous endpoint capped at 20 MB / 15 pages.
  - name: Extract
    description: >-
      Pull typed fields out of documents using a JSON Schema you provide. Sync
      mode for small documents (≤20 MB / 15 pages); async mode for larger jobs
      (≤100 MB / 1000 pages) with polling on a job ID.
  - name: API Keys
    description: >-
      Provision and revoke API keys used to authenticate against the Console
      API.
  - name: Budget
    description: >-
      Manage your organization's monthly spend budget and alert thresholds. Set
      a hard cap that blocks API requests when reached, and configure email
      notifications at custom spend percentages.
paths:
  /api/v3/preview:
    post:
      tags:
        - Parse
      summary: Render a document as PDF
      description: >-
        Convert a document into a PDF suitable for inline preview.


        Accepts a **file upload** (multipart/form-data), a **document URL**, or
        a **file_id** referencing a document already ingested in the platform
        (JSON body). The conversion is synchronous — the PDF bytes are returned
        directly.


        **Supported file types:** `.pdf`, `.png`, `.jpg`, `.jpeg`, `.pptx`,
        `.ppt`, `.odp`, `.docx`, `.odt`, `.doc`, `.html`, `.xhtml`


        **Size limit:** 20 MB.
      operationId: api_v3_preview_create
      requestBody:
        content:
          multipart/form-data:
            schema:
              multipart/form-data:
                type: object
                properties:
                  file:
                    type: string
                    format: binary
                    description: The document to convert.
              application/json:
                type: object
                properties:
                  document:
                    type: string
                    format: uri
                    description: Publicly accessible URL of the document to convert.
                  file_id:
                    type: integer
                    description: >-
                      ID of a document already ingested in the platform.
                      Mutually exclusive with `document`.
            examples:
              RenderAPDFViaFileUpload:
                value:
                  file: (binary)
                summary: Render a PDF via file upload
                description: Upload a document file directly for synchronous PDF rendering.
          application/x-www-form-urlencoded:
            schema:
              multipart/form-data:
                type: object
                properties:
                  file:
                    type: string
                    format: binary
                    description: The document to convert.
              application/json:
                type: object
                properties:
                  document:
                    type: string
                    format: uri
                    description: Publicly accessible URL of the document to convert.
                  file_id:
                    type: integer
                    description: >-
                      ID of a document already ingested in the platform.
                      Mutually exclusive with `document`.
          application/json:
            schema:
              multipart/form-data:
                type: object
                properties:
                  file:
                    type: string
                    format: binary
                    description: The document to convert.
              application/json:
                type: object
                properties:
                  document:
                    type: string
                    format: uri
                    description: Publicly accessible URL of the document to convert.
                  file_id:
                    type: integer
                    description: >-
                      ID of a document already ingested in the platform.
                      Mutually exclusive with `document`.
            examples:
              RenderADocumentViaURL:
                value:
                  document: https://example.com/report.docx
                summary: Render a document via URL
                description: Provide a publicly accessible document URL.
              RenderAnIngestedDocumentByID:
                value:
                  file_id: 42
                summary: Render an ingested document by ID
                description: Reference a document already ingested in the platform.
      responses:
        '200':
          description: PDF rendered successfully. Response body is the raw PDF bytes.
        '400':
          description: Bad request — missing document, unsupported format, or invalid URL.
        '401':
          description: Authentication credentials were not provided or are invalid.
        '413':
          description: File exceeds the 20 MB size limit.
        '422':
          description: Conversion failed — corrupt file or LibreOffice error.
        '429':
          description: >-
            Rate limit exceeded. Retry after the delay indicated in the
            Retry-After header.
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your auth token.

````