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

# Generate an answer with a single document

> **Deprecated — this endpoint will be removed in a future release. Use `POST /api/v3/ask` instead.**

This endpoint can be used to ask a question about a document.

The question is required and should be a string .

The id of the document is a path parameter.



## OpenAPI

````yaml /api-reference/openapi-v2.yaml post /api/v2/files/{id}/ask-question
openapi: 3.1.0
info:
  title: LightOn API
  version: 3.15.0 (v2)
  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: Files Search
    description: Operations about files search
  - name: Models
    description: Operations about AI models
  - name: Files
    description: Operations about files
  - name: Workspaces
    description: Operations about workspaces
  - name: Upload Sessions
    description: Operations about upload sessions
  - name: Users
    description: Operations about users
  - name: Companies
    description: Operations about companies
  - name: SCIM
    description: Operations about SCIM
  - name: Feedbacks
    description: Operations about feedbacks
  - name: Reporting
    description: Operations about reporting
  - name: Platform Status
    description: Operations about platform status
paths:
  /api/v2/files/{id}/ask-question:
    post:
      tags:
        - Files
      summary: Generate an answer with a single document
      description: >-
        **Deprecated — this endpoint will be removed in a future release. Use
        `POST /api/v3/ask` instead.**


        This endpoint can be used to ask a question about a document.


        The question is required and should be a string .


        The id of the document is a path parameter.
      operationId: api_v2_files_ask_question_create
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AskQuestionRequest'
            examples:
              ExampleQuestionString:
                value:
                  question: example question
                summary: example question string
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/AskQuestionRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/AskQuestionRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AskQuestionResponse'
          description: ''
      deprecated: true
      security:
        - bearerAuth: []
components:
  schemas:
    AskQuestionRequest:
      type: object
      description: Request serializer for asking a question about a document.
      properties:
        question:
          type: string
          description: The question to ask about the document
          maxLength: 2048
      required:
        - question
    AskQuestionResponse:
      type: object
      description: >-
        Response serializer for the result of asking a question about a
        document.
      properties:
        response:
          type: string
          description: The generated response to the question
        chunks:
          type: array
          items:
            $ref: '#/components/schemas/DocumentChunkResponse'
          description: Relevant document chunks used to generate the response
      required:
        - chunks
        - response
    DocumentChunkResponse:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        uuid:
          type: string
          format: uuid
          readOnly: true
        content_id:
          type:
            - string
            - 'null'
          readOnly: true
        text:
          type: string
          readOnly: true
        metadata:
          allOf:
            - $ref: '#/components/schemas/ChunkMetadataResponse'
          readOnly: true
          description: >-
            Provenance and positioning metadata: page range, title, source
            filename, and neighbouring chunk UUIDs.
        document:
          type:
            - integer
            - 'null'
          readOnly: true
        document_attributes:
          type:
            - object
            - 'null'
          additionalProperties: {}
          readOnly: true
        chunk_type:
          allOf:
            - $ref: '#/components/schemas/ChunkTypeEnum'
          readOnly: true
        created_at:
          type: string
          format: date-time
          readOnly: true
        updated_at:
          type: string
          format: date-time
          readOnly: true
      required:
        - chunk_type
        - content_id
        - created_at
        - document
        - document_attributes
        - id
        - metadata
        - text
        - updated_at
        - uuid
    ChunkMetadataResponse:
      description: >-
        Provenance and positioning metadata returned alongside every retrieved
        chunk.
      properties:
        pages:
          default: ''
          description: >-
            1-indexed page (or page range) of the parent document covered by the
            chunk. Single page: '5'. Multi-page span: '3-4'.
          title: Pages
          type: string
        total_pages:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          description: >-
            Total page count of the parent document. Null when unknown (e.g.
            spreadsheets).
          title: Total Pages
        title:
          default: ''
          description: Parent document's title. Empty when the document has no title.
          title: Title
          type: string
        source:
          default: ''
          description: Original filename of the parent document, e.g. 'design-doc.pdf'.
          title: Source
          type: string
        parser:
          default: ''
          description: Parser that produced the chunk (e.g. 'vision' for vision chunks).
          title: Parser
          type: string
        folder_name:
          default: ''
          description: >-
            Name of the immediate folder the document was imported from. Empty
            for direct uploads.
          title: Folder Name
          type: string
        coords:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            Bounding boxes of the chunk's text on the source PDF, as a
            semicolon-joined string of 'page,x,y,w,h' tuples (e.g.
            '3,72.0,120.0,450.0,18.0;3,72.0,140.0,450.0,18.0'). Null when
            unavailable (spreadsheets, vision chunks).
          title: Coords
        previous:
          default: ''
          description: >-
            UUID of the previous chunk in the document. Empty for the first
            chunk.
          title: Previous
          type: string
        next:
          default: ''
          description: UUID of the next chunk in the document. Empty for the last chunk.
          title: Next
          type: string
        overlapping:
          default: ''
          description: >-
            Semicolon-joined UUIDs of chunks that share text with this chunk.
            Empty when there is no overlap.
          title: Overlapping
          type: string
        token_length:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          description: Number of tokens in the chunk text. Null for vision chunks.
          title: Token Length
      title: ChunkMetadataResponse
      type: object
    ChunkTypeEnum:
      enum:
        - text
        - table
      type: string
      description: |-
        * `text` - text
        * `table` - table
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your auth token.

````