Agents
Update an agent
Partial update: only the fields sent change (PUT is accepted too).
PATCH
/
agents
/
{id}
Update an agent
curl --request PATCH \
--url https://shortext.ny-corp.io/api/v2.0/agents/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"active": true,
"use_ai": true,
"inactive_message": "<string>",
"instructions": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://shortext.ny-corp.io/api/v2.0/agents/{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([
'name' => '<string>',
'active' => true,
'use_ai' => true,
'inactive_message' => '<string>',
'instructions' => '<string>'
]),
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;
}const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
active: true,
use_ai: true,
inactive_message: '<string>',
instructions: '<string>'
})
};
fetch('https://shortext.ny-corp.io/api/v2.0/agents/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://shortext.ny-corp.io/api/v2.0/agents/{id}"
payload = {
"name": "<string>",
"active": True,
"use_ai": True,
"inactive_message": "<string>",
"instructions": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"success": true,
"code": 1000,
"message": "Request success.",
"body": {
"id": "AGI-XXXXX",
"name": "Support",
"active": true,
"use_ai": true,
"inactive_message": "<string>",
"instructions": "<string>",
"channels": [
{
"type": "whatsapp",
"id": "532867649916076",
"name": "+237 6 99 99 99 99 (Acme)",
"enabled": true,
"agent": {
"id": "AGI-XXXXX",
"name": "<string>"
},
"settings": {
"client_type": "server",
"inbound_url": "<string>",
"reply_mode": "async",
"sync_timeout": 123,
"webhook_url": "<string>",
"username": "<string>",
"bot_url": "https://t.me/AcmeBot",
"receiving": true,
"last_error": "<string>"
},
"created_at": "2023-11-07T05:31:56Z"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"token": "<string>",
"trace_id": "<string>"
}Authorizations
Body
application/json
Response
200 - application/json
Always HTTP 200: the outcome is in success and code (absolute value of the response code).
⌘I
Update an agent
curl --request PATCH \
--url https://shortext.ny-corp.io/api/v2.0/agents/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"active": true,
"use_ai": true,
"inactive_message": "<string>",
"instructions": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://shortext.ny-corp.io/api/v2.0/agents/{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([
'name' => '<string>',
'active' => true,
'use_ai' => true,
'inactive_message' => '<string>',
'instructions' => '<string>'
]),
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;
}const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
active: true,
use_ai: true,
inactive_message: '<string>',
instructions: '<string>'
})
};
fetch('https://shortext.ny-corp.io/api/v2.0/agents/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://shortext.ny-corp.io/api/v2.0/agents/{id}"
payload = {
"name": "<string>",
"active": True,
"use_ai": True,
"inactive_message": "<string>",
"instructions": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"success": true,
"code": 1000,
"message": "Request success.",
"body": {
"id": "AGI-XXXXX",
"name": "Support",
"active": true,
"use_ai": true,
"inactive_message": "<string>",
"instructions": "<string>",
"channels": [
{
"type": "whatsapp",
"id": "532867649916076",
"name": "+237 6 99 99 99 99 (Acme)",
"enabled": true,
"agent": {
"id": "AGI-XXXXX",
"name": "<string>"
},
"settings": {
"client_type": "server",
"inbound_url": "<string>",
"reply_mode": "async",
"sync_timeout": 123,
"webhook_url": "<string>",
"username": "<string>",
"bot_url": "https://t.me/AcmeBot",
"receiving": true,
"last_error": "<string>"
},
"created_at": "2023-11-07T05:31:56Z"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"token": "<string>",
"trace_id": "<string>"
}