curl --request POST \
--url https://api.livechatinc.com/v3.7/configuration/action/update_form \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "prechat",
"group_id": 0,
"enabled": true,
"fields": [
{
"type": "question",
"label": "What is your name?",
"required": true
},
{
"type": "checkbox",
"label": "Pick topics",
"required": false,
"answers": [
{
"label": "Billing",
"checked": true
},
{
"label": "Support",
"checked": false
}
]
}
]
}
'import requests
url = "https://api.livechatinc.com/v3.7/configuration/action/update_form"
payload = {
"type": "prechat",
"group_id": 0,
"enabled": True,
"fields": [
{
"type": "question",
"label": "What is your name?",
"required": True
},
{
"type": "checkbox",
"label": "Pick topics",
"required": False,
"answers": [
{
"label": "Billing",
"checked": True
},
{
"label": "Support",
"checked": False
}
]
}
]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'prechat',
group_id: 0,
enabled: true,
fields: [
{type: 'question', label: 'What is your name?', required: true},
{
type: 'checkbox',
label: 'Pick topics',
required: false,
answers: [{label: 'Billing', checked: true}, {label: 'Support', checked: false}]
}
]
})
};
fetch('https://api.livechatinc.com/v3.7/configuration/action/update_form', 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.livechatinc.com/v3.7/configuration/action/update_form",
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([
'type' => 'prechat',
'group_id' => 0,
'enabled' => true,
'fields' => [
[
'type' => 'question',
'label' => 'What is your name?',
'required' => true
],
[
'type' => 'checkbox',
'label' => 'Pick topics',
'required' => false,
'answers' => [
[
'label' => 'Billing',
'checked' => true
],
[
'label' => 'Support',
'checked' => false
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.livechatinc.com/v3.7/configuration/action/update_form"
payload := strings.NewReader("{\n \"type\": \"prechat\",\n \"group_id\": 0,\n \"enabled\": true,\n \"fields\": [\n {\n \"type\": \"question\",\n \"label\": \"What is your name?\",\n \"required\": true\n },\n {\n \"type\": \"checkbox\",\n \"label\": \"Pick topics\",\n \"required\": false,\n \"answers\": [\n {\n \"label\": \"Billing\",\n \"checked\": true\n },\n {\n \"label\": \"Support\",\n \"checked\": false\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.livechatinc.com/v3.7/configuration/action/update_form")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"prechat\",\n \"group_id\": 0,\n \"enabled\": true,\n \"fields\": [\n {\n \"type\": \"question\",\n \"label\": \"What is your name?\",\n \"required\": true\n },\n {\n \"type\": \"checkbox\",\n \"label\": \"Pick topics\",\n \"required\": false,\n \"answers\": [\n {\n \"label\": \"Billing\",\n \"checked\": true\n },\n {\n \"label\": \"Support\",\n \"checked\": false\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.livechatinc.com/v3.7/configuration/action/update_form")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"prechat\",\n \"group_id\": 0,\n \"enabled\": true,\n \"fields\": [\n {\n \"type\": \"question\",\n \"label\": \"What is your name?\",\n \"required\": true\n },\n {\n \"type\": \"checkbox\",\n \"label\": \"Pick topics\",\n \"required\": false,\n \"answers\": [\n {\n \"label\": \"Billing\",\n \"checked\": true\n },\n {\n \"label\": \"Support\",\n \"checked\": false\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"form": {
"id": "1",
"type": "prechat",
"enabled": true,
"fields": [
{
"id": "153925275950libraryquestion",
"type": "question",
"label": "What is your name?",
"required": true
},
{
"id": "153925275950librarytopics",
"type": "checkbox",
"label": "Pick topics",
"required": false,
"answers": [
{
"label": "Billing",
"checked": true
},
{
"label": "Support",
"checked": false
}
]
}
]
}
}Update form
Creates or updates a form and returns the resulting configuration.
When you provide fields, the method replaces the form’s configured fields with the provided array. For survey forms, omit fields to keep the configured fields unchanged. Custom forms require at least one field.
curl --request POST \
--url https://api.livechatinc.com/v3.7/configuration/action/update_form \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "prechat",
"group_id": 0,
"enabled": true,
"fields": [
{
"type": "question",
"label": "What is your name?",
"required": true
},
{
"type": "checkbox",
"label": "Pick topics",
"required": false,
"answers": [
{
"label": "Billing",
"checked": true
},
{
"label": "Support",
"checked": false
}
]
}
]
}
'import requests
url = "https://api.livechatinc.com/v3.7/configuration/action/update_form"
payload = {
"type": "prechat",
"group_id": 0,
"enabled": True,
"fields": [
{
"type": "question",
"label": "What is your name?",
"required": True
},
{
"type": "checkbox",
"label": "Pick topics",
"required": False,
"answers": [
{
"label": "Billing",
"checked": True
},
{
"label": "Support",
"checked": False
}
]
}
]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'prechat',
group_id: 0,
enabled: true,
fields: [
{type: 'question', label: 'What is your name?', required: true},
{
type: 'checkbox',
label: 'Pick topics',
required: false,
answers: [{label: 'Billing', checked: true}, {label: 'Support', checked: false}]
}
]
})
};
fetch('https://api.livechatinc.com/v3.7/configuration/action/update_form', 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.livechatinc.com/v3.7/configuration/action/update_form",
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([
'type' => 'prechat',
'group_id' => 0,
'enabled' => true,
'fields' => [
[
'type' => 'question',
'label' => 'What is your name?',
'required' => true
],
[
'type' => 'checkbox',
'label' => 'Pick topics',
'required' => false,
'answers' => [
[
'label' => 'Billing',
'checked' => true
],
[
'label' => 'Support',
'checked' => false
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.livechatinc.com/v3.7/configuration/action/update_form"
payload := strings.NewReader("{\n \"type\": \"prechat\",\n \"group_id\": 0,\n \"enabled\": true,\n \"fields\": [\n {\n \"type\": \"question\",\n \"label\": \"What is your name?\",\n \"required\": true\n },\n {\n \"type\": \"checkbox\",\n \"label\": \"Pick topics\",\n \"required\": false,\n \"answers\": [\n {\n \"label\": \"Billing\",\n \"checked\": true\n },\n {\n \"label\": \"Support\",\n \"checked\": false\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.livechatinc.com/v3.7/configuration/action/update_form")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"prechat\",\n \"group_id\": 0,\n \"enabled\": true,\n \"fields\": [\n {\n \"type\": \"question\",\n \"label\": \"What is your name?\",\n \"required\": true\n },\n {\n \"type\": \"checkbox\",\n \"label\": \"Pick topics\",\n \"required\": false,\n \"answers\": [\n {\n \"label\": \"Billing\",\n \"checked\": true\n },\n {\n \"label\": \"Support\",\n \"checked\": false\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.livechatinc.com/v3.7/configuration/action/update_form")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"prechat\",\n \"group_id\": 0,\n \"enabled\": true,\n \"fields\": [\n {\n \"type\": \"question\",\n \"label\": \"What is your name?\",\n \"required\": true\n },\n {\n \"type\": \"checkbox\",\n \"label\": \"Pick topics\",\n \"required\": false,\n \"answers\": [\n {\n \"label\": \"Billing\",\n \"checked\": true\n },\n {\n \"label\": \"Support\",\n \"checked\": false\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"form": {
"id": "1",
"type": "prechat",
"enabled": true,
"fields": [
{
"id": "153925275950libraryquestion",
"type": "question",
"label": "What is your name?",
"required": true
},
{
"id": "153925275950librarytopics",
"type": "checkbox",
"label": "Pick topics",
"required": false,
"answers": [
{
"label": "Billing",
"checked": true
},
{
"label": "Support",
"checked": false
}
]
}
]
}
}Authorizations
Use your account ID as the username and your personal access token (PAT) as the password, or pass a Base64-encoded value directly in the Authorization header. For more information, see the personal access tokens guide.
Body
The form type:
prechatandpostchat— Survey forms.offline,queued,email,ask_for_email, andask_for_email_mm— Custom forms.
prechat, postchat, offline, queued, email, ask_for_email, ask_for_email_mm The ID of the group that owns the form.
If set to true, enables the survey form. If set to false, disables it. Applies only to survey forms and is ignored for custom forms.
The form fields in display order. For survey forms, omitting this field preserves the configured fields. For custom forms, this field is required and must contain at least one item.
20Show child attributes
Show child attributes
Response
The updated form.
Show child attributes
Show child attributes
Was this page helpful?