Widgets
Update Widget
Updates an existing widget. All fields in the request body are optional.
PATCH
/
v1
/
widget
/
{id}
Update Widget
curl --request PATCH \
--url https://api.bland.ai/v1/widget/{id} \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"pathway_id": "<string>",
"agent_prompt": "<string>",
"allowed_domains": [
"<string>"
],
"messages_per_minute": 123,
"config": "<any>",
"agent_id": "<string>",
"webhook_url": "<string>"
}
'import requests
url = "https://api.bland.ai/v1/widget/{id}"
payload = {
"pathway_id": "<string>",
"agent_prompt": "<string>",
"allowed_domains": ["<string>"],
"messages_per_minute": 123,
"config": "<any>",
"agent_id": "<string>",
"webhook_url": "<string>"
}
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
pathway_id: '<string>',
agent_prompt: '<string>',
allowed_domains: ['<string>'],
messages_per_minute: 123,
config: '<any>',
agent_id: '<string>',
webhook_url: '<string>'
})
};
fetch('https://api.bland.ai/v1/widget/{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.bland.ai/v1/widget/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'pathway_id' => '<string>',
'agent_prompt' => '<string>',
'allowed_domains' => [
'<string>'
],
'messages_per_minute' => 123,
'config' => '<any>',
'agent_id' => '<string>',
'webhook_url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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.bland.ai/v1/widget/{id}"
payload := strings.NewReader("{\n \"pathway_id\": \"<string>\",\n \"agent_prompt\": \"<string>\",\n \"allowed_domains\": [\n \"<string>\"\n ],\n \"messages_per_minute\": 123,\n \"config\": \"<any>\",\n \"agent_id\": \"<string>\",\n \"webhook_url\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("authorization", "<authorization>")
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.patch("https://api.bland.ai/v1/widget/{id}")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"pathway_id\": \"<string>\",\n \"agent_prompt\": \"<string>\",\n \"allowed_domains\": [\n \"<string>\"\n ],\n \"messages_per_minute\": 123,\n \"config\": \"<any>\",\n \"agent_id\": \"<string>\",\n \"webhook_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v1/widget/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"pathway_id\": \"<string>\",\n \"agent_prompt\": \"<string>\",\n \"allowed_domains\": [\n \"<string>\"\n ],\n \"messages_per_minute\": 123,\n \"config\": \"<any>\",\n \"agent_id\": \"<string>\",\n \"webhook_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"pathway_id": "a0f0d4ed-f5f5-4f16-b3f9-22166594d7a7",
"agent_id": "46f37229-7d12-44be-b343-6e68274cfbea",
"allowed_domains": ["newdomain.com", "anotherdomain.com"],
"messages_per_minute": 15,
"config": {
"theme": "dark",
"position": "bottom-left",
"greeting": "Hi there! What can I do for you?",
"timeoutSeconds": 7200
},
"webhook_url": "https://example.com/conversation-webhook",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T14:22:30Z"
},
"errors": null
}
Headers
Path Parameters
Body
New widget configuration object (flexible JSON). Supports
timeoutSeconds to configure conversation timeout (default: 86400 seconds / 24 hours).New URL to receive post-conversation webhook payloads when conversations end. See Post-Conversation Webhooks for payload details.
Response
The updated widget object containing:
id(string): Widget UUIDpathway_id(string): Associated pathway UUIDagent_id(string | null): Associated agent UUID or nullallowed_domains(string[]): Array of allowed domainsmessages_per_minute(number): Rate limit for messagesconfig(object): Widget configuration objectwebhook_url(string | null): Post-conversation webhook URL or nullcreated_at(string): ISO timestampupdated_at(string): Updated ISO timestamp
{
"status": 200,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"pathway_id": "a0f0d4ed-f5f5-4f16-b3f9-22166594d7a7",
"agent_id": "46f37229-7d12-44be-b343-6e68274cfbea",
"allowed_domains": ["newdomain.com", "anotherdomain.com"],
"messages_per_minute": 15,
"config": {
"theme": "dark",
"position": "bottom-left",
"greeting": "Hi there! What can I do for you?",
"timeoutSeconds": 7200
},
"webhook_url": "https://example.com/conversation-webhook",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T14:22:30Z"
},
"errors": null
}
Docs for agents: llms.txt
Was this page helpful?
⌘I
Update Widget
curl --request PATCH \
--url https://api.bland.ai/v1/widget/{id} \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"pathway_id": "<string>",
"agent_prompt": "<string>",
"allowed_domains": [
"<string>"
],
"messages_per_minute": 123,
"config": "<any>",
"agent_id": "<string>",
"webhook_url": "<string>"
}
'import requests
url = "https://api.bland.ai/v1/widget/{id}"
payload = {
"pathway_id": "<string>",
"agent_prompt": "<string>",
"allowed_domains": ["<string>"],
"messages_per_minute": 123,
"config": "<any>",
"agent_id": "<string>",
"webhook_url": "<string>"
}
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
pathway_id: '<string>',
agent_prompt: '<string>',
allowed_domains: ['<string>'],
messages_per_minute: 123,
config: '<any>',
agent_id: '<string>',
webhook_url: '<string>'
})
};
fetch('https://api.bland.ai/v1/widget/{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.bland.ai/v1/widget/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'pathway_id' => '<string>',
'agent_prompt' => '<string>',
'allowed_domains' => [
'<string>'
],
'messages_per_minute' => 123,
'config' => '<any>',
'agent_id' => '<string>',
'webhook_url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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.bland.ai/v1/widget/{id}"
payload := strings.NewReader("{\n \"pathway_id\": \"<string>\",\n \"agent_prompt\": \"<string>\",\n \"allowed_domains\": [\n \"<string>\"\n ],\n \"messages_per_minute\": 123,\n \"config\": \"<any>\",\n \"agent_id\": \"<string>\",\n \"webhook_url\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("authorization", "<authorization>")
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.patch("https://api.bland.ai/v1/widget/{id}")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"pathway_id\": \"<string>\",\n \"agent_prompt\": \"<string>\",\n \"allowed_domains\": [\n \"<string>\"\n ],\n \"messages_per_minute\": 123,\n \"config\": \"<any>\",\n \"agent_id\": \"<string>\",\n \"webhook_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v1/widget/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"pathway_id\": \"<string>\",\n \"agent_prompt\": \"<string>\",\n \"allowed_domains\": [\n \"<string>\"\n ],\n \"messages_per_minute\": 123,\n \"config\": \"<any>\",\n \"agent_id\": \"<string>\",\n \"webhook_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"pathway_id": "a0f0d4ed-f5f5-4f16-b3f9-22166594d7a7",
"agent_id": "46f37229-7d12-44be-b343-6e68274cfbea",
"allowed_domains": ["newdomain.com", "anotherdomain.com"],
"messages_per_minute": 15,
"config": {
"theme": "dark",
"position": "bottom-left",
"greeting": "Hi there! What can I do for you?",
"timeoutSeconds": 7200
},
"webhook_url": "https://example.com/conversation-webhook",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T14:22:30Z"
},
"errors": null
}