Skip to main content

Question Answering

AI-powered document analysis

This guide covers the Question Answering API, which lets you ask natural-language questions about your indexed documents and receive AI-generated answers with source references. Files must be indexed as EliseFiles first — see File Indexation.

How It Works

Question Answering runs as an asynchronous job. You submit a request with a list of files to analyse and a list of questions, and the platform processes them in the background. You then poll for the job status and retrieve the results when complete.

Creating a QA Job

Submit a QA job by providing a set of target files and a list of questions. You can target files by individual EliseFile IDs, by Collection IDs, or both.

curl -X POST "https://<api-domain>/api/core/qa/jobs" \
-H "Authorization: Bearer <your-pat>" \
-H "Content-Type: application/json" \
-d '{
"files": {
"fileIds": ["a1b2c3d4-e5f6-7890-abcd-ef1234567890"],
"collectionIds": []
},
"questions": [
{
"id": "q1",
"question": "What is the main conclusion of this document?",
"answerType": { "dataType": "STRING", "multiValued": false }
},
{
"id": "q2",
"question": "What is the publication date?",
"answerType": { "dataType": "DATE", "multiValued": false }
}
]
}'

Targeting Files

The files field accepts both fileIds and collectionIds simultaneously. All files are processed together in a single job.

FieldTypeDescription
fileIdsstring[]UUIDs of individual indexed EliseFiles
collectionIdsstring[]UUIDs of Collections — all files in each collection are included

Defining Questions

Each question in the questions array is described by EliseQuestionInput:

FieldRequiredDescription
idYesUnique identifier for this question within the job
questionYesThe natural-language question to answer
answerTypeYesExpected answer format — see Answer Types below
guidelinesNoAdditional instructions to guide the AI answer
expectedAnswerNoReference answer used to compute answerValidity
inputQuestionIdsNoIDs of other questions whose answers feed into this one

Answer Types

The answerType.dataType field controls how the answer is formatted:

dataTypeDescriptionExample
STRINGFree text"The study found..."
INTInteger number42
FLOATDecimal number3.14
BOOLBoolean yes/notrue
DATEDate value"2024-01-15"
ENUMOne of a fixed list of values"HIGH"

For ENUM types, provide the allowed values in answerType.enumValues.

Polling Job Status

The job runs asynchronously. Poll the job endpoint until status is SUCCESS or FAILED.

curl -s "https://<api-domain>/api/core/qa/jobs/${JOB_ID}" \
-H "Authorization: Bearer <your-pat>"

Job Status Values

StatusDescription
PENDINGJob is queued and waiting to start
RUNNINGJob is currently being processed
SUCCESSJob completed successfully
FAILEDJob encountered an error
ABORTEDJob was cancelled

Retrieving Results

Once the job status is SUCCESS, fetch the answers.

curl -s "https://<api-domain>/api/core/qa/jobs/${JOB_ID}/results" \
-H "Authorization: Bearer <your-pat>"

Result Fields

Each EliseQAResult in the results array contains:

FieldDescription
questionThe original question text
rawValueThe AI-generated answer as a string
explanationWhy the AI gave this answer
sourcedContentThe document excerpt the answer was derived from
answerValidityScore between 0 and 1 comparing the answer to expectedAnswer (if provided)
validityExplainationExplanation of the validity score
referenceIdsAnnotation IDs pointing to the source locations in the documents

Retrieving Inputs

Retrieve the original inputs submitted to the job — useful for auditing or displaying alongside results.

curl -s "https://<api-domain>/api/core/qa/jobs/${JOB_ID}/inputs" \
-H "Authorization: Bearer <your-pat>"

Retrieving Annotations

Each QA result includes a referenceIds field identifying the exact document passages the AI used to produce each answer. Use the annotations endpoint to resolve those IDs into full objects with text excerpts, document names, and precise positions (page, bounding box, cell, or line).

curl -s "https://<api-domain>/api/core/qa/jobs/${JOB_ID}/annotations" \
-H "Authorization: Bearer <your-pat>"

For the full annotation data model, position types, and lookup patterns, see the Annotations guide.

Listing QA Jobs

List all QA jobs submitted by the current user, with pagination.

curl -s "https://<api-domain>/api/core/qa/jobs?page=0&pageSize=20" \
-H "Authorization: Bearer <your-pat>"

Next Steps

  • Annotations — understand the full annotation data model and position types
  • Extraction to pull structured metadata fields from documents
  • Collections to organise files before running jobs on them
  • API Reference for complete endpoint documentation