Update a Live Agent Inbox - Cognigy Documentation
Update a Live Agent Inbox
PATCH Request
URL: /v2.0/projects/{projectId}/setupinbox
Try it
Example 1: cURL
curl --request PATCH \
--url https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/setupinbox \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '{
"inboxId": 123
}'
Example 2: Python
import requests
url = "https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/setupinbox"
payload = { "inboxId": 123 }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)
Example 3: JavaScript (Fetch)
const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({inboxId: 123})
};
fetch('https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/setupinbox', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
Example 4: PHP
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/setupinbox",
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([
'inboxId' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Example 5: Go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/setupinbox"
payload := strings.NewReader("{\n \"inboxId\": 123\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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))
}
Response Codes
| Status Code | Description |
|---|---|
| 200 | Cognigy Live agent Inbox was successfully updated. |
| 400 | Bad Request: Validation failed. Missing payload. |
| 401 | Unauthorized: Invalid API Key. |
| 404 | Not Found: The requested resource was not found. |
| 500 | Internal Server Error: Something went wrong on the server. |
Authorization
- X-API-Key: Required in the HTTP header.
Headers
- Accept: Media type expected in response. Options:
application/json,application/xml, etc.
Path Parameters
- projectId: Required string length:
24. Pattern:^[a-z0-9]{24}$.
Body
- inboxId:
number- The unique identifier for the inbox.