Skip to main content
POST
/
v1
/
questionnaire
/
{id}
/
auto-answer
Generate answers for a questionnaire
curl --request POST \
  --url https://api.trycomp.ai/v1/questionnaire/{id}/auto-answer \
  --header 'X-API-Key: <api-key>'
const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};

fetch('https://api.trycomp.ai/v1/questionnaire/{id}/auto-answer', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
import requests

url = "https://api.trycomp.ai/v1/questionnaire/{id}/auto-answer"

headers = {"X-API-Key": "<api-key>"}

response = requests.post(url, headers=headers)

print(response.text)
{
  "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."
}

Authorizations

X-API-Key
string
header
required

API key for authentication

Path Parameters

id
string
required

Response

200 - application/json
questionnaireId
string
required

The questionnaire whose answers are being generated.

Example:

"qst_6a179d26c4ad2c1c816ee16d"

runId
string
required

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

Example:

"run_cmpotsz153eac0ultc1ya87f5"

publicAccessToken
string
required

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

Example:

"pat_..."

status
string
required

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

Example:

"generating"

totalQuestions
number
required

Total number of questions in the questionnaire.

Example:

23

answeredQuestions
number
required

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

Example:

0

message
string
required

Human-readable summary of what to do next.

Example:

"Generating answers for 23 questions. Poll GET /v1/questionnaire/qst_... until answeredQuestions reaches totalQuestions."