Create a widget session for embedding the connect flow
curl --request POST \
--url https://api.polymorfa.com/api/widget/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "<string>",
"methods": [],
"businessName": "<string>",
"sessionName": "<string>",
"callbackUrl": "<string>",
"allowedOrigins": [
"<string>"
],
"accent": "<string>",
"prefillPhone": "<string>",
"autoSubmitPhone": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
projectId: '<string>',
methods: [],
businessName: '<string>',
sessionName: '<string>',
callbackUrl: '<string>',
allowedOrigins: ['<string>'],
accent: '<string>',
prefillPhone: '<string>',
autoSubmitPhone: true
})
};
fetch('https://api.polymorfa.com/api/widget/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/api/widget/sessions"
payload = {
"projectId": "<string>",
"methods": [],
"businessName": "<string>",
"sessionName": "<string>",
"callbackUrl": "<string>",
"allowedOrigins": ["<string>"],
"accent": "<string>",
"prefillPhone": "<string>",
"autoSubmitPhone": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.polymorfa.com/api/widget/sessions"
payload := strings.NewReader("{\n \"projectId\": \"<string>\",\n \"methods\": [],\n \"businessName\": \"<string>\",\n \"sessionName\": \"<string>\",\n \"callbackUrl\": \"<string>\",\n \"allowedOrigins\": [\n \"<string>\"\n ],\n \"accent\": \"<string>\",\n \"prefillPhone\": \"<string>\",\n \"autoSubmitPhone\": true\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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.polymorfa.com/api/widget/sessions",
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([
'projectId' => '<string>',
'methods' => [
],
'businessName' => '<string>',
'sessionName' => '<string>',
'callbackUrl' => '<string>',
'allowedOrigins' => [
'<string>'
],
'accent' => '<string>',
'prefillPhone' => '<string>',
'autoSubmitPhone' => true
]),
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;
}{
"success": true,
"data": {
"widgetUrl": "<string>",
"redirectUrl": "<string>",
"clientToken": "<string>",
"session": "<string>"
}
}{
"error": "<string>",
"docs": "<string>"
}{
"error": "<string>",
"docs": "<string>"
}{
"error": "<string>",
"docs": "<string>"
}{
"error": "<string>",
"docs": "<string>"
}{
"error": "<string>",
"docs": "<string>"
}Widget
Create a widget session for embedding the connect flow
POST
/
api
/
widget
/
sessions
Create a widget session for embedding the connect flow
curl --request POST \
--url https://api.polymorfa.com/api/widget/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "<string>",
"methods": [],
"businessName": "<string>",
"sessionName": "<string>",
"callbackUrl": "<string>",
"allowedOrigins": [
"<string>"
],
"accent": "<string>",
"prefillPhone": "<string>",
"autoSubmitPhone": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
projectId: '<string>',
methods: [],
businessName: '<string>',
sessionName: '<string>',
callbackUrl: '<string>',
allowedOrigins: ['<string>'],
accent: '<string>',
prefillPhone: '<string>',
autoSubmitPhone: true
})
};
fetch('https://api.polymorfa.com/api/widget/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/api/widget/sessions"
payload = {
"projectId": "<string>",
"methods": [],
"businessName": "<string>",
"sessionName": "<string>",
"callbackUrl": "<string>",
"allowedOrigins": ["<string>"],
"accent": "<string>",
"prefillPhone": "<string>",
"autoSubmitPhone": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.polymorfa.com/api/widget/sessions"
payload := strings.NewReader("{\n \"projectId\": \"<string>\",\n \"methods\": [],\n \"businessName\": \"<string>\",\n \"sessionName\": \"<string>\",\n \"callbackUrl\": \"<string>\",\n \"allowedOrigins\": [\n \"<string>\"\n ],\n \"accent\": \"<string>\",\n \"prefillPhone\": \"<string>\",\n \"autoSubmitPhone\": true\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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.polymorfa.com/api/widget/sessions",
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([
'projectId' => '<string>',
'methods' => [
],
'businessName' => '<string>',
'sessionName' => '<string>',
'callbackUrl' => '<string>',
'allowedOrigins' => [
'<string>'
],
'accent' => '<string>',
'prefillPhone' => '<string>',
'autoSubmitPhone' => true
]),
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;
}{
"success": true,
"data": {
"widgetUrl": "<string>",
"redirectUrl": "<string>",
"clientToken": "<string>",
"session": "<string>"
}
}{
"error": "<string>",
"docs": "<string>"
}{
"error": "<string>",
"docs": "<string>"
}{
"error": "<string>",
"docs": "<string>"
}{
"error": "<string>",
"docs": "<string>"
}{
"error": "<string>",
"docs": "<string>"
}Authorizations
Polymorfa organization key (titan_ prefix), project token (titan_pt_ prefix), or client token (titan_ct_ prefix), where the operation permits that audience.
Body
application/json
Available options:
embedded, redirect Available options:
qr, pairing, cloud-api Minimum string length:
1Available options:
force_on, force_off, ask Available options:
light, dark, system Pattern:
^#[0-9a-fA-F]{6}$Pattern:
^\+?\d{6,15}$Show child attributes
Show child attributes
Show child attributes
Show child attributes