Studies
Create a draft Study
Creates a draft Survey or in-product Survey Study shell. Questions are created separately. Sampling and recontact settings apply only to IN_PRODUCT_SURVEY Studies.
POST
/
v2
/
studies
Create a draft Study
curl --request POST \
--url https://api.sprig.com/v2/studies \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"type": "SURVEY",
"responseSettings": {
"completion": {
"mode": "FIXED",
"responseLimit": 2
},
"requireIdentifiedRespondent": true,
"allowBackwardNavigation": true,
"retake": {
"resume": {
"enabled": true,
"windowDays": 16
}
}
}
}
'import requests
url = "https://api.sprig.com/v2/studies"
payload = {
"name": "<string>",
"type": "SURVEY",
"responseSettings": {
"completion": {
"mode": "FIXED",
"responseLimit": 2
},
"requireIdentifiedRespondent": True,
"allowBackwardNavigation": True,
"retake": { "resume": {
"enabled": True,
"windowDays": 16
} }
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
type: 'SURVEY',
responseSettings: {
completion: {mode: 'FIXED', responseLimit: 2},
requireIdentifiedRespondent: true,
allowBackwardNavigation: true,
retake: {resume: {enabled: true, windowDays: 16}}
}
})
};
fetch('https://api.sprig.com/v2/studies', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'type' => 'SURVEY',
'responseSettings' => [
'completion' => [
'mode' => 'FIXED',
'responseLimit' => 2
],
'requireIdentifiedRespondent' => true,
'allowBackwardNavigation' => true,
'retake' => [
'resume' => [
'enabled' => true,
'windowDays' => 16
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"type\": \"SURVEY\",\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 }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.sprig.com/v2/studies")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"type\": \"SURVEY\",\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 }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sprig.com/v2/studies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"type\": \"SURVEY\",\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 }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"status": "DRAFT",
"version": 2,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"studyUrl": "<string>",
"type": "SURVEY",
"responseSettings": {
"completion": {
"mode": "FIXED",
"responseLimit": 2
},
"requireIdentifiedRespondent": true,
"allowBackwardNavigation": true,
"retake": {
"invitationMode": "GENERATED",
"responseLimit": "PER_INVITATION",
"resume": {
"enabled": true,
"windowDays": 16
}
}
},
"shareUrl": "<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.
Body
application/json
- Shareable survey
- Web in-product survey
- Mobile in-product survey
Input for creating a draft Survey or in-product Survey Study.
Response
Created
- Shareable survey
- In-product survey
A Study discriminated by its public type.
Available options:
DRAFT, IN_PROGRESS, PAUSED, COMPLETED, ARCHIVED Required range:
x >= 1Link to this Study in the Sprig dashboard for authors.
A shareable Survey Study.
Available options:
SURVEY Show child attributes
Show child attributes
The respondent URL, or null until the Study can be shared.
Was this page helpful?
⌘I
Create a draft Study
curl --request POST \
--url https://api.sprig.com/v2/studies \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"type": "SURVEY",
"responseSettings": {
"completion": {
"mode": "FIXED",
"responseLimit": 2
},
"requireIdentifiedRespondent": true,
"allowBackwardNavigation": true,
"retake": {
"resume": {
"enabled": true,
"windowDays": 16
}
}
}
}
'import requests
url = "https://api.sprig.com/v2/studies"
payload = {
"name": "<string>",
"type": "SURVEY",
"responseSettings": {
"completion": {
"mode": "FIXED",
"responseLimit": 2
},
"requireIdentifiedRespondent": True,
"allowBackwardNavigation": True,
"retake": { "resume": {
"enabled": True,
"windowDays": 16
} }
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
type: 'SURVEY',
responseSettings: {
completion: {mode: 'FIXED', responseLimit: 2},
requireIdentifiedRespondent: true,
allowBackwardNavigation: true,
retake: {resume: {enabled: true, windowDays: 16}}
}
})
};
fetch('https://api.sprig.com/v2/studies', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'type' => 'SURVEY',
'responseSettings' => [
'completion' => [
'mode' => 'FIXED',
'responseLimit' => 2
],
'requireIdentifiedRespondent' => true,
'allowBackwardNavigation' => true,
'retake' => [
'resume' => [
'enabled' => true,
'windowDays' => 16
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"type\": \"SURVEY\",\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 }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.sprig.com/v2/studies")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"type\": \"SURVEY\",\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 }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sprig.com/v2/studies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"type\": \"SURVEY\",\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 }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"status": "DRAFT",
"version": 2,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"studyUrl": "<string>",
"type": "SURVEY",
"responseSettings": {
"completion": {
"mode": "FIXED",
"responseLimit": 2
},
"requireIdentifiedRespondent": true,
"allowBackwardNavigation": true,
"retake": {
"invitationMode": "GENERATED",
"responseLimit": "PER_INVITATION",
"resume": {
"enabled": true,
"windowDays": 16
}
}
},
"shareUrl": "<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>"
}
}
]
}