Submit an NPS answer
- Path
/nps/{token}/submissions- Auth
- None · a public or signed link
const url = 'https://releva.ai/api/v0/nps/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/submissions';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"profileId":null,"deviceId":"demo-device-1","sessionId":"demo-session-1","score":9,"comment":"Fast delivery and friendly support."}'};
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://releva.ai/api/v0/nps/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/submissions \ --header 'Content-Type: application/json' \ --data '{ "profileId": null, "deviceId": "demo-device-1", "sessionId": "demo-session-1", "score": 9, "comment": "Fast delivery and friendly support." }'Records an npsSubmission event (score 0-10, category, optional comment), starts the survey’s cooldown for this
respondent and writes nps_score, nps_category, nps_survey_id and nps_last_answered to the profile.
The JavaScript SDK calls it from the NPS widget; call it yourself from an app or custom widget that renders the
nps object of the page push. The respondent is profileId, or deviceId when profileId is blank.
The survey must be active. No duplicate check. Not affected by a value-delivery pause.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”NPS survey token (nps.token in the page push). A value that is not a UUID answers 500.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Releva profile id. Blank or whitespace counts as absent.
Device id; the respondent when profileId is absent. One of the two must be non-blank.
9-10 promoter, 7-8 passive, 0-6 detractor.
Answer to the follow-up question.
Example
{ "profileId": null, "deviceId": "demo-device-1", "sessionId": "demo-session-1", "score": 9, "comment": "Fast delivery and friendly support."}object
Base64(encodeURIComponent(JSON.stringify(body))). What the SDK sends.
Example generated
formPayload=exampleResponses
Section titled “Responses”Accepted for asynchronous processing.
object
Example
{}Validation error or unknown survey.
object
Human-readable error. Several validation errors are joined with a space.
Examples
{ "message": "The 'deviceId' field is required. The 'sessionId' field is required. The 'score' field is required."}{ "message": "The 'score' field must be less than or equal to 10."}{ "message": "The 'score' field must be greater than or equal to 0."}{ "message": "The 'score' field must be an integer."}{ "message": "The 'score' field must be a number."}{ "message": "One of profileId or deviceId is required."}{ "message": "Survey not found."}The domain is switched off.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "Shop is disabled. Please reach out to support@releva.ai to enable it."}The NPS survey is a draft or inactive.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "Survey not found."}Unexpected server error.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "An internal error occurred."}