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

> 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.0.3
info:
  title: Paradigm API
  version: xenial-xerus (v2)
  description: >-
    A versatile and adaptable tool designed to integrate Generative AI into your
    applications
servers:
  - url: https://paradigm.lighton.ai
security: []
tags:
  - name: Models
    description: Operations about AI models
  - name: Files Search
    description: Operations about files search
  - name: Files
    description: Operations about files
  - name: Upload Sessions
    description: Operations about upload sessions
  - name: Workspaces
    description: Operations about workspaces
  - 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: Monitoring
    description: Operations about monitoring
  - 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: |-
        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: ''
      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
          readOnly: true
          nullable: true
        text:
          type: string
          readOnly: true
        metadata:
          readOnly: true
        document:
          type: integer
          readOnly: true
          nullable: true
        document_attributes:
          type: object
          additionalProperties: {}
          nullable: true
          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
    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.

````