Skip to main content

Survey Analytics

Get aggregated analytics and NPS data for a survey.

Endpointโ€‹

GET /v1/surveys/{id}/analytics

Path Parametersโ€‹

ParameterTypeDescription
idintegerSurvey ID

Authenticationโ€‹

Requires an API key with the surveys:read scope.

Query Parametersโ€‹

ParameterTypeDescription
date_fromstringFilter from date (YYYY-MM-DD)
date_tostringFilter to date (YYYY-MM-DD)

Responseโ€‹

Success (200 OK)โ€‹

{
"data": {
"survey_id": 1,
"survey_name": "Customer Satisfaction Survey",
"total_responses": 156,
"nps": {
"score": 42,
"total_responses": 156,
"promoters": 89,
"passives": 45,
"detractors": 22,
"promoter_percentage": 57.1,
"passive_percentage": 28.8,
"detractor_percentage": 14.1
},
"date_range": {
"from": "2026-01-01",
"to": "2026-01-31"
}
},
"meta": {
"request_id": "req_abc123",
"timestamp": "2026-01-15T12:00:00+00:00"
}
}

Response Fieldsโ€‹

Analytics Objectโ€‹

FieldTypeDescription
survey_idintegerSurvey ID
survey_namestringSurvey name
total_responsesintegerTotal number of responses in date range
npsobjectNPS analytics (null if survey has no NPS field)
date_rangeobjectApplied date filters

NPS Objectโ€‹

FieldTypeDescription
scoreintegerNPS score (-100 to +100)
total_responsesintegerResponses with NPS rating
promotersintegerCount of promoters (9-10)
passivesintegerCount of passives (7-8)
detractorsintegerCount of detractors (0-6)
promoter_percentagenumberPercentage of promoters
passive_percentagenumberPercentage of passives
detractor_percentagenumberPercentage of detractors

Understanding NPS Scoreโ€‹

The Net Promoter Score is calculated as:

NPS = % Promoters - % Detractors
NPS RangeInterpretation
70+Excellent
50-69Great
30-49Good
0-29Needs improvement
Below 0Critical

Example: Monthly NPS Trackingโ€‹

Track NPS over time by querying different date ranges:

# January 2026
curl "https://app.equipdash.com/api/v1/surveys/1/analytics?date_from=2026-01-01&date_to=2026-01-31" \
-H "Authorization: Bearer YOUR_API_KEY"

# February 2026
curl "https://app.equipdash.com/api/v1/surveys/1/analytics?date_from=2026-02-01&date_to=2026-02-28" \
-H "Authorization: Bearer YOUR_API_KEY"

Survey Without NPS Fieldโ€‹

If the survey doesn't contain an NPS rating field, the nps object will be null:

{
"data": {
"survey_id": 2,
"survey_name": "Equipment Feedback",
"total_responses": 45,
"nps": null,
"date_range": {
"from": null,
"to": null
}
}
}

Errorsโ€‹

StatusCodeDescription
401authentication_requiredNo API key provided
401invalid_api_keyInvalid API key
403insufficient_scopeAPI key lacks surveys:read scope
403forbiddenSurvey belongs to another supplier
404not_foundSurvey not found

Example Requestโ€‹

curl -X GET "https://app.equipdash.com/api/v1/surveys/1/analytics?date_from=2026-01-01&date_to=2026-01-31" \
-H "Authorization: Bearer eqd_live_abc123xyz789..."

Use Casesโ€‹

Building an NPS Dashboardโ€‹

Fetch analytics for all surveys and display in a dashboard:

const surveys = await fetch('/api/v1/surveys', { headers });
const analytics = await Promise.all(
surveys.data.map(survey =>
fetch(`/api/v1/surveys/${survey.id}/analytics`, { headers })
)
);

// Display NPS scores for each survey
analytics.forEach((data, i) => {
console.log(`${surveys.data[i].name}: NPS ${data.nps?.score ?? 'N/A'}`);
});

Identifying At-Risk Customersโ€‹

Use the responses endpoint with NPS filtering to find detractors:

curl "https://app.equipdash.com/api/v1/surveys/1/responses?nps_category=detractor" \
-H "Authorization: Bearer YOUR_API_KEY"

Then follow up with these customers to address their concerns.