Submit survey answers
- Path
/surveys/{token}/submissions- Auth
- None · a public or signed link
const url = 'https://releva.ai/api/v0/surveys/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/submissions';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"iv":"9f2b6c1d0e3a4b5c6d7e8f9011223344","encryptedProfileId":"rlv1.Q2hhbmdlTWVJc0FuRXhhbXBsZVZhbHVl","linkToken":"11111111-2222-4333-8444-555555555555","data":{"satisfaction":5,"reason":"Delivery","improve":"More colours","please.":null}}'};
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/surveys/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/submissions \ --header 'Content-Type: application/json' \ --data '{ "iv": "9f2b6c1d0e3a4b5c6d7e8f9011223344", "encryptedProfileId": "rlv1.Q2hhbmdlTWVJc0FuRXhhbXBsZVZhbHVl", "linkToken": "11111111-2222-4333-8444-555555555555", "data": { "satisfaction": 5, "reason": "Delivery", "improve": "More colours", "please.": null } }'Records a surveySubmission event with the answers and marks the survey as submitted for this respondent.
Identity rules are the same as for opening the survey. When the survey merges the e-mail or phone number into
the profile, the first e-mail (inputType: email) or phone (inputType: tel) text answer is merged
asynchronously; on a public survey, an address that already belongs to another profile attributes the event to
that profile without changing it. There is no duplicate check: “Once per link” is enforced by the survey app in
the respondent’s browser. Not affected by a value-delivery pause. JSON only; the whole body must fit in 800 KB.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Survey token (UUID; in the survey link as token=). A value that is not a UUID answers 500.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Answers keyed by question name (the SurveyJS result). Not checked against the survey.
object
Personal link iv. Send together with encryptedProfileId.
Personal link profileId. Send together with iv.
Identity from the open response of a public survey.
Accepted and not used.
Examples
{ "iv": "9f2b6c1d0e3a4b5c6d7e8f9011223344", "encryptedProfileId": "rlv1.Q2hhbmdlTWVJc0FuRXhhbXBsZVZhbHVl", "linkToken": "11111111-2222-4333-8444-555555555555", "data": { "satisfaction": 5, "reason": "Delivery", "improve": "More colours", "please.": null }}{ "anonymousId": "5b0c7a52-3f7e-4d0a-9b8e-2c1f6a7d9e10.6f1d2c3b4a59687766554433221100ffeeddccbbaa99887766554433221100ff", "data": { "satisfaction": 4, "reason": "Price", "email": "walkin@example.com" }}Responses
Section titled “Responses”Accepted for asynchronous processing.
object
Example
{}Validation error, broken personal link or unknown survey.
object
Human-readable error. Several validation errors are joined with a space.
Examples
{ "message": "The 'data' field is required."}{ "message": "The 'data' must be an Object."}{ "message": "The '' field is required."}{ "message": "Invalid profileId!"}{ "message": "Survey with token 00000000-0000-4000-8000-000000000000 cannot be 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 survey has no public link and the request carries no personal link.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "This survey can only be opened through a personal link."}Body larger than 800 KB.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "request entity too large"}Unexpected server error.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "An internal error occurred."}