Studies
Update Study settings or lifecycle status
A settings PATCH may include name and/or responseSettings. Sampling and recontact settings apply only to IN_PRODUCT_SURVEY Studies; SURVEY Studies reject them. A lifecycle PATCH must contain only status.
PATCH
/
v2
/
studies
/
{studyId}
Update Study settings or lifecycle status
curl --request PATCH \
--url https://api.sprig.com/v2/studies/{studyId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'If-Match: <if-match>' \
--data '
{
"name": "<string>",
"appearance": {
"showBranding": true,
"replayDurationSeconds": 123,
"endCard": {
"enabled": true,
"headline": "<string>",
"subheader": "<string>"
}
},
"responseSettings": {
"completion": {
"mode": "FIXED",
"responseLimit": 2
},
"requireIdentifiedRespondent": true,
"allowBackwardNavigation": true,
"retake": {
"resume": {
"enabled": true,
"windowDays": 16
}
},
"sampling": {
"mode": "PERCENTAGE",
"percentage": 99
},
"recontact": {
"retakeSurvey": true,
"resurveyWindowSeconds": 1
}
}
}
'import requests
url = "https://api.sprig.com/v2/studies/{studyId}"
payload = {
"name": "<string>",
"appearance": {
"showBranding": True,
"replayDurationSeconds": 123,
"endCard": {
"enabled": True,
"headline": "<string>",
"subheader": "<string>"
}
},
"responseSettings": {
"completion": {
"mode": "FIXED",
"responseLimit": 2
},
"requireIdentifiedRespondent": True,
"allowBackwardNavigation": True,
"retake": { "resume": {
"enabled": True,
"windowDays": 16
} },
"sampling": {
"mode": "PERCENTAGE",
"percentage": 99
},
"recontact": {
"retakeSurvey": True,
"resurveyWindowSeconds": 1
}
}
}
headers = {
"If-Match": "<if-match>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'If-Match': '<if-match>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
appearance: {
showBranding: true,
replayDurationSeconds: 123,
endCard: {enabled: true, headline: '<string>', subheader: '<string>'}
},
responseSettings: {
completion: {mode: 'FIXED', responseLimit: 2},
requireIdentifiedRespondent: true,
allowBackwardNavigation: true,
retake: {resume: {enabled: true, windowDays: 16}},
sampling: {mode: 'PERCENTAGE', percentage: 99},
recontact: {retakeSurvey: true, resurveyWindowSeconds: 1}
}
})
};
fetch('https://api.sprig.com/v2/studies/{studyId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sprig.com/v2/studies/{studyId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'appearance' => [
'showBranding' => true,
'replayDurationSeconds' => 123,
'endCard' => [
'enabled' => true,
'headline' => '<string>',
'subheader' => '<string>'
]
],
'responseSettings' => [
'completion' => [
'mode' => 'FIXED',
'responseLimit' => 2
],
'requireIdentifiedRespondent' => true,
'allowBackwardNavigation' => true,
'retake' => [
'resume' => [
'enabled' => true,
'windowDays' => 16
]
],
'sampling' => [
'mode' => 'PERCENTAGE',
'percentage' => 99
],
'recontact' => [
'retakeSurvey' => true,
'resurveyWindowSeconds' => 1
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"If-Match: <if-match>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sprig.com/v2/studies/{studyId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"appearance\": {\n \"showBranding\": true,\n \"replayDurationSeconds\": 123,\n \"endCard\": {\n \"enabled\": true,\n \"headline\": \"<string>\",\n \"subheader\": \"<string>\"\n }\n },\n \"responseSettings\": {\n \"completion\": {\n \"mode\": \"FIXED\",\n \"responseLimit\": 2\n },\n \"requireIdentifiedRespondent\": true,\n \"allowBackwardNavigation\": true,\n \"retake\": {\n \"resume\": {\n \"enabled\": true,\n \"windowDays\": 16\n }\n },\n \"sampling\": {\n \"mode\": \"PERCENTAGE\",\n \"percentage\": 99\n },\n \"recontact\": {\n \"retakeSurvey\": true,\n \"resurveyWindowSeconds\": 1\n }\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("If-Match", "<if-match>")
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.sprig.com/v2/studies/{studyId}")
.header("If-Match", "<if-match>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"appearance\": {\n \"showBranding\": true,\n \"replayDurationSeconds\": 123,\n \"endCard\": {\n \"enabled\": true,\n \"headline\": \"<string>\",\n \"subheader\": \"<string>\"\n }\n },\n \"responseSettings\": {\n \"completion\": {\n \"mode\": \"FIXED\",\n \"responseLimit\": 2\n },\n \"requireIdentifiedRespondent\": true,\n \"allowBackwardNavigation\": true,\n \"retake\": {\n \"resume\": {\n \"enabled\": true,\n \"windowDays\": 16\n }\n },\n \"sampling\": {\n \"mode\": \"PERCENTAGE\",\n \"percentage\": 99\n },\n \"recontact\": {\n \"retakeSurvey\": true,\n \"resurveyWindowSeconds\": 1\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sprig.com/v2/studies/{studyId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["If-Match"] = '<if-match>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"appearance\": {\n \"showBranding\": true,\n \"replayDurationSeconds\": 123,\n \"endCard\": {\n \"enabled\": true,\n \"headline\": \"<string>\",\n \"subheader\": \"<string>\"\n }\n },\n \"responseSettings\": {\n \"completion\": {\n \"mode\": \"FIXED\",\n \"responseLimit\": 2\n },\n \"requireIdentifiedRespondent\": true,\n \"allowBackwardNavigation\": true,\n \"retake\": {\n \"resume\": {\n \"enabled\": true,\n \"windowDays\": 16\n }\n },\n \"sampling\": {\n \"mode\": \"PERCENTAGE\",\n \"percentage\": 99\n },\n \"recontact\": {\n \"retakeSurvey\": true,\n \"resurveyWindowSeconds\": 1\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}Authorizations
Use API-Key YOUR_API_KEY. The key selects the Production or Development environment.
Headers
Quoted Study version last read from ETag or Study.version. Required on mutating Study writes.
Example:
"\"126300\""
Path Parameters
Body
application/json
Updates Study settings or performs one lifecycle transition. Settings and status cannot be changed together.
Minimum string length:
1A partial appearance update for an in-product Study.
Show child attributes
Show child attributes
Partial response-setting update. Omitted fields preserve their current values.
Show child attributes
Show child attributes
Available options:
IN_PROGRESS, PAUSED, COMPLETED, ARCHIVED Response
No Content
Was this page helpful?
⌘I
Update Study settings or lifecycle status
curl --request PATCH \
--url https://api.sprig.com/v2/studies/{studyId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'If-Match: <if-match>' \
--data '
{
"name": "<string>",
"appearance": {
"showBranding": true,
"replayDurationSeconds": 123,
"endCard": {
"enabled": true,
"headline": "<string>",
"subheader": "<string>"
}
},
"responseSettings": {
"completion": {
"mode": "FIXED",
"responseLimit": 2
},
"requireIdentifiedRespondent": true,
"allowBackwardNavigation": true,
"retake": {
"resume": {
"enabled": true,
"windowDays": 16
}
},
"sampling": {
"mode": "PERCENTAGE",
"percentage": 99
},
"recontact": {
"retakeSurvey": true,
"resurveyWindowSeconds": 1
}
}
}
'import requests
url = "https://api.sprig.com/v2/studies/{studyId}"
payload = {
"name": "<string>",
"appearance": {
"showBranding": True,
"replayDurationSeconds": 123,
"endCard": {
"enabled": True,
"headline": "<string>",
"subheader": "<string>"
}
},
"responseSettings": {
"completion": {
"mode": "FIXED",
"responseLimit": 2
},
"requireIdentifiedRespondent": True,
"allowBackwardNavigation": True,
"retake": { "resume": {
"enabled": True,
"windowDays": 16
} },
"sampling": {
"mode": "PERCENTAGE",
"percentage": 99
},
"recontact": {
"retakeSurvey": True,
"resurveyWindowSeconds": 1
}
}
}
headers = {
"If-Match": "<if-match>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'If-Match': '<if-match>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
appearance: {
showBranding: true,
replayDurationSeconds: 123,
endCard: {enabled: true, headline: '<string>', subheader: '<string>'}
},
responseSettings: {
completion: {mode: 'FIXED', responseLimit: 2},
requireIdentifiedRespondent: true,
allowBackwardNavigation: true,
retake: {resume: {enabled: true, windowDays: 16}},
sampling: {mode: 'PERCENTAGE', percentage: 99},
recontact: {retakeSurvey: true, resurveyWindowSeconds: 1}
}
})
};
fetch('https://api.sprig.com/v2/studies/{studyId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sprig.com/v2/studies/{studyId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'appearance' => [
'showBranding' => true,
'replayDurationSeconds' => 123,
'endCard' => [
'enabled' => true,
'headline' => '<string>',
'subheader' => '<string>'
]
],
'responseSettings' => [
'completion' => [
'mode' => 'FIXED',
'responseLimit' => 2
],
'requireIdentifiedRespondent' => true,
'allowBackwardNavigation' => true,
'retake' => [
'resume' => [
'enabled' => true,
'windowDays' => 16
]
],
'sampling' => [
'mode' => 'PERCENTAGE',
'percentage' => 99
],
'recontact' => [
'retakeSurvey' => true,
'resurveyWindowSeconds' => 1
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"If-Match: <if-match>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sprig.com/v2/studies/{studyId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"appearance\": {\n \"showBranding\": true,\n \"replayDurationSeconds\": 123,\n \"endCard\": {\n \"enabled\": true,\n \"headline\": \"<string>\",\n \"subheader\": \"<string>\"\n }\n },\n \"responseSettings\": {\n \"completion\": {\n \"mode\": \"FIXED\",\n \"responseLimit\": 2\n },\n \"requireIdentifiedRespondent\": true,\n \"allowBackwardNavigation\": true,\n \"retake\": {\n \"resume\": {\n \"enabled\": true,\n \"windowDays\": 16\n }\n },\n \"sampling\": {\n \"mode\": \"PERCENTAGE\",\n \"percentage\": 99\n },\n \"recontact\": {\n \"retakeSurvey\": true,\n \"resurveyWindowSeconds\": 1\n }\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("If-Match", "<if-match>")
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.sprig.com/v2/studies/{studyId}")
.header("If-Match", "<if-match>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"appearance\": {\n \"showBranding\": true,\n \"replayDurationSeconds\": 123,\n \"endCard\": {\n \"enabled\": true,\n \"headline\": \"<string>\",\n \"subheader\": \"<string>\"\n }\n },\n \"responseSettings\": {\n \"completion\": {\n \"mode\": \"FIXED\",\n \"responseLimit\": 2\n },\n \"requireIdentifiedRespondent\": true,\n \"allowBackwardNavigation\": true,\n \"retake\": {\n \"resume\": {\n \"enabled\": true,\n \"windowDays\": 16\n }\n },\n \"sampling\": {\n \"mode\": \"PERCENTAGE\",\n \"percentage\": 99\n },\n \"recontact\": {\n \"retakeSurvey\": true,\n \"resurveyWindowSeconds\": 1\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sprig.com/v2/studies/{studyId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["If-Match"] = '<if-match>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"appearance\": {\n \"showBranding\": true,\n \"replayDurationSeconds\": 123,\n \"endCard\": {\n \"enabled\": true,\n \"headline\": \"<string>\",\n \"subheader\": \"<string>\"\n }\n },\n \"responseSettings\": {\n \"completion\": {\n \"mode\": \"FIXED\",\n \"responseLimit\": 2\n },\n \"requireIdentifiedRespondent\": true,\n \"allowBackwardNavigation\": true,\n \"retake\": {\n \"resume\": {\n \"enabled\": true,\n \"windowDays\": 16\n }\n },\n \"sampling\": {\n \"mode\": \"PERCENTAGE\",\n \"percentage\": 99\n },\n \"recontact\": {\n \"retakeSurvey\": true,\n \"resurveyWindowSeconds\": 1\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"resource": {
"type": "<string>",
"id": "<string>"
}
}
]
}