Contents
On this page
Update Agent - Plugixa Chat
PUT /plugixa-chat/v1/agents/{id}
Replace an agent’s details. PUT and PATCH behave the same.
Needs Plugixa Chat Pro. The signed-in user needs the plugixa_chat_edit capability. Administrators have it.
Note. This is a full replace, even with
PATCH. A field you leave out goes back to its default:is_activebecomesfalseand the agent stops showing,hoursbecomes empty (always shown),widget_idbecomes0, androle,messageandphotoare cleared. Read the agent first with Get Agent and send every field back.
Request
PUT https://your-site.example/wp-json/plugixa-chat/v1/agents/4
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The agent’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
Yes | Shown to visitors. Up to 191 characters. |
slug |
string |
Yes | A channel from the channel catalogue that opens a link, such as whatsapp or phone. A channel that opens a panel, such as contact_form, is refused. |
value |
string |
Yes | The number, handle or address on that channel. Up to 500 characters. |
role |
string |
No | The line under the name, such as “Sales”. |
message |
string |
No | The pre-filled message, for channels that support one. Up to 500 characters. |
photo |
object |
No | An uploaded image ({"type":"upload","id":15}, which must be an image in the media library) or a library icon. Anything else is dropped. |
hours |
array |
No | When this person is shown, as weekday:start-end strings in minutes since midnight on the site’s clock, 0 for Sunday. "1:540-1080" is Monday 09:00 to 18:00. Up to 28 windows. Empty means always. |
widget_id |
integer |
No | The widget they belong to. 0 (the default) shows them on every widget. |
is_active |
boolean |
No | Whether they are shown. Left out, the agent is saved switched off. |
sort_order |
integer |
No | Position in the list. Defaults to 0. |
{
"name": "Sara",
"role": "Sales",
"slug": "whatsapp",
"value": "+15550001234",
"message": "Hi Sara, I have a question",
"hours": [
"1:540-1080",
"2:540-1080"
],
"widget_id": 0,
"is_active": true
}
Responses
200 OK. data is the updated agent.
{
"success": true,
"data": {
"id": 4,
"name": "Sara",
"role": "Sales",
"photo": null,
"slug": "whatsapp",
"value": "+15550001234",
"message": "Hi Sara, I have a question",
"hours": [
"1:540-1080",
"2:540-1080"
],
"widget_id": 0,
"is_active": true,
"sort_order": 0,
"deleted_at": null,
"created_at": "2026-11-12 09:30:00",
"modified_at": "2026-11-12 09:30:00",
"created_by": "1",
"modified_by": "1"
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The agent’s id |
data.name |
string |
The name visitors see |
data.is_active |
boolean |
Whether they are shown |
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_chat_agent_missing |
No agent has this id, or it is in the trash. |
400 |
plugixa_chat_agent_name |
name is missing or blank. |
400 |
plugixa_chat_agent_channel |
slug is not a channel that opens a link. |
400 |
plugixa_chat_agent_value |
value is missing or blank. |
Plus the errors every endpoint can return.
Examples
curl -s -X PUT "https://your-site.example/wp-json/plugixa-chat/v1/agents/4" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"name":"Sara","role":"Sales","slug":"whatsapp","value":"+15550001234","message":"Hi Sara, I have a question","hours":["1:540-1080","2:540-1080"],"widget_id":0,"is_active":true}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-chat/v1/agents/4');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Sara',
'role' => 'Sales',
'slug' => 'whatsapp',
'value' => '+15550001234',
'message' => 'Hi Sara, I have a question',
'hours' => ['1:540-1080', '2:540-1080'],
'widget_id' => 0,
'is_active' => true,
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-chat/v1/agents/4', {
method: 'PUT',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({ name: 'Sara', role: 'Sales', slug: 'whatsapp', value: '+15550001234', message: 'Hi Sara, I have a question', hours: ['1:540-1080', '2:540-1080'], widget_id: 0, is_active: true }),
});
const { data } = await response.json();
Quick Links
Share