curl --request POST \
--url https://api.krea.ai/bots/chats \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"bot_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bot_ids": [],
"member_ids": [],
"message": "",
"title": "<string>",
"attachments": [],
"idempotency_key": "<string>"
}
'import requests
url = "https://api.krea.ai/bots/chats"
payload = {
"bot_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bot_ids": [],
"member_ids": [],
"message": "",
"title": "<string>",
"attachments": [],
"idempotency_key": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
bot_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
bot_ids: [],
member_ids: [],
message: '',
title: '<string>',
attachments: [],
idempotency_key: '<string>'
})
};
fetch('https://api.krea.ai/bots/chats', 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.krea.ai/bots/chats",
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([
'bot_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'bot_ids' => [
],
'member_ids' => [
],
'message' => '',
'title' => '<string>',
'attachments' => [
],
'idempotency_key' => '<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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.krea.ai/bots/chats"
payload := strings.NewReader("{\n \"bot_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bot_ids\": [],\n \"member_ids\": [],\n \"message\": \"\",\n \"title\": \"<string>\",\n \"attachments\": [],\n \"idempotency_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://api.krea.ai/bots/chats")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"bot_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bot_ids\": [],\n \"member_ids\": [],\n \"message\": \"\",\n \"title\": \"<string>\",\n \"attachments\": [],\n \"idempotency_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.krea.ai/bots/chats")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"bot_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bot_ids\": [],\n \"member_ids\": [],\n \"message\": \"\",\n \"title\": \"<string>\",\n \"attachments\": [],\n \"idempotency_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"chat_id": "<string>",
"title": "<string>",
"message_id": 0,
"cursor": "<string>",
"bots": [
{
"id": "<string>",
"name": "<string>",
"role": "<string>",
"description": "<string>",
"color": "<string>",
"owner": {
"id": "<string>",
"name": "<string>"
},
"is_owner": true,
"shared": true,
"status": "idle"
}
],
"url": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}Start Bot Chat
Open a chat. One bot, no title and no members: the caller’s direct chat with the bot, reused when it exists. A title, several bot_ids or any member_ids make a new group chat. A message starts the first turn, billed to the workspace’s compute units like a turn in the app. In a group it goes to the bots it names as @Name, or to the lead when it names none.
curl --request POST \
--url https://api.krea.ai/bots/chats \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"bot_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bot_ids": [],
"member_ids": [],
"message": "",
"title": "<string>",
"attachments": [],
"idempotency_key": "<string>"
}
'import requests
url = "https://api.krea.ai/bots/chats"
payload = {
"bot_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bot_ids": [],
"member_ids": [],
"message": "",
"title": "<string>",
"attachments": [],
"idempotency_key": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
bot_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
bot_ids: [],
member_ids: [],
message: '',
title: '<string>',
attachments: [],
idempotency_key: '<string>'
})
};
fetch('https://api.krea.ai/bots/chats', 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.krea.ai/bots/chats",
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([
'bot_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'bot_ids' => [
],
'member_ids' => [
],
'message' => '',
'title' => '<string>',
'attachments' => [
],
'idempotency_key' => '<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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.krea.ai/bots/chats"
payload := strings.NewReader("{\n \"bot_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bot_ids\": [],\n \"member_ids\": [],\n \"message\": \"\",\n \"title\": \"<string>\",\n \"attachments\": [],\n \"idempotency_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://api.krea.ai/bots/chats")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"bot_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bot_ids\": [],\n \"member_ids\": [],\n \"message\": \"\",\n \"title\": \"<string>\",\n \"attachments\": [],\n \"idempotency_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.krea.ai/bots/chats")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"bot_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bot_ids\": [],\n \"member_ids\": [],\n \"message\": \"\",\n \"title\": \"<string>\",\n \"attachments\": [],\n \"idempotency_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"chat_id": "<string>",
"title": "<string>",
"message_id": 0,
"cursor": "<string>",
"bots": [
{
"id": "<string>",
"name": "<string>",
"role": "<string>",
"description": "<string>",
"color": "<string>",
"owner": {
"id": "<string>",
"name": "<string>"
},
"is_owner": true,
"shared": true,
"status": "idle"
}
],
"url": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}Authorizations
Body
Several bots, for a group chat. The first leads: it answers a message that names no bot. Pass this, bot_id, or both.
20^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$People in the workspace to bring into the chat, by user id. Every bot in the chat has to be shared with the workspace, or owned by the one person it is not shared with.
50^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$A key of your choosing that names this request. Repeating the request with the same key, for example after a timeout, sends nothing again: it answers with the same chat, message and cursor as the first. A start without a message sends nothing either way, and its cursor always follows your newest message.
1 - 200Response
The chat, and where to read from.
Was this page helpful?