> ## Documentation Index
> Fetch the complete documentation index at: https://docs.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/openapi-v3.yaml post /api/v3/preview
openapi: 3.1.0
info:
  title: LightOn API
  version: 3.15.0 (v3)
  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://paradigm.lighton.ai
security: []
tags:
  - name: Agents
    description: Operations about agents
  - name: Threads
    description: Operations about agents conversation threads
  - name: Tools
    description: Operations about native tools
  - name: Models
    description: Operations about AI models
  - name: MCP
    description: Operations about MCP servers
  - name: Sources
    description: Operations about sources used by agents conversation threads
  - name: Artifacts
    description: Operations about artifacts generated by agents conversation threads
  - name: Agent
    description: >-
      Operations about agents (deprecated). Please use the 'Agents' API
      component instead.
  - name: Files
    description: Operations about files
  - name: Facets
    description: Operations about facets
  - name: Tags
    description: Operations about tags
  - name: Workspaces
    description: Operations about workspaces
  - name: Files Processing
    description: Operations about files processing
  - name: Users
    description: Operations about users
  - name: API Keys
    description: Operations about API keys
  - name: User Groups
    description: Operations about user groups
  - name: SCIM
    description: Operations about SCIM
paths:
  /api/v3/preview:
    post:
      tags:
        - Models
      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':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIV3ErrorResponse'
              examples:
                UnsupportedFormat:
                  value:
                    id: null
                    code: 400
                    error: unsupported_format
                    detail: Unsupported document format.
                    doc_url: https://developers.lighton.ai/errors#unsupported_format
                  summary: Unsupported format
          description: Bad request — missing document, unsupported format, or invalid URL.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIV3ErrorResponse'
              examples:
                Unauthorized:
                  value:
                    id: null
                    code: 401
                    error: unauthorized
                    detail: >-
                      Authentication credentials were not provided or are
                      invalid.
                    doc_url: https://developers.lighton.ai/errors#unauthorized
          description: Authentication credentials were not provided or are invalid
        '413':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIV3ErrorResponse'
              examples:
                PayloadTooLarge:
                  value:
                    id: null
                    code: 413
                    error: payload_too_large
                    detail: File exceeds the 20 MB size limit.
                    doc_url: https://developers.lighton.ai/errors#payload_too_large
                  summary: Payload too large
          description: File exceeds the 20 MB size limit.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIV3ErrorResponse'
              examples:
                ConversionFailed:
                  value:
                    id: null
                    code: 422
                    error: validation_error
                    detail: Conversion failed — corrupt file or LibreOffice error.
                    doc_url: https://developers.lighton.ai/errors#validation_error
                  summary: Conversion failed
          description: Conversion failed — corrupt file or LibreOffice error.
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIV3ErrorResponse'
              examples:
                TooManyRequests:
                  value:
                    id: null
                    code: 429
                    error: too_many_requests
                    detail: Too many requests. Please try again later.
                    doc_url: https://developers.lighton.ai/errors#too_many_requests
                  summary: Too Many Requests
          description: Too many requests
        '503':
          description: >-
            API is under maintenance. Check `GET /api/v3/system/status` for
            active periods and retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceMaintenance503'
      security:
        - bearerAuth: []
components:
  schemas:
    APIV3ErrorResponse:
      type: object
      properties:
        id:
          type:
            - string
            - 'null'
          description: >-
            Job/resource id when one already exists (useful for async error
            diagnosis); null otherwise.
        code:
          type: integer
          description: HTTP status code
        error:
          type: string
          description: Error code used by the UI as a translation key
        detail:
          type: string
          description: Human-readable error message for developers
        doc_url:
          type: string
          description: Link to the error-code documentation page
      required:
        - code
        - detail
        - doc_url
        - error
        - id
    ServiceMaintenance503:
      type: object
      description: >-
        Returned by the maintenance middleware when the requested endpoint is
        blocked.
      required:
        - detail
        - error
        - mode
      properties:
        detail:
          type: string
          example: System is under maintenance.
        error:
          type: string
          example: service_maintenance
        mode:
          type: string
          enum:
            - full_shutdown
            - warning_banner
          description: >-
            `full_shutdown` blocks all traffic; `warning_banner` also blocks and
            shows a dismissible toast.
        reason:
          type: string
          description: Operator-supplied maintenance reason, if any.
        started_at:
          type: string
          format: date-time
        endpoint_category_names:
          type: array
          items:
            type: string
          description: >-
            Non-empty only for category-scoped periods. Empty means all
            endpoints are affected.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your auth token.

````