03 · api

REST API: chat from your server

POST /api/v1/re-act-agent/chat. Keep the same sessionId for the whole conversation. From a browser, the page domain must be in the allowed domains.

  • JSON response: role, content, sessionId, toolCalls (name + output of each tool), handoff when a transfer is ongoing.
  • Send the Idempotency-Key header with the same key to retry without replaying the agent turn.
  • Errors: 400 (invalid MSISDN or message), 404 (unknown or inactive bot), 409 (message already processing), 429 (too many requests).
API — cURL
curl -X POST https://api.votredomaine.com/api/v1/re-act-agent/chat \
  -H "Content-Type: application/json" \
  -d '{
    "botId": "VOTRE_BOT_ID",
    "sessionId": "client-42-session-1",
    "msisdn": "0700000000",
    "message": "Bonjour, je veux suivre ma réclamation"
  }'
API — JavaScript (browser)
const sessionId = crypto.randomUUID(); // une fois par conversation

async function ask(message) {
  const res = await fetch("https://api.votredomaine.com/api/v1/re-act-agent/chat", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ botId: "VOTRE_BOT_ID", sessionId, msisdn: "0700000000", message }),
  });
  if (!res.ok) throw new Error((await res.json()).message);
  const { content } = await res.json();
  return content;
}
Response — JSON example
{
  "role": "assistant",
  "content": "Votre réclamation RC-2048 est en cours de traitement.",
  "sessionId": "client-42-session-1",
  "toolCalls": [
    { "name": "track_claim", "input": { "reference": "RC-2048" }, "output": "…", "status": "success" }
  ]
}

sessionId: keep the same identifier for the whole conversation (or pass autoSession: true).

Full response: role, content, sessionId, toolCalls, handoff. Replace VOTRE_BOT_ID with the real botId copied from the bot's Developer tab.

Deep Agent StudioUse cases© 2026 Deep Agent Studio