NPS® Responses
Note: This API endpoint is deprecated. Zendesk is removing Net Promoter Score℠ (NPS®) survey functionality on April 30, 2023. For more information, see Announcing the removal of Net Promoter Score (NPS).
When a recipient responds to an NPS survey, their rating, comment, and last survey date are captured. You can export the responses for your individual NPS survey by using the Responses API. Visit the Incremental Export documentation for information on how to export all responses across surveys.
JSON format
Responses are represented as JSON objects with the following properties:
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
comment | string | false | false | The comment text. |
created_at | string | true | false | When the response was created. |
id | integer | true | false | Automatically assigned when response created. |
rating | integer | false | true | The rating for the comment. |
recipient_id | integer | true | true | Recipient the response belongs to. |
updated_at | string | true | false | When response was last updated. |
Example
{
"comment": "It has improved the efficiency of our support department.",
"created_at": "2013-08-29T00:00:00-07:00",
"id": 1,
"rating": 9,
"recipient_id": 1,
"updated_at": "2013-08-29T00:00:00-07:00"
}
List Responses
GET /api/v2/nps/surveys/{survey_id}/responses
List responses for a given survey.
Allowed for
- Admins
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
category | string | Query | false | Category type. Allowed values are "detractors", "passives", or "promoters". |
has_comment | string | Query | false | Responses with comments. Allowed values are "false", or "true". |
survey_id | integer | Path | true | ID of survey. |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/nps/surveys/{survey_id}/responses.json \
-v -u {email_address}:{password}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/nps/surveys/1234/responses?category=promoters&has_comment=true"
method := "GET"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "username:password"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/nps/surveys/1234/responses")
.newBuilder()
.addQueryParameter("category", "promoters")
.addQueryParameter("has_comment", "true");
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", Credentials.basic("your-email", "your-password"))
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://support.zendesk.com/api/v2/nps/surveys/1234/responses',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "username:password"
},
params: {
'category': 'promoters',
'has_comment': 'true',
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
url = "https://support.zendesk.com/api/v2/nps/surveys/1234/responses?category=promoters&has_comment=true"
headers = {
"Content-Type": "application/json",
}
response = requests.request(
"GET",
url,
auth=('<username>', '<password>'),
headers=headers
)
print(response.text)
Ruby
require "net/http"
uri = URI("https://support.zendesk.com/api/v2/nps/surveys/1234/responses")
uri.query = URI.encode_www_form("category": "promoters", "has_comment": "true")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
request.basic_auth "username", "password"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"responses": [
{
"comment": "I really lke it",
"created_at": "2020-07-01T18:00:00Z",
"id": 1,
"rating": 10,
"recipient_id": 42,
"updated_at": "2020-07-01T18:00:00Z"
}
]
}
Create Response
POST /api/v2/nps/surveys/{survey_id}/responses
Creates a response for a given survey and recipient. If recipient already has a response, it's updated.
Allowed for
- Admins
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
survey_id | integer | Path | true | ID of survey. |
Example body
{
"response": {
"comment": "I really lke it",
"rating": 10,
"recipient_id": 42
}
}
Code Samples
curl
curl \
--data '{"response": {"comment": "I really like it", "rating": 10, "recipient_id": 42}}' \
--header "Content-Type: application/json" \
--request POST \
-v -u {email_address}:{password} \
https://{subdomain}.zendesk.com/api/v2/nps/surveys/{survey_id}/responses.json
Go
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
url := "https://support.zendesk.com/api/v2/nps/surveys/1234/responses"
method := "POST"
payload := strings.NewReader(`{
"response": {
"comment": "I really lke it",
"rating": 10,
"recipient_id": 42
}
}`)
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "username:password"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/nps/surveys/1234/responses")
.newBuilder();
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
"""
{
\"response\": {
\"comment\": \"I really lke it\",
\"rating\": 10,
\"recipient_id\": 42
}
}""");
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", Credentials.basic("your-email", "your-password"))
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var data = JSON.stringify({
"response": {
"comment": "I really lke it",
"rating": 10,
"recipient_id": 42
}
});
var config = {
method: 'POST',
url: 'https://support.zendesk.com/api/v2/nps/surveys/1234/responses',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "username:password"
},
data : data,
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
import json
url = "https://support.zendesk.com/api/v2/nps/surveys/1234/responses"
payload = json.loads("""{
"response": {
"comment": "I really lke it",
"rating": 10,
"recipient_id": 42
}
}""")
headers = {
"Content-Type": "application/json",
}
response = requests.request(
"POST",
url,
auth=('<username>', '<password>'),
headers=headers,
json=payload
)
print(response.text)
Ruby
require "net/http"
uri = URI("https://support.zendesk.com/api/v2/nps/surveys/1234/responses")
request = Net::HTTP::Post.new(uri, "Content-Type": "application/json")
request.body = %q({
"response": {
"comment": "I really lke it",
"rating": 10,
"recipient_id": 42
}
})
request.basic_auth "username", "password"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
201 Created
// Status 201 Created
{
"response": {
"comment": "I really lke it",
"created_at": "2020-07-01T18:00:00Z",
"id": 1,
"rating": 10,
"recipient_id": 42,
"updated_at": "2020-07-01T18:00:00Z"
}
}
Show Response
GET /api/v2/nps/surveys/{survey_id}/responses/{response_id}
Shows an existing response for a survey.
Allowed for
- Admins
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
response_id | integer | Path | true | ID of survey response. |
survey_id | integer | Path | true | ID of survey. |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/nps/surveys/{survey_id}/responses/{response_id}.json \
-v -u {email_address}:{password}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/nps/surveys/1234/responses/2468"
method := "GET"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "username:password"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/nps/surveys/1234/responses/2468")
.newBuilder();
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", Credentials.basic("your-email", "your-password"))
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://support.zendesk.com/api/v2/nps/surveys/1234/responses/2468',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "username:password"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
url = "https://support.zendesk.com/api/v2/nps/surveys/1234/responses/2468"
headers = {
"Content-Type": "application/json",
}
response = requests.request(
"GET",
url,
auth=('<username>', '<password>'),
headers=headers
)
print(response.text)
Ruby
require "net/http"
uri = URI("https://support.zendesk.com/api/v2/nps/surveys/1234/responses/2468")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
request.basic_auth "username", "password"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"response": {
"comment": "I really lke it",
"created_at": "2020-07-01T18:00:00Z",
"id": 1,
"rating": 10,
"recipient_id": 42,
"updated_at": "2020-07-01T18:00:00Z"
}
}
Update Response
PUT /api/v2/nps/surveys/{survey_id}/responses/{response_id}
Updates an existing response for a survey.
Allowed for
- Admins
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
response_id | integer | Path | true | ID of survey response. |
survey_id | integer | Path | true | ID of survey. |
Example body
{
"response": {
"comment": "I really lke it",
"rating": 10
}
}
Code Samples
curl
curl \
--data '{"response": {"comment": "I really like it", "rating": 10}}' \
--header "Content-Type: application/json" \
--request PUT \
-v -u {email_address}:{password} \
https://{subdomain}.zendesk.com/api/v2/nps/surveys/{survey_id}/responses/{response_id}.json
Go
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
url := "https://support.zendesk.com/api/v2/nps/surveys/1234/responses/2468"
method := "PUT"
payload := strings.NewReader(`{
"response": {
"comment": "I really lke it",
"rating": 10
}
}`)
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "username:password"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/nps/surveys/1234/responses/2468")
.newBuilder();
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
"""
{
\"response\": {
\"comment\": \"I really lke it\",
\"rating\": 10
}
}""");
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("PUT", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", Credentials.basic("your-email", "your-password"))
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var data = JSON.stringify({
"response": {
"comment": "I really lke it",
"rating": 10
}
});
var config = {
method: 'PUT',
url: 'https://support.zendesk.com/api/v2/nps/surveys/1234/responses/2468',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "username:password"
},
data : data,
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
import json
url = "https://support.zendesk.com/api/v2/nps/surveys/1234/responses/2468"
payload = json.loads("""{
"response": {
"comment": "I really lke it",
"rating": 10
}
}""")
headers = {
"Content-Type": "application/json",
}
response = requests.request(
"PUT",
url,
auth=('<username>', '<password>'),
headers=headers,
json=payload
)
print(response.text)
Ruby
require "net/http"
uri = URI("https://support.zendesk.com/api/v2/nps/surveys/1234/responses/2468")
request = Net::HTTP::Put.new(uri, "Content-Type": "application/json")
request.body = %q({
"response": {
"comment": "I really lke it",
"rating": 10
}
})
request.basic_auth "username", "password"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"response": {
"comment": "I really lke it",
"created_at": "2020-07-01T18:00:00Z",
"id": 1,
"rating": 10,
"recipient_id": 42,
"updated_at": "2020-07-01T18:00:00Z"
}
}