Skip to main content
POST
/
v1
/
questionnaire
/
answer-single
Answer one questionnaire question
curl --request POST \
  --url https://api.trycomp.ai/v1/questionnaire/answer-single \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "question": "Do you encrypt customer data at rest?",
  "questionIndex": 0,
  "totalQuestions": 12,
  "organizationId": "org_abc123"
}
'
{
  "success": true,
  "data": {
    "questionIndex": 123,
    "question": "<string>",
    "answer": "<string>",
    "sources": [
      {}
    ],
    "error": "<string>"
  }
}

Authorizations

X-API-Key
string
header
required

API key for authentication

Body

application/json
question
string
required

Security questionnaire question to answer.

Example:

"Do you encrypt customer data at rest?"

questionIndex
number
required

Zero-based index of this question in the questionnaire or page batch.

Required range: x >= 0
Example:

0

totalQuestions
number
required

Total number of questions in the current questionnaire or page batch.

Required range: x >= 1
Example:

12

organizationId
string
required

Organization ID for validation. The API uses the authenticated active organization and overwrites this value server-side.

Example:

"org_abc123"

questionnaireId
string

Optional questionnaire record to save the generated answer into. Omit for webpage-only answer generation.

Example:

"qst_abc123"

Response

200 - application/json

Generated single answer result

success
boolean
data
object