Create chat
curl --request POST \
--url https://macaly.com/api/chat \
--header 'Authorization: Bearer <token>'import requests
url = "https://macaly.com/api/chat"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://macaly.com/api/chat', 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://macaly.com/api/chat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://macaly.com/api/chat"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://macaly.com/api/chat")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://macaly.com/api/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyEndpoints
Create chat
Erstelle eine neue Chat-Sitzung und beginne mit KI zu erstellen
POST
/
api
/
chat
Create chat
curl --request POST \
--url https://macaly.com/api/chat \
--header 'Authorization: Bearer <token>'import requests
url = "https://macaly.com/api/chat"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://macaly.com/api/chat', 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://macaly.com/api/chat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://macaly.com/api/chat"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://macaly.com/api/chat")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://macaly.com/api/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyErstellt eine neue Chat-Sitzung und startet die KI-Verarbeitung.
JSON-Antwort (bei
Streaming-Antwort (bei
Bei aktiviertem Streaming ist die Antwort ein Textstream:
Die erste Zeile enthält die Chat-ID im Format
Anfrage
POST /api/chat
Header
| Header | Erforderlich | Beschreibung |
|---|---|---|
Authorization | Ja | Bearer macaly_... |
Content-Type | Ja | application/json |
Anfrage-Body-Parameter
| Feld | Typ | Erforderlich | Standardwert | Beschreibung |
|---|---|---|---|---|
content | string | Ja | - | Der Prompt/die Nachricht des Nutzers |
stream | boolean | Nein | true | Bei false wird JSON statt eines Streams zurückgegeben |
backend | string | Nein | "DEFAULT" | Zu verwendendes Backend |
executionMode | "auto" | "planning" | "build" | Nein | - | Bestimmt, wie die KI die Aufgabe angeht |
model | "gpt-5.6-terra" | "gpt-6.1-sol" | "gpt-6-luna" | "grok-4-6" | "kimi-k3" | "sonnet-5-5" | "opus-5-5" | "blueai-glm-5-3" | "blueai-glm-5-3-flash" | Nein | - | Zu verwendendes KI-Modell. Standardmäßig das konfigurierte Modell des Teams |
reasoningEffort | "medium" | "high" | Nein | - | Bestimmt, wie tief die KI über die Aufgabe nachdenkt |
experimental_attachments | array | Nein | [] | Dateianhänge (Format siehe unten) |
Anhang-Format
Jedes Element im Arrayexperimental_attachments hat folgende Struktur:
| Feld | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
url | string | Ja | URL der anzuhängenden Datei |
name | string | Nein | Anzeigename für den Anhang |
contentType | string | Nein | MIME-Typ der Datei |
Beispielanfrage
curl -X POST https://www.macaly.com/api/chat \
-H "Authorization: Bearer macaly_abc123..." \
-H "Content-Type: application/json" \
-d '{
"content": "Create a landing page for a coffee shop",
"stream": false
}'
const response = await fetch('https://www.macaly.com/api/chat', {
method: 'POST',
headers: {
'Authorization': 'Bearer macaly_abc123...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
content: 'Create a landing page for a coffee shop',
stream: false,
}),
});
const data = await response.json();
console.log(data.chatId);
import requests
response = requests.post(
'https://www.macaly.com/api/chat',
headers={
'Authorization': 'Bearer macaly_abc123...',
'Content-Type': 'application/json',
},
json={
'content': 'Create a landing page for a coffee shop',
'stream': False,
},
)
data = response.json()
print(data['chatId'])
Antwort
JSON-Antwort (bei stream: false)
{
"chatId": "abc123def456",
"url": "https://www.macaly.com/chat/abc123def456",
"streamId": "stream_xyz789",
"assistantMessageId": "msg_123"
}
| Feld | Typ | Beschreibung |
|---|---|---|
chatId | string | Die eindeutige Chat-Kennung |
url | string | Direkte URL zum Anzeigen des Chats |
streamId | string | undefined | Stream-Kennung zum Abonnieren. Nur bei Workflow-Backends vorhanden |
assistantMessageId | string | undefined | ID der generierten Assistant-Nachricht. Nur bei Workflow-Backends vorhanden |
Streaming-Antwort (bei stream: true, Standard)
Bei aktiviertem Streaming ist die Antwort ein Textstream:
2:[{"chatId":"abc123def456"}]
0:"Starting to build..."
...
2:[{"chatId":"..."}].
Die Chat-ID aus dem Stream parsen
const text = await response.text();
const match = text.match(/2:\[{"chatId":"([^"]+)"/);
const chatId = match?.[1];
Statuscodes
| Status | Beschreibung |
|---|---|
| 200 | Erfolgreich - Chat erstellt |
| 400 | Ungültiger Anfrage-Body |
| 401 | Ungültiger oder fehlender API-Schlüssel |
| 402 | Nicht genügend Credits |
| 403 | Zugriff verweigert - Keine Berechtigung für das angegebene Team |
| 422 | Validierungsfehler |
| 429 | Anfragelimit erreicht |
| 500 | Serverfehler |
Nächste Schritte
Nach dem Erstellen eines Chats:- Verfolge den Fortschritt über
GET /api/chat/{chatId}/status - Abonniere den Stream über
GET /api/chat/{chatId}/subscribefür Echtzeit-Updates - Sende Folgenachrichten über
POST /api/chat/{chatId}/publish
War diese Seite hilfreich?