Create a Project from a Template - Cognigy Documentation
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Create a Project from a Template
cURL
curl --request POST \
--url https://api-trial.cognigy.ai/new/v2.0/projects/createbytemplate \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "New Project",
"color": "blue",
"handoverConfiguration": {
"setupLiveAgentInbox": true
},
"locale": "en-US",
"templateConfiguration": {
"endpoints": [
{
"channel": "<string>"
}
],
"skills": [
"<string>"
],
"template": "<string>"
}
}
'
Python
import requests
url = "https://api-trial.cognigy.ai/new/v2.0/projects/createbytemplate"
payload = {
"name": "New Project",
"color": "blue",
"handoverConfiguration": { "setupLiveAgentInbox": True },
"locale": "en-US",
"templateConfiguration": {
"endpoints": [{ "channel": "<string>" }],
"skills": ["<string>"],
"template": "<string>"
}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
JavaScript (Fetch)
const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'New Project',
color: 'blue',
handoverConfiguration: {setupLiveAgentInbox: true},
locale: 'en-US',
templateConfiguration: {endpoints: [{channel: '<string>'}], skills: ['<string>'], template: '<string>'}
})
};
fetch('https://api-trial.cognigy.ai/new/v2.0/projects/createbytemplate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-trial.cognigy.ai/new/v2.0/projects/createbytemplate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'New Project',
'color' => 'blue',
'handoverConfiguration' => [
'setupLiveAgentInbox' => true
],
'locale' => 'en-US',
'templateConfiguration' => [
'endpoints' => [
[
'channel' => '<string>'
]
],
'skills' => [
'<string>'
],
'template' => '<string>'
]
]),
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;
}
?>
Response Codes
- 202 - Task to create the Project successfully created.
- 400 - Bad Request Error: Validation failed. Missing payload.
- 401 - Unauthorized Error: Invalid API Key.
- 402 - Payment Required Error: Validation failed. Missing payload.
- 403 - Forbidden Error: Access is denied.
- 404 - Not Found Error: Resource not found.
- 405 - Method Not Allowed Error: Invalid HTTP method.
- 409 - Conflict Error: Resource conflict occurred.
- 413 - Payload Too Large Error: Request entity is larger than limits.
- 500 - Internal Server Error: An unexpected error occurred.
- 503 - Service Unavailable Error: The server is currently unable to handle the request.