Forms
Update a form
Changes a form. Send only the fields to change, inside a form object.
- Set
form_typetopost_purchaseto show the form after payment at enrollment checkout, or togeneralfor a standalone form you share or embed.pre_purchaseis retired and returns 422; an existing pre-purchase form stays editable as long as the request doesn’t name that type. - Set
country_idsto choose the countries the form is for. This replaces the current list. - Set
statustoactiveto publish the form. Activating a form gives it a public token if it has none and sends theform_activatedwebhook event. - Send
form_componentsto change the form’s elements.
Every update sends the form_updated webhook event. Returns 404 when the form isn’t one of your company’s, and 422 when a value is invalid.
PUT
/
api
/
forms
/
{id}
Update a form
curl --request PUT \
--url https://api.fluid.app/api/forms/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"form": {
"title": "<string>",
"description": "<string>",
"status": "<string>",
"form_type": "<string>",
"form_components": "<string>",
"form_styles": "<string>",
"form_redirect": "<string>",
"default": true,
"country_ids": [
123
]
}
}
'import requests
url = "https://api.fluid.app/api/forms/{id}"
payload = { "form": {
"title": "<string>",
"description": "<string>",
"status": "<string>",
"form_type": "<string>",
"form_components": "<string>",
"form_styles": "<string>",
"form_redirect": "<string>",
"default": True,
"country_ids": [123]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
form: {
title: '<string>',
description: '<string>',
status: '<string>',
form_type: '<string>',
form_components: '<string>',
form_styles: '<string>',
form_redirect: '<string>',
default: true,
country_ids: [123]
}
})
};
fetch('https://api.fluid.app/api/forms/{id}', 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.fluid.app/api/forms/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'form' => [
'title' => '<string>',
'description' => '<string>',
'status' => '<string>',
'form_type' => '<string>',
'form_components' => '<string>',
'form_styles' => '<string>',
'form_redirect' => '<string>',
'default' => true,
'country_ids' => [
123
]
]
]),
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.fluid.app/api/forms/{id}"
payload := strings.NewReader("{\n \"form\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"status\": \"<string>\",\n \"form_type\": \"<string>\",\n \"form_components\": \"<string>\",\n \"form_styles\": \"<string>\",\n \"form_redirect\": \"<string>\",\n \"default\": true,\n \"country_ids\": [\n 123\n ]\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.fluid.app/api/forms/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"form\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"status\": \"<string>\",\n \"form_type\": \"<string>\",\n \"form_components\": \"<string>\",\n \"form_styles\": \"<string>\",\n \"form_redirect\": \"<string>\",\n \"default\": true,\n \"country_ids\": [\n 123\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/forms/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"form\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"status\": \"<string>\",\n \"form_type\": \"<string>\",\n \"form_components\": \"<string>\",\n \"form_styles\": \"<string>\",\n \"form_redirect\": \"<string>\",\n \"default\": true,\n \"country_ids\": [\n 123\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"form": {
"id": 123,
"countries": [
{
"id": 123,
"iso": "<string>",
"name": "<string>"
}
],
"description": "<string>",
"form_components": "<string>",
"form_styles": {},
"form_redirect": "<string>",
"form_respondents_count": 123,
"form_type": "<string>",
"status": "<string>",
"title": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}Authorizations
Bearer token authentication
Path Parameters
ID of the form.
Body
application/json
The fields to change. Send at least one field inside form; fields you leave out keep their values.
The form fields to change.
Show child attributes
Show child attributes
⌘I
Update a form
curl --request PUT \
--url https://api.fluid.app/api/forms/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"form": {
"title": "<string>",
"description": "<string>",
"status": "<string>",
"form_type": "<string>",
"form_components": "<string>",
"form_styles": "<string>",
"form_redirect": "<string>",
"default": true,
"country_ids": [
123
]
}
}
'import requests
url = "https://api.fluid.app/api/forms/{id}"
payload = { "form": {
"title": "<string>",
"description": "<string>",
"status": "<string>",
"form_type": "<string>",
"form_components": "<string>",
"form_styles": "<string>",
"form_redirect": "<string>",
"default": True,
"country_ids": [123]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
form: {
title: '<string>',
description: '<string>',
status: '<string>',
form_type: '<string>',
form_components: '<string>',
form_styles: '<string>',
form_redirect: '<string>',
default: true,
country_ids: [123]
}
})
};
fetch('https://api.fluid.app/api/forms/{id}', 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.fluid.app/api/forms/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'form' => [
'title' => '<string>',
'description' => '<string>',
'status' => '<string>',
'form_type' => '<string>',
'form_components' => '<string>',
'form_styles' => '<string>',
'form_redirect' => '<string>',
'default' => true,
'country_ids' => [
123
]
]
]),
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.fluid.app/api/forms/{id}"
payload := strings.NewReader("{\n \"form\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"status\": \"<string>\",\n \"form_type\": \"<string>\",\n \"form_components\": \"<string>\",\n \"form_styles\": \"<string>\",\n \"form_redirect\": \"<string>\",\n \"default\": true,\n \"country_ids\": [\n 123\n ]\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.fluid.app/api/forms/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"form\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"status\": \"<string>\",\n \"form_type\": \"<string>\",\n \"form_components\": \"<string>\",\n \"form_styles\": \"<string>\",\n \"form_redirect\": \"<string>\",\n \"default\": true,\n \"country_ids\": [\n 123\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/forms/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"form\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"status\": \"<string>\",\n \"form_type\": \"<string>\",\n \"form_components\": \"<string>\",\n \"form_styles\": \"<string>\",\n \"form_redirect\": \"<string>\",\n \"default\": true,\n \"country_ids\": [\n 123\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"form": {
"id": 123,
"countries": [
{
"id": 123,
"iso": "<string>",
"name": "<string>"
}
],
"description": "<string>",
"form_components": "<string>",
"form_styles": {},
"form_redirect": "<string>",
"form_respondents_count": 123,
"form_type": "<string>",
"status": "<string>",
"title": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}