Restart the session
curl --request POST \
--url https://{host}/api/sessions/{session}/restart \
--header 'apikey: <api-key>'import requests
url = "https://{host}/api/sessions/{session}/restart"
headers = {"apikey": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {apikey: '<api-key>'}};
fetch('https://{host}/api/sessions/{session}/restart', 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://{host}/api/sessions/{session}/restart",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"apikey: <api-key>"
],
]);
$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://{host}/api/sessions/{session}/restart"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("apikey", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{host}/api/sessions/{session}/restart")
.header("apikey", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/sessions/{session}/restart")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Session restarted successfully",
"session": "my-session"
}
Sessions
Restart Session
Restart an existing WhatsApp session
POST
/
api
/
sessions
/
{session}
/
restart
Restart the session
curl --request POST \
--url https://{host}/api/sessions/{session}/restart \
--header 'apikey: <api-key>'import requests
url = "https://{host}/api/sessions/{session}/restart"
headers = {"apikey": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {apikey: '<api-key>'}};
fetch('https://{host}/api/sessions/{session}/restart', 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://{host}/api/sessions/{session}/restart",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"apikey: <api-key>"
],
]);
$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://{host}/api/sessions/{session}/restart"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("apikey", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{host}/api/sessions/{session}/restart")
.header("apikey", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/sessions/{session}/restart")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Session restarted successfully",
"session": "my-session"
}
Description
This endpoint restarts an existing WhatsApp session. It is useful for applying new configurations or resolving connection issues. The session will be stopped and started again with the provided configurations (or default configurations, if not provided).URL Parameters
string
required
Unique session ID to be restarted
Body
{
"config": {
"store": {
"dialect": "sqlite3",
"address": "/app/data/whatsmeow.db"
},
"log": {
"level": "INFO"
}
}
}
Body Parameters
| Property | Type | Required | Description |
|---|---|---|---|
config | object | ❌ No | Optional session configurations |
config.store | object | ❌ No | Session storage configurations |
config.store.dialect | string | ❌ No | Database type (default: “sqlite3”) |
config.store.address | string | ❌ No | Database file path (default: “/app/data/whatsmeow.db”) |
config.log | object | ❌ No | Session log configurations |
config.log.level | string | ❌ No | Log level: “DEBUG”, “INFO”, “WARN”, “ERROR” (default: “INFO”) |
{
"success": true,
"message": "Session restarted successfully",
"session": "my-session"
}
Status Codes
200- Session restarted successfully400- Invalid parameters404- Session not found
Usage Example
curl -X POST https://api.wappfy.com.br/api/sessions/my-session/restart \
-H "Content-Type: application/json" \
-d '{
"config": {
"store": {
"dialect": "sqlite3",
"address": "/app/data/whatsmeow.db"
},
"log": {
"level": "DEBUG"
}
}
}'
const session = 'my-session';
const response = await fetch(`https://api.wappfy.com.br/api/sessions/${session}/restart`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
config: {
store: {
dialect: 'sqlite3',
address: '/app/data/whatsmeow.db'
},
log: {
level: 'DEBUG'
}
}
})
});
const data = await response.json();
console.log(data);
import requests
session = 'my-session'
response = requests.post(
f'https://api.wappfy.com.br/api/sessions/{session}/restart',
json={
'config': {
'store': {
'dialect': 'sqlite3',
'address': '/app/data/whatsmeow.db'
},
'log': {
'level': 'DEBUG'
}
}
}
)
data = response.json()
print(data)
Authorizations
Your Wappfy API key (get it at dash.wappfy.com.br)
Path Parameters
The session name (instanceName) you want to restart
