Skip to content

Generate answers for a questionnaire

POST
/v1/questionnaire/{id}/auto-answer
curl --request POST \
--url https://api.varman.io/v1/questionnaire/example/auto-answer \
--header 'X-API-Key: <X-API-Key>'

Starts background answer generation for an already-parsed questionnaire and returns a run handle immediately. Poll GET /v1/questionnaire/:id until answeredQuestions equals totalQuestions, then read the answers from its questions.

id
required
string
Media typeapplication/json
object
questionnaireId
required

The questionnaire whose answers are being generated.

string
runId
required

Background run identifier for the generation job (Trigger.dev run id).

string
publicAccessToken
required

Token for tracking the run via Trigger.dev realtime. Optional — MCP/agent clients should poll GET /v1/questionnaire/:id instead.

string
status
required

Always ‘generating’ on a successful trigger. Poll GET /v1/questionnaire/:id; answers are ready once answeredQuestions equals totalQuestions.

string
totalQuestions
required

Total number of questions in the questionnaire.

number
answeredQuestions
required

Questions already answered at the moment generation was triggered (answers without a value are (re)generated).

number
message
required

Human-readable summary of what to do next.

string

Example

{
"questionnaireId": "qst_6a179d26c4ad2c1c816ee16d",
"runId": "run_cmpotsz153eac0ultc1ya87f5",
"publicAccessToken": "pat_...",
"status": "generating",
"totalQuestions": 23,
"answeredQuestions": 0,
"message": "Generating answers for 23 questions. Poll GET /v1/questionnaire/qst_... until answeredQuestions reaches totalQuestions."
}