Submit NPS response
const url = 'https://app.surveyrock.com/api/v1/nps/example/response';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"respondentId":"example","surveyId":"example","value":1,"recommendationSubject":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://app.surveyrock.com/api/v1/nps/example/response \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "respondentId": "example", "surveyId": "example", "value": 1, "recommendationSubject": "example" }'Submit an NPS response with validation
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”NPS element ID
Header Parameters
Section titled “Header Parameters”1 to 128 characters, chosen by the caller. Optional on this operation: a retry with the same key and body replays the first response instead of applying the write twice; the same key with a different body is a 409
Request Bodyrequired
Section titled “Request Bodyrequired”NPS response data
object
Respondent ID
Survey ID
NPS score (0-10)
Optional recommendation subject
Examplegenerated
{ "respondentId": "example", "surveyId": "example", "value": 1, "recommendationSubject": "example"}Responses
Section titled “Responses”NPS response submitted successfully
object
object
Standard response metadata
object
Response timestamp in ISO 8601 format
API version
Unique request identifier
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.
Example
{ "success": true, "data": { "type": "nps" }, "meta": { "version": "3.0" }}Validation failed
Validation error response with field-specific errors
object
object
Field-specific validation errors
object
Standard response metadata
object
Response timestamp in ISO 8601 format
API version
Unique request identifier
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.
Example
{ "success": false, "error": { "code": "validation_failed", "message": "Validation failed", "suggestion": "Fix the fields listed in details and re-submit.", "retryable": false }, "meta": { "version": "3.0" }}