Submit NPS response
POST
/nps/{id}/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”id
required
string
NPS element ID
Request Bodyrequired
Section titled “Request Bodyrequired”NPS response data
Media typeapplication/json
object
respondentId
required
Respondent ID
string
surveyId
required
Survey ID
string
value
required
NPS score (0-10)
integer
recommendationSubject
Optional recommendation subject
string
Examplegenerated
{ "respondentId": "example", "surveyId": "example", "value": 1, "recommendationSubject": "example"}Responses
Section titled “Responses”NPS response submitted successfully
Media typeapplication/json
object
success
boolean
data
object
value
integer
type
string
recommendationSubject
string
submittedAt
string format: date-time
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
Example
{ "success": true, "data": { "type": "nps" }, "meta": { "version": "3.0" }}Validation failed
Media typeapplication/json
Validation error response with field-specific errors
object
success
boolean
error
object
code
string
message
string
suggestion
string
retryable
boolean
details
Field-specific validation errors
object
key
additional properties
Array<string>
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
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" }}