Get survey results
curl --request GET \
--url https://app.gaintrace.com/api/v1/surveys/{id}/results \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.gaintrace.com/api/v1/surveys/{id}/results', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.gaintrace.com/api/v1/surveys/{id}/results"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"data": {
"surveyId": "7b6f2c1e-4d3a-4b5c-9e8f-1a2b3c4d5e6f",
"measure": "nps",
"totalResponses": 120,
"questions": [
{
"index": 0,
"text": "How likely are you to recommend us to a colleague?",
"type": "rating",
"answered": 120,
"totalResponses": 120,
"average": 7.9,
"choices": [
{
"label": "0",
"count": 1
},
{
"label": "1",
"count": 0
},
{
"label": "2",
"count": 2
},
{
"label": "3",
"count": 1
},
{
"label": "4",
"count": 3
},
{
"label": "5",
"count": 4
},
{
"label": "6",
"count": 6
},
{
"label": "7",
"count": 14
},
{
"label": "8",
"count": 21
},
{
"label": "9",
"count": 38
},
{
"label": "10",
"count": 30
}
]
},
{
"index": 1,
"text": "What is the main reason for your score?",
"type": "text",
"answered": 84,
"totalResponses": 120,
"average": null,
"choices": []
}
]
}
}{
"error": {
"code": "unauthorized",
"message": "Missing Authorization header",
"doc_url": "https://docs.gaintrace.com/errors#unauthorized"
}
}{
"error": {
"code": "forbidden",
"message": "Insufficient scope: write:companies required",
"doc_url": "https://docs.gaintrace.com/errors#forbidden"
}
}{
"error": {
"code": "not_found",
"message": "Company not found",
"doc_url": "https://docs.gaintrace.com/errors#not_found"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Can't accept more than 60 requests a minute from one API key. Retry in 23 seconds.",
"doc_url": "https://docs.gaintrace.com/errors#rate_limit_exceeded"
}
}{
"error": {
"code": "internal_server_error",
"message": "Something went wrong. Try again in a moment.",
"doc_url": "https://docs.gaintrace.com/errors#internal_server_error"
}
}{
"error": {
"code": "service_unavailable",
"message": "We had trouble reaching the database. Try again in a moment.",
"doc_url": "https://docs.gaintrace.com/errors#service_unavailable"
}
}{
"error": {
"code": "gateway_timeout",
"message": "The request timed out. Try again in a moment.",
"doc_url": "https://docs.gaintrace.com/errors#gateway_timeout"
}
}Surveys
Get survey results
Results for every question of one survey, shaped by the answer type: counts per choice, means for scores, ranking scores, matrix rows, date ranges and, for the product-market fit question, the share who would be very disappointed. Written answers are counted but never returned. Use GET /survey-responses to read individual responses. Requires a secret server key (gt_live_). Publishable keys (gt_pub_) return 403.
Scope: read:surveys
GET
/
surveys
/
{id}
/
results
Get survey results
curl --request GET \
--url https://app.gaintrace.com/api/v1/surveys/{id}/results \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.gaintrace.com/api/v1/surveys/{id}/results', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.gaintrace.com/api/v1/surveys/{id}/results"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"data": {
"surveyId": "7b6f2c1e-4d3a-4b5c-9e8f-1a2b3c4d5e6f",
"measure": "nps",
"totalResponses": 120,
"questions": [
{
"index": 0,
"text": "How likely are you to recommend us to a colleague?",
"type": "rating",
"answered": 120,
"totalResponses": 120,
"average": 7.9,
"choices": [
{
"label": "0",
"count": 1
},
{
"label": "1",
"count": 0
},
{
"label": "2",
"count": 2
},
{
"label": "3",
"count": 1
},
{
"label": "4",
"count": 3
},
{
"label": "5",
"count": 4
},
{
"label": "6",
"count": 6
},
{
"label": "7",
"count": 14
},
{
"label": "8",
"count": 21
},
{
"label": "9",
"count": 38
},
{
"label": "10",
"count": 30
}
]
},
{
"index": 1,
"text": "What is the main reason for your score?",
"type": "text",
"answered": 84,
"totalResponses": 120,
"average": null,
"choices": []
}
]
}
}{
"error": {
"code": "unauthorized",
"message": "Missing Authorization header",
"doc_url": "https://docs.gaintrace.com/errors#unauthorized"
}
}{
"error": {
"code": "forbidden",
"message": "Insufficient scope: write:companies required",
"doc_url": "https://docs.gaintrace.com/errors#forbidden"
}
}{
"error": {
"code": "not_found",
"message": "Company not found",
"doc_url": "https://docs.gaintrace.com/errors#not_found"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Can't accept more than 60 requests a minute from one API key. Retry in 23 seconds.",
"doc_url": "https://docs.gaintrace.com/errors#rate_limit_exceeded"
}
}{
"error": {
"code": "internal_server_error",
"message": "Something went wrong. Try again in a moment.",
"doc_url": "https://docs.gaintrace.com/errors#internal_server_error"
}
}{
"error": {
"code": "service_unavailable",
"message": "We had trouble reaching the database. Try again in a moment.",
"doc_url": "https://docs.gaintrace.com/errors#service_unavailable"
}
}{
"error": {
"code": "gateway_timeout",
"message": "The request timed out. Try again in a moment.",
"doc_url": "https://docs.gaintrace.com/errors#gateway_timeout"
}
}Authorizations
Bearer API key. Secret server keys start with gt_live_; client-safe browser keys start with gt_pub_ (write-only, origin-pinned). Create and scope keys in Settings → API Keys.
Path Parameters
The survey's UUID.
Response
The results.
Show child attributes
Show child attributes
Was this page helpful?