Forms
Generate a public token
Gives the form a new public token, replacing any token it already had, so links built on the old token stop working. The token identifies the public form for the share and embed URLs in the response and the Fluid Public SDK API’s token-addressed forms operations. The form must be active, and its embed settings still apply: a password, allowed domains, an expiry date, a submission limit, and required contact details. Works for any form type. Activating a form through Update a form also creates a token when the form has none.
POST
/
api
/
forms
/
{id}
/
generate_token
Generate a public token
curl --request POST \
--url https://api.fluid.app/api/forms/{id}/generate_token \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.fluid.app/api/forms/{id}/generate_token"
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}/generate_token', 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}/generate_token",
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}/generate_token"
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}/generate_token")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/forms/{id}/generate_token")
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{
"form": {
"countries": [
"<string>"
],
"description": "<string>",
"embed_settings": {
"password_protected": true
},
"embed_url": "<string>",
"form_components": null,
"form_redirect": null,
"form_respondents_count": 123,
"form_styles": null,
"form_type": null,
"id": 123,
"public_token": "<string>",
"share_url": "<string>",
"status": "<string>",
"title": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"message": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>"
}{
"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.
⌘I
Generate a public token
curl --request POST \
--url https://api.fluid.app/api/forms/{id}/generate_token \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.fluid.app/api/forms/{id}/generate_token"
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}/generate_token', 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}/generate_token",
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}/generate_token"
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}/generate_token")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/forms/{id}/generate_token")
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{
"form": {
"countries": [
"<string>"
],
"description": "<string>",
"embed_settings": {
"password_protected": true
},
"embed_url": "<string>",
"form_components": null,
"form_redirect": null,
"form_respondents_count": 123,
"form_styles": null,
"form_type": null,
"id": 123,
"public_token": "<string>",
"share_url": "<string>",
"status": "<string>",
"title": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"message": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>"
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}