update device
curl --request PUT \
--url https://api.chatlevel.io/v1/devices/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"webhookUrl": "<string>",
"webhookEvents": []
}
'import requests
url = "https://api.chatlevel.io/v1/devices/{id}"
payload = {
"name": "<string>",
"webhookUrl": "<string>",
"webhookEvents": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', webhookUrl: '<string>', webhookEvents: []})
};
fetch('https://api.chatlevel.io/v1/devices/{id}', 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.chatlevel.io/v1/devices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'webhookUrl' => '<string>',
'webhookEvents' => [
]
]),
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.chatlevel.io/v1/devices/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"webhookUrl\": \"<string>\",\n \"webhookEvents\": []\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.chatlevel.io/v1/devices/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"webhookUrl\": \"<string>\",\n \"webhookEvents\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chatlevel.io/v1/devices/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"webhookUrl\": \"<string>\",\n \"webhookEvents\": []\n}"
response = http.request(request)
puts response.read_body{
"device": {
"id": 12345,
"name": "Updated Device Name",
"status": "connected",
"qr": null,
"webhookUrl": "https://example.com/new-webhook",
"webhookEvents": [
"message.received"
],
"messagesSent": 150,
"subscription_status": "active",
"createdAt": "2024-01-15T10:30:00Z"
},
"status": {
"code": 200,
"message": "Device updated successfully"
}
}{
"status": {
"code": 400,
"message": "Invalid JSON format"
}
}{
"status": "error",
"error": {
"code": 401,
"message": "Missing or invalid authorization header. Please provide a Bearer token."
}
}{
"status": {
"code": 404,
"message": "Device not found"
}
}{
"status": {
"code": 408,
"message": "Request timeout"
}
}{
"status": {
"code": 413,
"message": "Request payload too large"
}
}{
"status": {
"code": 429,
"message": "Rate limit exceeded. Maximum 100 requests per minute per user."
}
}{
"status": {
"code": 500,
"message": "Internal server error"
}
}devices
update device
Update the device configuration
PUT
/
devices
/
{id}
update device
curl --request PUT \
--url https://api.chatlevel.io/v1/devices/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"webhookUrl": "<string>",
"webhookEvents": []
}
'import requests
url = "https://api.chatlevel.io/v1/devices/{id}"
payload = {
"name": "<string>",
"webhookUrl": "<string>",
"webhookEvents": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', webhookUrl: '<string>', webhookEvents: []})
};
fetch('https://api.chatlevel.io/v1/devices/{id}', 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.chatlevel.io/v1/devices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'webhookUrl' => '<string>',
'webhookEvents' => [
]
]),
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.chatlevel.io/v1/devices/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"webhookUrl\": \"<string>\",\n \"webhookEvents\": []\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.chatlevel.io/v1/devices/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"webhookUrl\": \"<string>\",\n \"webhookEvents\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chatlevel.io/v1/devices/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"webhookUrl\": \"<string>\",\n \"webhookEvents\": []\n}"
response = http.request(request)
puts response.read_body{
"device": {
"id": 12345,
"name": "Updated Device Name",
"status": "connected",
"qr": null,
"webhookUrl": "https://example.com/new-webhook",
"webhookEvents": [
"message.received"
],
"messagesSent": 150,
"subscription_status": "active",
"createdAt": "2024-01-15T10:30:00Z"
},
"status": {
"code": 200,
"message": "Device updated successfully"
}
}{
"status": {
"code": 400,
"message": "Invalid JSON format"
}
}{
"status": "error",
"error": {
"code": 401,
"message": "Missing or invalid authorization header. Please provide a Bearer token."
}
}{
"status": {
"code": 404,
"message": "Device not found"
}
}{
"status": {
"code": 408,
"message": "Request timeout"
}
}{
"status": {
"code": 413,
"message": "Request payload too large"
}
}{
"status": {
"code": 429,
"message": "Rate limit exceeded. Maximum 100 requests per minute per user."
}
}{
"status": {
"code": 500,
"message": "Internal server error"
}
}Authorizations
API key authentication. Provide your API key as: Authorization: Bearer <api_key>
Path Parameters
Device ID Numeric device identifier
Body
application/json
New name for the device
Webhook URL for receiving events (null to disable)
Events to send to webhook. See webhook documentation for event payloads.
Available options:
connection.open, connection.closed, connection.auth, connection.timeout, connection.logout, message.received, message.sent, message.updated, message.deleted, call Subscription status. When set to 'inactive', the WhatsApp session is stopped but auth data is preserved for reactivation. When set to 'active', the session is restarted.
Available options:
active, inactive ⌘I
