Update, publish, pause, or archive a survey
curl --request PATCH \
--url https://api.contactbutton.com/v1/workspaces/{workspace}/surveys/{survey} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"questions": [
{
"id": "<string>",
"title": "<string>",
"description": "<string>",
"required": true,
"options": [
"<string>"
],
"settings": {
"scale": 6,
"low_label": "<string>",
"high_label": "<string>"
}
}
],
"settings": {},
"design": {},
"distribution": {}
}
'import requests
url = "https://api.contactbutton.com/v1/workspaces/{workspace}/surveys/{survey}"
payload = {
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"questions": [
{
"id": "<string>",
"title": "<string>",
"description": "<string>",
"required": True,
"options": ["<string>"],
"settings": {
"scale": 6,
"low_label": "<string>",
"high_label": "<string>"
}
}
],
"settings": {},
"design": {},
"distribution": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
slug: '<string>',
description: '<string>',
questions: [
{
id: '<string>',
title: '<string>',
description: '<string>',
required: true,
options: ['<string>'],
settings: {scale: 6, low_label: '<string>', high_label: '<string>'}
}
],
settings: {},
design: {},
distribution: {}
})
};
fetch('https://api.contactbutton.com/v1/workspaces/{workspace}/surveys/{survey}', 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.contactbutton.com/v1/workspaces/{workspace}/surveys/{survey}",
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>',
'slug' => '<string>',
'description' => '<string>',
'questions' => [
[
'id' => '<string>',
'title' => '<string>',
'description' => '<string>',
'required' => true,
'options' => [
'<string>'
],
'settings' => [
'scale' => 6,
'low_label' => '<string>',
'high_label' => '<string>'
]
]
],
'settings' => [
],
'design' => [
],
'distribution' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.contactbutton.com/v1/workspaces/{workspace}/surveys/{survey}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"questions\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"required\": true,\n \"options\": [\n \"<string>\"\n ],\n \"settings\": {\n \"scale\": 6,\n \"low_label\": \"<string>\",\n \"high_label\": \"<string>\"\n }\n }\n ],\n \"settings\": {},\n \"design\": {},\n \"distribution\": {}\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.contactbutton.com/v1/workspaces/{workspace}/surveys/{survey}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"questions\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"required\": true,\n \"options\": [\n \"<string>\"\n ],\n \"settings\": {\n \"scale\": 6,\n \"low_label\": \"<string>\",\n \"high_label\": \"<string>\"\n }\n }\n ],\n \"settings\": {},\n \"design\": {},\n \"distribution\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.contactbutton.com/v1/workspaces/{workspace}/surveys/{survey}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"questions\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"required\": true,\n \"options\": [\n \"<string>\"\n ],\n \"settings\": {\n \"scale\": 6,\n \"low_label\": \"<string>\",\n \"high_label\": \"<string>\"\n }\n }\n ],\n \"settings\": {},\n \"design\": {},\n \"distribution\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": "<unknown>",
"meta": {
"request_id": "<string>",
"next_cursor": "<string>"
}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>",
"request_id": "<string>",
"errors": {}
}Update, publish, pause, or archive a survey
PATCH
/
workspaces
/
{workspace}
/
surveys
/
{survey}
Update, publish, pause, or archive a survey
curl --request PATCH \
--url https://api.contactbutton.com/v1/workspaces/{workspace}/surveys/{survey} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"questions": [
{
"id": "<string>",
"title": "<string>",
"description": "<string>",
"required": true,
"options": [
"<string>"
],
"settings": {
"scale": 6,
"low_label": "<string>",
"high_label": "<string>"
}
}
],
"settings": {},
"design": {},
"distribution": {}
}
'import requests
url = "https://api.contactbutton.com/v1/workspaces/{workspace}/surveys/{survey}"
payload = {
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"questions": [
{
"id": "<string>",
"title": "<string>",
"description": "<string>",
"required": True,
"options": ["<string>"],
"settings": {
"scale": 6,
"low_label": "<string>",
"high_label": "<string>"
}
}
],
"settings": {},
"design": {},
"distribution": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
slug: '<string>',
description: '<string>',
questions: [
{
id: '<string>',
title: '<string>',
description: '<string>',
required: true,
options: ['<string>'],
settings: {scale: 6, low_label: '<string>', high_label: '<string>'}
}
],
settings: {},
design: {},
distribution: {}
})
};
fetch('https://api.contactbutton.com/v1/workspaces/{workspace}/surveys/{survey}', 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.contactbutton.com/v1/workspaces/{workspace}/surveys/{survey}",
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>',
'slug' => '<string>',
'description' => '<string>',
'questions' => [
[
'id' => '<string>',
'title' => '<string>',
'description' => '<string>',
'required' => true,
'options' => [
'<string>'
],
'settings' => [
'scale' => 6,
'low_label' => '<string>',
'high_label' => '<string>'
]
]
],
'settings' => [
],
'design' => [
],
'distribution' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.contactbutton.com/v1/workspaces/{workspace}/surveys/{survey}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"questions\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"required\": true,\n \"options\": [\n \"<string>\"\n ],\n \"settings\": {\n \"scale\": 6,\n \"low_label\": \"<string>\",\n \"high_label\": \"<string>\"\n }\n }\n ],\n \"settings\": {},\n \"design\": {},\n \"distribution\": {}\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.contactbutton.com/v1/workspaces/{workspace}/surveys/{survey}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"questions\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"required\": true,\n \"options\": [\n \"<string>\"\n ],\n \"settings\": {\n \"scale\": 6,\n \"low_label\": \"<string>\",\n \"high_label\": \"<string>\"\n }\n }\n ],\n \"settings\": {},\n \"design\": {},\n \"distribution\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.contactbutton.com/v1/workspaces/{workspace}/surveys/{survey}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"questions\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"required\": true,\n \"options\": [\n \"<string>\"\n ],\n \"settings\": {\n \"scale\": 6,\n \"low_label\": \"<string>\",\n \"high_label\": \"<string>\"\n }\n }\n ],\n \"settings\": {},\n \"design\": {},\n \"distribution\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": "<unknown>",
"meta": {
"request_id": "<string>",
"next_cursor": "<string>"
}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>",
"request_id": "<string>",
"errors": {}
}Authorizations
A Contact Button scoped bearer key. Send Authorization: Bearer <token>.
Token abilities are enforced independently of workspace membership; both checks must pass.
OAuth 2.0 authorization-code flows are not currently available.
Headers
Stable 8–120 character key for safe mutation retries.
Required string length:
8 - 120Body
application/json
Maximum string length:
255Pattern:
^[a-z0-9]+(?:-[a-z0-9]+)*$Maximum string length:
2000Available options:
draft, published, paused, archived Required array length:
1 - 100 elementsShow child attributes
Show child attributes
Was this page helpful?
⌘I