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"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
question: 'Do you encrypt customer data at rest?',
questionIndex: 0,
totalQuestions: 12,
organizationId: 'org_abc123'
})
};
fetch('https://api.trycomp.ai/v1/questionnaire/answer-single', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.trycomp.ai/v1/questionnaire/answer-single"
payload = {
"question": "Do you encrypt customer data at rest?",
"questionIndex": 0,
"totalQuestions": 12,
"organizationId": "org_abc123"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"questionIndex": 123,
"question": "<string>",
"answer": "<string>",
"sources": [
{
"sourceType": "<string>",
"score": 123,
"sourceName": "<string>",
"sourceId": "<string>",
"policyName": "<string>",
"documentName": "<string>",
"manualAnswerQuestion": "<string>"
}
],
"error": "<string>"
}
}Answer one questionnaire question | Comp AI API
Generate an answer for one security questionnaire item using the organization evidence library and return source references for review.
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"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
question: 'Do you encrypt customer data at rest?',
questionIndex: 0,
totalQuestions: 12,
organizationId: 'org_abc123'
})
};
fetch('https://api.trycomp.ai/v1/questionnaire/answer-single', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.trycomp.ai/v1/questionnaire/answer-single"
payload = {
"question": "Do you encrypt customer data at rest?",
"questionIndex": 0,
"totalQuestions": 12,
"organizationId": "org_abc123"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"questionIndex": 123,
"question": "<string>",
"answer": "<string>",
"sources": [
{
"sourceType": "<string>",
"score": 123,
"sourceName": "<string>",
"sourceId": "<string>",
"policyName": "<string>",
"documentName": "<string>",
"manualAnswerQuestion": "<string>"
}
],
"error": "<string>"
}
}Authorizations
API key for authentication
Body
Security questionnaire question to answer.
1 - 10000"Do you encrypt customer data at rest?"
Zero-based index of this question in the questionnaire or page batch (at most 9999).
0 <= x <= 99990
Total number of questions in the current questionnaire or page batch (at most 10000).
1 <= x <= 1000012
Organization the question batch was generated for, so answers never come from a different workspace. When non-empty, browser sessions get a 409 if it differs from the active organization, and MCP gets a 409 only if it names a different organization the user is an active member of; an empty or other value is ignored. API keys and service tokens always answer from their own organization and ignore this value.
64"org_abc123"
Optional questionnaire record to save the generated answer into. Omit for webpage-only answer generation.
64"qst_abc123"
Was this page helpful?

