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

# Document question answering (image + optional word_boxes)



## OpenAPI

````yaml /api-reference/openapi.json post /v1/question-answering/document
openapi: 3.1.0
info:
  title: SynapsAI Inference API
  version: 1.0.0
servers:
  - url: https://api.synapsai.cloud
    description: Production server
security: []
paths:
  /v1/question-answering/document:
    post:
      summary: Document question answering (image + optional word_boxes)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentQuestionAnsweringRequest'
      responses:
        '200':
          description: Document QA response
          content:
            application/json:
              schema:
                type: object
                properties:
                  score:
                    type: number
                  start:
                    type: integer
                  end:
                    type: integer
                  answer:
                    type: string
                  words:
                    type: array
                    items:
                      type: integer
components:
  schemas:
    DocumentQuestionAnsweringRequest:
      allOf:
        - type: object
          description: Request for document (image) question answering pipelines.
          properties:
            image:
              oneOf:
                - type: string
                - type: object
                - type: string
                  format: binary
              description: >-
                Image of the document (PIL-like object, base64 string or binary
                upload). Required.
            question:
              type: string
              description: Question to ask about the document. Required.
            word_boxes:
              type: array
              items:
                oneOf:
                  - type: string
                  - type: array
                    items:
                      type: number
              nullable: true
              description: >-
                Optional list of (word, box) tuples or normalized bounding boxes
                to provide OCR words/boxes.
            top_k:
              type: integer
              default: 1
              description: Number of top answers to return.
            doc_stride:
              type: integer
              default: 128
              description: >-
                Stride size for splitting long documents into chunks with
                overlap.
            max_answer_len:
              type: integer
              default: 15
              description: Maximum length (in tokens) for returned answers.
            max_seq_len:
              type: integer
              default: 384
              description: Maximum total sequence length (context + question) in tokens.
            max_question_len:
              type: integer
              default: 64
              description: Maximum question length after tokenization.
            handle_impossible_answer:
              type: boolean
              default: false
              description: If true, allow returning an 'impossible' / no-answer result.
            lang:
              type: string
              nullable: true
              description: Language hint for OCR; default is English if omitted.
            tesseract_config:
              type: string
              nullable: true
              description: Extra configuration flags to pass to Tesseract OCR (if used).
            timeout:
              type: number
              nullable: true
              description: >-
                Maximum time in seconds to wait for external image
                fetching/processing.
          required:
            - image
            - question

````