Marketing
Create a signup form
Creates a signup form for an audience. Turnstile credentials are required when CAPTCHA is enabled.
POST
/
marketing
/
forms
Create a signup form
curl --request POST \
--url https://api.jetemail.com/marketing/forms \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"name": "Website newsletter",
"audienceId": "<string>",
"status": "active",
"fields": [
{
"name": "email",
"label": "Email address",
"type": "email",
"required": true,
"placeholder": "you@example.com"
}
],
"settings": {
"heading": "Stay in the loop",
"description": "Get product news and updates delivered to your inbox.",
"buttonLabel": "Subscribe",
"successMessage": "You're subscribed. Thanks for joining!",
"errorMessage": "Something went wrong. Please try again.",
"requireConsent": false,
"consentLabel": "I agree to receive marketing emails. I can unsubscribe at any time.",
"redirectUrl": "<string>",
"backgroundColor": "#ffffff",
"textColor": "#111827",
"inputColor": "#ffffff",
"buttonColor": "#111827",
"buttonTextColor": "#ffffff",
"borderColor": "#d1d5db",
"borderRadius": 8,
"hideBranding": true,
"optInMode": "single",
"pendingMessage": "<string>",
"confirmationFromName": "<string>",
"confirmationFromEmail": "jsmith@example.com",
"confirmationSubject": "<string>",
"confirmationMessage": "<string>",
"confirmationButtonLabel": "<string>",
"confirmationRedirectUrl": "<string>",
"autoProtection": true
},
"turnstileEnabled": false,
"turnstileSiteKey": "<string>",
"turnstileSecretKey": "<string>"
}
EOFimport requests
url = "https://api.jetemail.com/marketing/forms"
payload = {
"name": "Website newsletter",
"audienceId": "<string>",
"status": "active",
"fields": [
{
"name": "email",
"label": "Email address",
"type": "email",
"required": True,
"placeholder": "you@example.com"
}
],
"settings": {
"heading": "Stay in the loop",
"description": "Get product news and updates delivered to your inbox.",
"buttonLabel": "Subscribe",
"successMessage": "You're subscribed. Thanks for joining!",
"errorMessage": "Something went wrong. Please try again.",
"requireConsent": False,
"consentLabel": "I agree to receive marketing emails. I can unsubscribe at any time.",
"redirectUrl": "<string>",
"backgroundColor": "#ffffff",
"textColor": "#111827",
"inputColor": "#ffffff",
"buttonColor": "#111827",
"buttonTextColor": "#ffffff",
"borderColor": "#d1d5db",
"borderRadius": 8,
"hideBranding": True,
"optInMode": "single",
"pendingMessage": "<string>",
"confirmationFromName": "<string>",
"confirmationFromEmail": "jsmith@example.com",
"confirmationSubject": "<string>",
"confirmationMessage": "<string>",
"confirmationButtonLabel": "<string>",
"confirmationRedirectUrl": "<string>",
"autoProtection": True
},
"turnstileEnabled": False,
"turnstileSiteKey": "<string>",
"turnstileSecretKey": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Website newsletter',
audienceId: '<string>',
status: 'active',
fields: [
{
name: 'email',
label: 'Email address',
type: 'email',
required: true,
placeholder: 'you@example.com'
}
],
settings: {
heading: 'Stay in the loop',
description: 'Get product news and updates delivered to your inbox.',
buttonLabel: 'Subscribe',
successMessage: 'You\'re subscribed. Thanks for joining!',
errorMessage: 'Something went wrong. Please try again.',
requireConsent: false,
consentLabel: 'I agree to receive marketing emails. I can unsubscribe at any time.',
redirectUrl: '<string>',
backgroundColor: '#ffffff',
textColor: '#111827',
inputColor: '#ffffff',
buttonColor: '#111827',
buttonTextColor: '#ffffff',
borderColor: '#d1d5db',
borderRadius: 8,
hideBranding: true,
optInMode: 'single',
pendingMessage: '<string>',
confirmationFromName: '<string>',
confirmationFromEmail: 'jsmith@example.com',
confirmationSubject: '<string>',
confirmationMessage: '<string>',
confirmationButtonLabel: '<string>',
confirmationRedirectUrl: '<string>',
autoProtection: true
},
turnstileEnabled: false,
turnstileSiteKey: '<string>',
turnstileSecretKey: '<string>'
})
};
fetch('https://api.jetemail.com/marketing/forms', 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.jetemail.com/marketing/forms",
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([
'name' => 'Website newsletter',
'audienceId' => '<string>',
'status' => 'active',
'fields' => [
[
'name' => 'email',
'label' => 'Email address',
'type' => 'email',
'required' => true,
'placeholder' => 'you@example.com'
]
],
'settings' => [
'heading' => 'Stay in the loop',
'description' => 'Get product news and updates delivered to your inbox.',
'buttonLabel' => 'Subscribe',
'successMessage' => 'You\'re subscribed. Thanks for joining!',
'errorMessage' => 'Something went wrong. Please try again.',
'requireConsent' => false,
'consentLabel' => 'I agree to receive marketing emails. I can unsubscribe at any time.',
'redirectUrl' => '<string>',
'backgroundColor' => '#ffffff',
'textColor' => '#111827',
'inputColor' => '#ffffff',
'buttonColor' => '#111827',
'buttonTextColor' => '#ffffff',
'borderColor' => '#d1d5db',
'borderRadius' => 8,
'hideBranding' => true,
'optInMode' => 'single',
'pendingMessage' => '<string>',
'confirmationFromName' => '<string>',
'confirmationFromEmail' => 'jsmith@example.com',
'confirmationSubject' => '<string>',
'confirmationMessage' => '<string>',
'confirmationButtonLabel' => '<string>',
'confirmationRedirectUrl' => '<string>',
'autoProtection' => true
],
'turnstileEnabled' => false,
'turnstileSiteKey' => '<string>',
'turnstileSecretKey' => '<string>'
]),
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.jetemail.com/marketing/forms"
payload := strings.NewReader("{\n \"name\": \"Website newsletter\",\n \"audienceId\": \"<string>\",\n \"status\": \"active\",\n \"fields\": [\n {\n \"name\": \"email\",\n \"label\": \"Email address\",\n \"type\": \"email\",\n \"required\": true,\n \"placeholder\": \"you@example.com\"\n }\n ],\n \"settings\": {\n \"heading\": \"Stay in the loop\",\n \"description\": \"Get product news and updates delivered to your inbox.\",\n \"buttonLabel\": \"Subscribe\",\n \"successMessage\": \"You're subscribed. Thanks for joining!\",\n \"errorMessage\": \"Something went wrong. Please try again.\",\n \"requireConsent\": false,\n \"consentLabel\": \"I agree to receive marketing emails. I can unsubscribe at any time.\",\n \"redirectUrl\": \"<string>\",\n \"backgroundColor\": \"#ffffff\",\n \"textColor\": \"#111827\",\n \"inputColor\": \"#ffffff\",\n \"buttonColor\": \"#111827\",\n \"buttonTextColor\": \"#ffffff\",\n \"borderColor\": \"#d1d5db\",\n \"borderRadius\": 8,\n \"hideBranding\": true,\n \"optInMode\": \"single\",\n \"pendingMessage\": \"<string>\",\n \"confirmationFromName\": \"<string>\",\n \"confirmationFromEmail\": \"jsmith@example.com\",\n \"confirmationSubject\": \"<string>\",\n \"confirmationMessage\": \"<string>\",\n \"confirmationButtonLabel\": \"<string>\",\n \"confirmationRedirectUrl\": \"<string>\",\n \"autoProtection\": true\n },\n \"turnstileEnabled\": false,\n \"turnstileSiteKey\": \"<string>\",\n \"turnstileSecretKey\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.jetemail.com/marketing/forms")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Website newsletter\",\n \"audienceId\": \"<string>\",\n \"status\": \"active\",\n \"fields\": [\n {\n \"name\": \"email\",\n \"label\": \"Email address\",\n \"type\": \"email\",\n \"required\": true,\n \"placeholder\": \"you@example.com\"\n }\n ],\n \"settings\": {\n \"heading\": \"Stay in the loop\",\n \"description\": \"Get product news and updates delivered to your inbox.\",\n \"buttonLabel\": \"Subscribe\",\n \"successMessage\": \"You're subscribed. Thanks for joining!\",\n \"errorMessage\": \"Something went wrong. Please try again.\",\n \"requireConsent\": false,\n \"consentLabel\": \"I agree to receive marketing emails. I can unsubscribe at any time.\",\n \"redirectUrl\": \"<string>\",\n \"backgroundColor\": \"#ffffff\",\n \"textColor\": \"#111827\",\n \"inputColor\": \"#ffffff\",\n \"buttonColor\": \"#111827\",\n \"buttonTextColor\": \"#ffffff\",\n \"borderColor\": \"#d1d5db\",\n \"borderRadius\": 8,\n \"hideBranding\": true,\n \"optInMode\": \"single\",\n \"pendingMessage\": \"<string>\",\n \"confirmationFromName\": \"<string>\",\n \"confirmationFromEmail\": \"jsmith@example.com\",\n \"confirmationSubject\": \"<string>\",\n \"confirmationMessage\": \"<string>\",\n \"confirmationButtonLabel\": \"<string>\",\n \"confirmationRedirectUrl\": \"<string>\",\n \"autoProtection\": true\n },\n \"turnstileEnabled\": false,\n \"turnstileSiteKey\": \"<string>\",\n \"turnstileSecretKey\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.jetemail.com/marketing/forms")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Website newsletter\",\n \"audienceId\": \"<string>\",\n \"status\": \"active\",\n \"fields\": [\n {\n \"name\": \"email\",\n \"label\": \"Email address\",\n \"type\": \"email\",\n \"required\": true,\n \"placeholder\": \"you@example.com\"\n }\n ],\n \"settings\": {\n \"heading\": \"Stay in the loop\",\n \"description\": \"Get product news and updates delivered to your inbox.\",\n \"buttonLabel\": \"Subscribe\",\n \"successMessage\": \"You're subscribed. Thanks for joining!\",\n \"errorMessage\": \"Something went wrong. Please try again.\",\n \"requireConsent\": false,\n \"consentLabel\": \"I agree to receive marketing emails. I can unsubscribe at any time.\",\n \"redirectUrl\": \"<string>\",\n \"backgroundColor\": \"#ffffff\",\n \"textColor\": \"#111827\",\n \"inputColor\": \"#ffffff\",\n \"buttonColor\": \"#111827\",\n \"buttonTextColor\": \"#ffffff\",\n \"borderColor\": \"#d1d5db\",\n \"borderRadius\": 8,\n \"hideBranding\": true,\n \"optInMode\": \"single\",\n \"pendingMessage\": \"<string>\",\n \"confirmationFromName\": \"<string>\",\n \"confirmationFromEmail\": \"jsmith@example.com\",\n \"confirmationSubject\": \"<string>\",\n \"confirmationMessage\": \"<string>\",\n \"confirmationButtonLabel\": \"<string>\",\n \"confirmationRedirectUrl\": \"<string>\",\n \"autoProtection\": true\n },\n \"turnstileEnabled\": false,\n \"turnstileSiteKey\": \"<string>\",\n \"turnstileSecretKey\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"public_id": "form_oCiNpdGJPDhgV4kFa6t1jeoF",
"form_url": "<string>"
}Authorizations
API key for account management endpoints. Use your api_ prefixed token.
Body
application/json
Required string length:
1 - 100Example:
"Website newsletter"
Owned audience that successful submissions join.
Available options:
active, paused Required array length:
1 - 20 elementsShow child attributes
Show child attributes
Show child attributes
Show child attributes
Cloudflare Turnstile widget site key. Required when Turnstile is enabled.
Maximum string length:
200Cloudflare Turnstile secret. Required when enabling CAPTCHA or changing the site key.
Maximum string length:
500⌘I
Create a signup form
curl --request POST \
--url https://api.jetemail.com/marketing/forms \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"name": "Website newsletter",
"audienceId": "<string>",
"status": "active",
"fields": [
{
"name": "email",
"label": "Email address",
"type": "email",
"required": true,
"placeholder": "you@example.com"
}
],
"settings": {
"heading": "Stay in the loop",
"description": "Get product news and updates delivered to your inbox.",
"buttonLabel": "Subscribe",
"successMessage": "You're subscribed. Thanks for joining!",
"errorMessage": "Something went wrong. Please try again.",
"requireConsent": false,
"consentLabel": "I agree to receive marketing emails. I can unsubscribe at any time.",
"redirectUrl": "<string>",
"backgroundColor": "#ffffff",
"textColor": "#111827",
"inputColor": "#ffffff",
"buttonColor": "#111827",
"buttonTextColor": "#ffffff",
"borderColor": "#d1d5db",
"borderRadius": 8,
"hideBranding": true,
"optInMode": "single",
"pendingMessage": "<string>",
"confirmationFromName": "<string>",
"confirmationFromEmail": "jsmith@example.com",
"confirmationSubject": "<string>",
"confirmationMessage": "<string>",
"confirmationButtonLabel": "<string>",
"confirmationRedirectUrl": "<string>",
"autoProtection": true
},
"turnstileEnabled": false,
"turnstileSiteKey": "<string>",
"turnstileSecretKey": "<string>"
}
EOFimport requests
url = "https://api.jetemail.com/marketing/forms"
payload = {
"name": "Website newsletter",
"audienceId": "<string>",
"status": "active",
"fields": [
{
"name": "email",
"label": "Email address",
"type": "email",
"required": True,
"placeholder": "you@example.com"
}
],
"settings": {
"heading": "Stay in the loop",
"description": "Get product news and updates delivered to your inbox.",
"buttonLabel": "Subscribe",
"successMessage": "You're subscribed. Thanks for joining!",
"errorMessage": "Something went wrong. Please try again.",
"requireConsent": False,
"consentLabel": "I agree to receive marketing emails. I can unsubscribe at any time.",
"redirectUrl": "<string>",
"backgroundColor": "#ffffff",
"textColor": "#111827",
"inputColor": "#ffffff",
"buttonColor": "#111827",
"buttonTextColor": "#ffffff",
"borderColor": "#d1d5db",
"borderRadius": 8,
"hideBranding": True,
"optInMode": "single",
"pendingMessage": "<string>",
"confirmationFromName": "<string>",
"confirmationFromEmail": "jsmith@example.com",
"confirmationSubject": "<string>",
"confirmationMessage": "<string>",
"confirmationButtonLabel": "<string>",
"confirmationRedirectUrl": "<string>",
"autoProtection": True
},
"turnstileEnabled": False,
"turnstileSiteKey": "<string>",
"turnstileSecretKey": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Website newsletter',
audienceId: '<string>',
status: 'active',
fields: [
{
name: 'email',
label: 'Email address',
type: 'email',
required: true,
placeholder: 'you@example.com'
}
],
settings: {
heading: 'Stay in the loop',
description: 'Get product news and updates delivered to your inbox.',
buttonLabel: 'Subscribe',
successMessage: 'You\'re subscribed. Thanks for joining!',
errorMessage: 'Something went wrong. Please try again.',
requireConsent: false,
consentLabel: 'I agree to receive marketing emails. I can unsubscribe at any time.',
redirectUrl: '<string>',
backgroundColor: '#ffffff',
textColor: '#111827',
inputColor: '#ffffff',
buttonColor: '#111827',
buttonTextColor: '#ffffff',
borderColor: '#d1d5db',
borderRadius: 8,
hideBranding: true,
optInMode: 'single',
pendingMessage: '<string>',
confirmationFromName: '<string>',
confirmationFromEmail: 'jsmith@example.com',
confirmationSubject: '<string>',
confirmationMessage: '<string>',
confirmationButtonLabel: '<string>',
confirmationRedirectUrl: '<string>',
autoProtection: true
},
turnstileEnabled: false,
turnstileSiteKey: '<string>',
turnstileSecretKey: '<string>'
})
};
fetch('https://api.jetemail.com/marketing/forms', 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.jetemail.com/marketing/forms",
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([
'name' => 'Website newsletter',
'audienceId' => '<string>',
'status' => 'active',
'fields' => [
[
'name' => 'email',
'label' => 'Email address',
'type' => 'email',
'required' => true,
'placeholder' => 'you@example.com'
]
],
'settings' => [
'heading' => 'Stay in the loop',
'description' => 'Get product news and updates delivered to your inbox.',
'buttonLabel' => 'Subscribe',
'successMessage' => 'You\'re subscribed. Thanks for joining!',
'errorMessage' => 'Something went wrong. Please try again.',
'requireConsent' => false,
'consentLabel' => 'I agree to receive marketing emails. I can unsubscribe at any time.',
'redirectUrl' => '<string>',
'backgroundColor' => '#ffffff',
'textColor' => '#111827',
'inputColor' => '#ffffff',
'buttonColor' => '#111827',
'buttonTextColor' => '#ffffff',
'borderColor' => '#d1d5db',
'borderRadius' => 8,
'hideBranding' => true,
'optInMode' => 'single',
'pendingMessage' => '<string>',
'confirmationFromName' => '<string>',
'confirmationFromEmail' => 'jsmith@example.com',
'confirmationSubject' => '<string>',
'confirmationMessage' => '<string>',
'confirmationButtonLabel' => '<string>',
'confirmationRedirectUrl' => '<string>',
'autoProtection' => true
],
'turnstileEnabled' => false,
'turnstileSiteKey' => '<string>',
'turnstileSecretKey' => '<string>'
]),
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.jetemail.com/marketing/forms"
payload := strings.NewReader("{\n \"name\": \"Website newsletter\",\n \"audienceId\": \"<string>\",\n \"status\": \"active\",\n \"fields\": [\n {\n \"name\": \"email\",\n \"label\": \"Email address\",\n \"type\": \"email\",\n \"required\": true,\n \"placeholder\": \"you@example.com\"\n }\n ],\n \"settings\": {\n \"heading\": \"Stay in the loop\",\n \"description\": \"Get product news and updates delivered to your inbox.\",\n \"buttonLabel\": \"Subscribe\",\n \"successMessage\": \"You're subscribed. Thanks for joining!\",\n \"errorMessage\": \"Something went wrong. Please try again.\",\n \"requireConsent\": false,\n \"consentLabel\": \"I agree to receive marketing emails. I can unsubscribe at any time.\",\n \"redirectUrl\": \"<string>\",\n \"backgroundColor\": \"#ffffff\",\n \"textColor\": \"#111827\",\n \"inputColor\": \"#ffffff\",\n \"buttonColor\": \"#111827\",\n \"buttonTextColor\": \"#ffffff\",\n \"borderColor\": \"#d1d5db\",\n \"borderRadius\": 8,\n \"hideBranding\": true,\n \"optInMode\": \"single\",\n \"pendingMessage\": \"<string>\",\n \"confirmationFromName\": \"<string>\",\n \"confirmationFromEmail\": \"jsmith@example.com\",\n \"confirmationSubject\": \"<string>\",\n \"confirmationMessage\": \"<string>\",\n \"confirmationButtonLabel\": \"<string>\",\n \"confirmationRedirectUrl\": \"<string>\",\n \"autoProtection\": true\n },\n \"turnstileEnabled\": false,\n \"turnstileSiteKey\": \"<string>\",\n \"turnstileSecretKey\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.jetemail.com/marketing/forms")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Website newsletter\",\n \"audienceId\": \"<string>\",\n \"status\": \"active\",\n \"fields\": [\n {\n \"name\": \"email\",\n \"label\": \"Email address\",\n \"type\": \"email\",\n \"required\": true,\n \"placeholder\": \"you@example.com\"\n }\n ],\n \"settings\": {\n \"heading\": \"Stay in the loop\",\n \"description\": \"Get product news and updates delivered to your inbox.\",\n \"buttonLabel\": \"Subscribe\",\n \"successMessage\": \"You're subscribed. Thanks for joining!\",\n \"errorMessage\": \"Something went wrong. Please try again.\",\n \"requireConsent\": false,\n \"consentLabel\": \"I agree to receive marketing emails. I can unsubscribe at any time.\",\n \"redirectUrl\": \"<string>\",\n \"backgroundColor\": \"#ffffff\",\n \"textColor\": \"#111827\",\n \"inputColor\": \"#ffffff\",\n \"buttonColor\": \"#111827\",\n \"buttonTextColor\": \"#ffffff\",\n \"borderColor\": \"#d1d5db\",\n \"borderRadius\": 8,\n \"hideBranding\": true,\n \"optInMode\": \"single\",\n \"pendingMessage\": \"<string>\",\n \"confirmationFromName\": \"<string>\",\n \"confirmationFromEmail\": \"jsmith@example.com\",\n \"confirmationSubject\": \"<string>\",\n \"confirmationMessage\": \"<string>\",\n \"confirmationButtonLabel\": \"<string>\",\n \"confirmationRedirectUrl\": \"<string>\",\n \"autoProtection\": true\n },\n \"turnstileEnabled\": false,\n \"turnstileSiteKey\": \"<string>\",\n \"turnstileSecretKey\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.jetemail.com/marketing/forms")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Website newsletter\",\n \"audienceId\": \"<string>\",\n \"status\": \"active\",\n \"fields\": [\n {\n \"name\": \"email\",\n \"label\": \"Email address\",\n \"type\": \"email\",\n \"required\": true,\n \"placeholder\": \"you@example.com\"\n }\n ],\n \"settings\": {\n \"heading\": \"Stay in the loop\",\n \"description\": \"Get product news and updates delivered to your inbox.\",\n \"buttonLabel\": \"Subscribe\",\n \"successMessage\": \"You're subscribed. Thanks for joining!\",\n \"errorMessage\": \"Something went wrong. Please try again.\",\n \"requireConsent\": false,\n \"consentLabel\": \"I agree to receive marketing emails. I can unsubscribe at any time.\",\n \"redirectUrl\": \"<string>\",\n \"backgroundColor\": \"#ffffff\",\n \"textColor\": \"#111827\",\n \"inputColor\": \"#ffffff\",\n \"buttonColor\": \"#111827\",\n \"buttonTextColor\": \"#ffffff\",\n \"borderColor\": \"#d1d5db\",\n \"borderRadius\": 8,\n \"hideBranding\": true,\n \"optInMode\": \"single\",\n \"pendingMessage\": \"<string>\",\n \"confirmationFromName\": \"<string>\",\n \"confirmationFromEmail\": \"jsmith@example.com\",\n \"confirmationSubject\": \"<string>\",\n \"confirmationMessage\": \"<string>\",\n \"confirmationButtonLabel\": \"<string>\",\n \"confirmationRedirectUrl\": \"<string>\",\n \"autoProtection\": true\n },\n \"turnstileEnabled\": false,\n \"turnstileSiteKey\": \"<string>\",\n \"turnstileSecretKey\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"public_id": "form_oCiNpdGJPDhgV4kFa6t1jeoF",
"form_url": "<string>"
}