Create Chat
curl --request POST \
--url https://api.yourhomie.ai/v1/chats \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chatbotId": "<string>",
"userId": "<string>"
}
'import requests
url = "https://api.yourhomie.ai/v1/chats"
payload = {
"chatbotId": "<string>",
"userId": "<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({chatbotId: '<string>', userId: '<string>'})
};
fetch('https://api.yourhomie.ai/v1/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.yourhomie.ai/v1/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([
'chatbotId' => '<string>',
'userId' => '<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.yourhomie.ai/v1/chats"
payload := strings.NewReader("{\n \"chatbotId\": \"<string>\",\n \"userId\": \"<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.yourhomie.ai/v1/chats")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"chatbotId\": \"<string>\",\n \"userId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.yourhomie.ai/v1/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 \"chatbotId\": \"<string>\",\n \"userId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"chatbotId": "<string>",
"userId": "<string>",
"organizationId": "<string>",
"createdAt": "<string>"
}Chats
Chat erstellen
Starte eine neue Konversation für einen Chatbot und erhalte eine Chat-ID.
POST
/
v1
/
chats
Create Chat
curl --request POST \
--url https://api.yourhomie.ai/v1/chats \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chatbotId": "<string>",
"userId": "<string>"
}
'import requests
url = "https://api.yourhomie.ai/v1/chats"
payload = {
"chatbotId": "<string>",
"userId": "<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({chatbotId: '<string>', userId: '<string>'})
};
fetch('https://api.yourhomie.ai/v1/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.yourhomie.ai/v1/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([
'chatbotId' => '<string>',
'userId' => '<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.yourhomie.ai/v1/chats"
payload := strings.NewReader("{\n \"chatbotId\": \"<string>\",\n \"userId\": \"<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.yourhomie.ai/v1/chats")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"chatbotId\": \"<string>\",\n \"userId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.yourhomie.ai/v1/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 \"chatbotId\": \"<string>\",\n \"userId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"chatbotId": "<string>",
"userId": "<string>",
"organizationId": "<string>",
"createdAt": "<string>"
}Erstelle einen neuen Chat für einen deiner Chatbots. Die zurückgegebene
chatId brauchst du, um Nachrichten zu senden und die Konversation zu lesen.
Authentifizierung
Diese Anfrage benötigt deinen API-Key imx-api-key-Header.
Request
string
erforderlich
ID des Chatbots, zu dem der Chat gehört.
string
Optionale ID, die den Endnutzer identifiziert. Nutze sie, um einen Chat mit einem bekannten Nutzer in deinem System zu verknüpfen.
Response
string
erforderlich
ID des erstellten Chats. Verwende sie als
chatId in späteren Anfragen.string
erforderlich
ID des Chatbots, zu dem der Chat gehört.
string
erforderlich
ID des verknüpften Endnutzers.
string
erforderlich
ID der Organisation, der der Chat gehört.
string
erforderlich
ISO-8601-Zeitstempel, wann der Chat erstellt wurde.
Beispiele
curl -X POST https://api.yourhomie.ai/v1/chats \
-H "x-api-key: homie_sk_live_8f3a..." \
-H "Content-Type: application/json" \
-d '{
"chatbotId": "5e9c1a2b-3d4e-4f60-b2f2-9f4b1c2d3e4f"
}'
const res = await fetch("https://api.yourhomie.ai/v1/chats", {
method: "POST",
headers: {
"x-api-key": "homie_sk_live_8f3a...",
"Content-Type": "application/json",
},
body: JSON.stringify({
chatbotId: "5e9c1a2b-3d4e-4f60-b2f2-9f4b1c2d3e4f",
}),
});
const chat = await res.json();
Erfolgreiche Response
{
"id": "ab12cd34-ef56-7890-ab12-cd34ef567890",
"chatbotId": "5e9c1a2b-3d4e-4f60-b2f2-9f4b1c2d3e4f",
"userId": "7c2f9d10-4a6b-4c8e-9f1a-2b3c4d5e6f70",
"organizationId": "11111111-2222-3333-4444-555555555555",
"createdAt": "2025-10-16T11:44:41.140Z"
}
Fehler-Response
{
"message": "Invalid API key"
}
Autorisierungen
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.