Duplicate a form
Copies a form. The copy is titled with Copy added, keeps the type, status, styles, countries, and active elements, and starts with no responses, no public token, and no embed settings. A copy of an active post-purchase form is active too, so checkout shows it alongside the original. Copying a form with sensitive fields needs the forms manage-sensitive permission, otherwise it returns 422. Sends the form_created webhook event. Returns the copy itself, not wrapped in a form object.
curl --request POST \
--url https://api.fluid.app/api/forms/{id}/duplicate \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.fluid.app/api/forms/{id}/duplicate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.fluid.app/api/forms/{id}/duplicate', 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}/duplicate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.fluid.app/api/forms/{id}/duplicate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.fluid.app/api/forms/{id}/duplicate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/forms/{id}/duplicate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"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"
}
}{
"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 to copy.
Response
Success
A form as the admin sees it. Responses also carry public_token, embed_settings, embed_url, and share_url, described under Generate a public token.
ID of the form.
The countries the form is for. A post-purchase form is shown only for carts in one of them.
Show child attributes
Show child attributes
Description shown with the form.
The form's elements as the builder saved them, a JSON-encoded array of components. Each component carries the id of the active element it maps to, so you can send it back to Update a form to edit elements in place.
The form's visual styles, or null when none are set.
Show child attributes
Show child attributes
URL the hosted form sends the respondent to after they submit, or null.
Number of respondents the form has, in any completion status.
post_purchase, general, or the retired pre_purchase; null when unset. See Update a form for what each type means.
draft or active. Only an active form is shown at checkout or served by its public token. Changing a form to active gives it a public token if it has none.
Title of the form.
When the form last changed.
curl --request POST \
--url https://api.fluid.app/api/forms/{id}/duplicate \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.fluid.app/api/forms/{id}/duplicate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.fluid.app/api/forms/{id}/duplicate', 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}/duplicate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.fluid.app/api/forms/{id}/duplicate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.fluid.app/api/forms/{id}/duplicate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/forms/{id}/duplicate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"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"
}
}{
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}