Skip to content

Get response aggregation

GET
/response/surveys/{surveyId}/aggregation
curl --request GET \
--url https://app.surveyrock.com/api/v1/response/surveys/example/aggregation \
--header 'Authorization: Bearer <token>'

Get response aggregation data using same logic as web dashboard. Provides per-question counts, completion statistics, and a 30-day completion trend. An NPS question also carries its score, segment counts and, when the survey compares with one, the typical range in published industry studies for its industry with a verdict that allows for the margin of error.

surveyId
required
string
>= 16 characters <= 16 characters

Survey ID

Aggregated response data

Media typeapplication/json
object
success
boolean
data
object
surveyId
string
questionStats
Array<object>
object
questionId
string
elementId

The question’s id in the survey’s question list (listSurveyElements). Use this, not questionId, to match the count to its question.

string
nullable
responseCount
integer
uniqueRespondents
integer
nps

NPS questions only. Counts are weighted sums when the survey’s results are weighted.

object
score

% promoters minus % detractors, -100 to 100

integer
promoters
number
passives
number
detractors
number
total
number
industryRange

The typical range in published industry studies for the survey’s industry, as the results card shows it. Null for an employee, event or market-research survey, a survey set to “Don’t compare”, or an account with no industry. The range is the spread between studies, not a percentile of companies.

object
industry
string
low
integer
high
integer
topQuarterFrom

Where the studies put the top quarter of companies

integer
nullable
verdict

Below or above only when the whole 95% margin is; too_few under minResponses

string
Allowed values: within close below above above_strong too_few
label
string
nullable
margin

The score’s 95% margin of error, in points

integer
nullable
minResponses
integer
text

One sentence, as the reports print it

string
respondentStats
object
totalStarted
integer
totalCompleted
integer
completionRate

Percentage, 0-100

number
avgCompletionTime

Average seconds from start to finish

number
nullable
completionTrend

Daily completions for the last 30 days

Array<object>
object
date
string format: date
completions
integer
meta

Standard response metadata

object
timestamp

Response timestamp in ISO 8601 format

string format: date-time
version

API version

string
requestId

Unique request identifier

string
etag

The resource’s ETag, on a read, create or update of a survey, element, rating or NPS question, distributor or contact. The same value as the ETag response header. Treat it as opaque and send it back as If-Match on the next update.

string
Example
{
"success": true,
"data": {
"questionStats": [
{
"nps": {
"industryRange": {
"industry": "Healthcare",
"verdict": "within",
"label": "Within the typical range",
"minResponses": 30
}
}
}
]
},
"meta": {
"version": "3.0"
}
}

Bad request - missing survey ID

Media typeapplication/json

Standard error response format

object
success
boolean
error
object
code

Stable, snake_case domain code – see ApiErrorHandler::EXCEPTION_MAP and DomainException

string
message

Human-readable error message

string
suggestion

Imperative recovery hint for this domain code – see ApiErrorHandler::DOMAIN_CODE_SUGGESTIONS

string
retryable

Whether retrying the identical request might succeed without any change on the caller’s end

boolean
details

Additional, code-specific error details

object
meta

Standard response metadata

object
timestamp

Response timestamp in ISO 8601 format

string format: date-time
version

API version

string
requestId

Unique request identifier

string
etag

The resource’s ETag, on a read, create or update of a survey, element, rating or NPS question, distributor or contact. The same value as the ETag response header. Treat it as opaque and send it back as If-Match on the next update.

string
Example
{
"success": false,
"error": {
"code": "survey_not_found"
},
"meta": {
"version": "3.0"
}
}

Unauthorized - invalid or missing token

Media typeapplication/json

Standard error response format

object
success
boolean
error
object
code

Stable, snake_case domain code – see ApiErrorHandler::EXCEPTION_MAP and DomainException

string
message

Human-readable error message

string
suggestion

Imperative recovery hint for this domain code – see ApiErrorHandler::DOMAIN_CODE_SUGGESTIONS

string
retryable

Whether retrying the identical request might succeed without any change on the caller’s end

boolean
details

Additional, code-specific error details

object
meta

Standard response metadata

object
timestamp

Response timestamp in ISO 8601 format

string format: date-time
version

API version

string
requestId

Unique request identifier

string
etag

The resource’s ETag, on a read, create or update of a survey, element, rating or NPS question, distributor or contact. The same value as the ETag response header. Treat it as opaque and send it back as If-Match on the next update.

string
Example
{
"success": false,
"error": {
"code": "survey_not_found"
},
"meta": {
"version": "3.0"
}
}

Forbidden - insufficient permissions

Media typeapplication/json

Standard error response format

object
success
boolean
error
object
code

Stable, snake_case domain code – see ApiErrorHandler::EXCEPTION_MAP and DomainException

string
message

Human-readable error message

string
suggestion

Imperative recovery hint for this domain code – see ApiErrorHandler::DOMAIN_CODE_SUGGESTIONS

string
retryable

Whether retrying the identical request might succeed without any change on the caller’s end

boolean
details

Additional, code-specific error details

object
meta

Standard response metadata

object
timestamp

Response timestamp in ISO 8601 format

string format: date-time
version

API version

string
requestId

Unique request identifier

string
etag

The resource’s ETag, on a read, create or update of a survey, element, rating or NPS question, distributor or contact. The same value as the ETag response header. Treat it as opaque and send it back as If-Match on the next update.

string
Example
{
"success": false,
"error": {
"code": "survey_not_found"
},
"meta": {
"version": "3.0"
}
}

Survey not found

Media typeapplication/json

Standard error response format

object
success
boolean
error
object
code

Stable, snake_case domain code – see ApiErrorHandler::EXCEPTION_MAP and DomainException

string
message

Human-readable error message

string
suggestion

Imperative recovery hint for this domain code – see ApiErrorHandler::DOMAIN_CODE_SUGGESTIONS

string
retryable

Whether retrying the identical request might succeed without any change on the caller’s end

boolean
details

Additional, code-specific error details

object
meta

Standard response metadata

object
timestamp

Response timestamp in ISO 8601 format

string format: date-time
version

API version

string
requestId

Unique request identifier

string
etag

The resource’s ETag, on a read, create or update of a survey, element, rating or NPS question, distributor or contact. The same value as the ETag response header. Treat it as opaque and send it back as If-Match on the next update.

string
Example
{
"success": false,
"error": {
"code": "survey_not_found"
},
"meta": {
"version": "3.0"
}
}