Create session
curl --request POST \
--url https://your-instance.example.com/api/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "default",
"config": {},
"start": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'default', config: {}, start: true})
};
fetch('https://your-instance.example.com/api/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://your-instance.example.com/api/sessions"
payload = {
"name": "default",
"config": {},
"start": 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://your-instance.example.com/api/sessions"
payload := strings.NewReader("{\n \"name\": \"default\",\n \"config\": {},\n \"start\": 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://your-instance.example.com/api/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([
'name' => 'default',
'config' => [
],
'start' => 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;
}{
"config": {},
"createdAt": "<string>",
"name": "<string>",
"proxy": "<string>",
"runnerId": "<string>",
"status": "<string>",
"statusReason": "<string>",
"tenantId": "<string>",
"updatedAt": "<string>"
}{
"docs": "https://docs.polymorfa.com/api/messages/send",
"error": "missing required field: chatId"
}{
"error": "missing or invalid API key"
}{
"error": "insufficient scope: messages:write"
}{
"docs": "https://docs.polymorfa.com/api/sessions",
"error": "session already exists"
}{
"error": "internal server error"
}{
"docs": "<string>",
"error": "<string>"
}sessions
Create session
Creates a new WhatsApp session. Optionally starts it immediately.
POST
/
api
/
sessions
Create session
curl --request POST \
--url https://your-instance.example.com/api/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "default",
"config": {},
"start": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'default', config: {}, start: true})
};
fetch('https://your-instance.example.com/api/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://your-instance.example.com/api/sessions"
payload = {
"name": "default",
"config": {},
"start": 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://your-instance.example.com/api/sessions"
payload := strings.NewReader("{\n \"name\": \"default\",\n \"config\": {},\n \"start\": 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://your-instance.example.com/api/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([
'name' => 'default',
'config' => [
],
'start' => 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;
}{
"config": {},
"createdAt": "<string>",
"name": "<string>",
"proxy": "<string>",
"runnerId": "<string>",
"status": "<string>",
"statusReason": "<string>",
"tenantId": "<string>",
"updatedAt": "<string>"
}{
"docs": "https://docs.polymorfa.com/api/messages/send",
"error": "missing required field: chatId"
}{
"error": "missing or invalid API key"
}{
"error": "insufficient scope: messages:write"
}{
"docs": "https://docs.polymorfa.com/api/sessions",
"error": "session already exists"
}{
"error": "internal server error"
}{
"docs": "<string>",
"error": "<string>"
}Authorizations
Scoped API key created via POST /api/account/keys.
Body
application/json
Session parameters
Response
Created
Session configuration as JSON
When the session was created
Session identifier (e.g. "default")
HTTP/HTTPS proxy URL for WhatsApp connections
Runner pod currently managing this session
Current status: CONNECTING, CONNECTED, or DISCONNECTED
Reason for the current status (e.g. SCAN_QR, FAILED, LOGGED_OUT)
Tenant that owns this session
When the session was last updated