Office SDK
Examples
Practical examples for using the Office API
Check Office Health
curl https://chat.arinova.ai/api/office/healthconst res = await fetch("https://chat.arinova.ai/api/office/health");
const data = await res.json();
console.log("Connected:", data.connected);Get Office Status
curl -H "Cookie: session=YOUR_SESSION" \
https://chat.arinova.ai/api/office/statusconst res = await fetch("https://chat.arinova.ai/api/office/status", {
credentials: "include",
});
const { connected, agents } = await res.json();
console.log(`Office ${connected ? "online" : "offline"}, ${agents.length} agents`);Stream Agent Updates (SSE)
curl -N -H "Cookie: session=YOUR_SESSION" \
https://chat.arinova.ai/api/office/streamconst eventSource = new EventSource(
"https://chat.arinova.ai/api/office/stream",
{ withCredentials: true }
);
eventSource.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log("Office update:", data);
};
eventSource.onerror = () => {
console.error("SSE connection lost");
};Upload a Theme
curl -X POST \
-H "Cookie: session=YOUR_SESSION" \
-F 'manifest={"id":"cozy-office","name":"Cozy Office","version":"1.0.0","zones":[{}],"layers":[{}],"characters":{}}' \
-F "bundle=@theme-assets.zip" \
https://chat.arinova.ai/api/themes/uploadconst manifest = JSON.stringify({
id: "cozy-office",
name: "Cozy Office",
version: "1.0.0",
zones: [{ /* zone config */ }],
layers: [{ /* layer config */ }],
characters: { /* character config */ },
});
const form = new FormData();
form.append("manifest", manifest);
form.append("bundle", bundleFile); // File or Blob
const res = await fetch("https://chat.arinova.ai/api/themes/upload", {
method: "POST",
credentials: "include",
body: form,
});
const { themeId, name, version } = await res.json();
console.log(`Uploaded theme: ${name} v${version}`);List Themes
curl -H "Cookie: session=YOUR_SESSION" \
https://chat.arinova.ai/api/themesconst res = await fetch("https://chat.arinova.ai/api/themes", {
credentials: "include",
});
const { themes } = await res.json();
for (const theme of themes) {
console.log(`${theme.name} (${theme.renderer}) v${theme.version}`);
}Manage Slot Bindings
Get bindings for a theme
curl -H "Cookie: session=YOUR_SESSION" \
"https://chat.arinova.ai/api/office/bindings?themeId=cozy-office"Assign an agent to a slot
curl -X PUT \
-H "Cookie: session=YOUR_SESSION" \
-H "Content-Type: application/json" \
-d '{"themeId":"cozy-office","slotIndex":0,"agentId":"AGENT_UUID"}' \
https://chat.arinova.ai/api/office/bindingsRemove a binding
curl -X DELETE \
-H "Cookie: session=YOUR_SESSION" \
https://chat.arinova.ai/api/office/bindings/cozy-office/0// Full binding management flow
const API = "https://chat.arinova.ai/api";
const opts = { credentials: "include" as const };
// List current bindings
const bindings = await fetch(
`${API}/office/bindings?themeId=cozy-office`,
opts
).then((r) => r.json());
console.log("Current bindings:", bindings);
// Assign agent to slot 0
await fetch(`${API}/office/bindings`, {
...opts,
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
themeId: "cozy-office",
slotIndex: 0,
agentId: "your-agent-uuid",
}),
});
// Remove agent from slot 0
await fetch(`${API}/office/bindings/cozy-office/0`, {
...opts,
method: "DELETE",
});Delete a Theme
curl -X DELETE \
-H "Cookie: session=YOUR_SESSION" \
https://chat.arinova.ai/api/themes/cozy-officeconst res = await fetch("https://chat.arinova.ai/api/themes/cozy-office", {
method: "DELETE",
credentials: "include",
});
const { deleted } = await res.json();
console.log(`Deleted theme: ${deleted}`);