Submit survey responses
const url = 'https://app.surveyrock.com/api/v1/response/surveys/example';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"respondentId":"example","responses":[{"elementId":"example","type":"example","value":"example","meta":{}}],"pageId":"example","metadata":{}}'};
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/response/surveys/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "respondentId": "example", "responses": [ { "elementId": "example", "type": "example", "value": "example", "meta": {} } ], "pageId": "example", "metadata": {} }'Submit survey responses using shared ResponseService. Implements proper validation, tenant scoping, and rate limiting.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Survey ID
Request Bodyrequired
Section titled “Request Bodyrequired”Response submission data
object
Respondent ID
Individual question responses
object
Element ID
Question type
Response value (shape varies by question type)
Response metadata
object
Page ID; if provided, updates respondent progress
Submission metadata
object
Examplegenerated
{ "respondentId": "example", "responses": [ { "elementId": "example", "type": "example", "value": "example", "meta": {} } ], "pageId": "example", "metadata": {}}Responses
Section titled “Responses”Responses submitted successfully
object
object
object
object
Standard response metadata
object
Response timestamp in ISO 8601 format
API version
Unique request identifier
Example
{ "success": true, "data": { "responses": [ { "status": "submitted" } ] }, "meta": { "version": "3.0" }}Bad request - missing survey ID, missing body, or missing respondent ID
Standard error response format
object
object
Stable, snake_case domain code – see ApiErrorHandler::EXCEPTION_MAP and DomainException
Human-readable error message
Imperative recovery hint for this domain code – see ApiErrorHandler::DOMAIN_CODE_SUGGESTIONS
Whether retrying the identical request might succeed without any change on the caller’s end
Additional, code-specific error details
object
Standard response metadata
object
Response timestamp in ISO 8601 format
API version
Unique request identifier
Example
{ "success": false, "error": { "code": "survey_not_found" }, "meta": { "version": "3.0" }}Unauthorized - invalid or missing token
Standard error response format
object
object
Stable, snake_case domain code – see ApiErrorHandler::EXCEPTION_MAP and DomainException
Human-readable error message
Imperative recovery hint for this domain code – see ApiErrorHandler::DOMAIN_CODE_SUGGESTIONS
Whether retrying the identical request might succeed without any change on the caller’s end
Additional, code-specific error details
object
Standard response metadata
object
Response timestamp in ISO 8601 format
API version
Unique request identifier
Example
{ "success": false, "error": { "code": "survey_not_found" }, "meta": { "version": "3.0" }}Forbidden - insufficient permissions
Standard error response format
object
object
Stable, snake_case domain code – see ApiErrorHandler::EXCEPTION_MAP and DomainException
Human-readable error message
Imperative recovery hint for this domain code – see ApiErrorHandler::DOMAIN_CODE_SUGGESTIONS
Whether retrying the identical request might succeed without any change on the caller’s end
Additional, code-specific error details
object
Standard response metadata
object
Response timestamp in ISO 8601 format
API version
Unique request identifier
Example
{ "success": false, "error": { "code": "survey_not_found" }, "meta": { "version": "3.0" }}Survey or respondent not found
Standard error response format
object
object
Stable, snake_case domain code – see ApiErrorHandler::EXCEPTION_MAP and DomainException
Human-readable error message
Imperative recovery hint for this domain code – see ApiErrorHandler::DOMAIN_CODE_SUGGESTIONS
Whether retrying the identical request might succeed without any change on the caller’s end
Additional, code-specific error details
object
Standard response metadata
object
Response timestamp in ISO 8601 format
API version
Unique request identifier
Example
{ "success": false, "error": { "code": "survey_not_found" }, "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
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" }}