Restore version to draft
const url = 'https://app.surveyrock.com/api/v1/surveys/example/versions/1/restore';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
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/surveys/example/versions/1/restore \ --header 'Authorization: Bearer <token>'Restores a previous version to the draft state. Creates a backup of the current draft before restoring. The live version remains unchanged until a new publish action.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Survey ID
Version number to restore
Responses
Section titled “Responses”Version restored to draft successfully
object
object
ID of the draft backup created before restore
Standard response metadata
object
Response timestamp in ISO 8601 format
API version
Unique request identifier
Example
{ "success": true, "meta": { "version": "3.0" }}Survey or version 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" }}Conflict - survey is currently locked
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" }}