Generate answers for a questionnaire
const url = 'https://api.varman.io/v1/questionnaire/example/auto-answer';const options = {method: 'POST', headers: {'X-API-Key': '<X-API-Key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Responses
Section titled “Responses”object
The questionnaire whose answers are being generated.
Background run identifier for the generation job (Trigger.dev run id).
Token for tracking the run via Trigger.dev realtime. Optional — MCP/agent clients should poll GET /v1/questionnaire/:id instead.
Always ‘generating’ on a successful trigger. Poll GET /v1/questionnaire/:id; answers are ready once answeredQuestions equals totalQuestions.
Total number of questions in the questionnaire.
Questions already answered at the moment generation was triggered (answers without a value are (re)generated).
Human-readable summary of what to do next.
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."}