Sulta AI/API Reference
Agent API
HTTP access to your agents — list, chat, and stream responses.
Overview
The Sulta AI Agent API lets you list agents in your account and send messages to any agent by ID. All requests are authenticated with your account API key. Responses can be returned as a single JSON payload or streamed back as plain text using HTTP chunked transfer encoding.
Base URL
https://ai.sultatech.com/apiAuthentication
Pass your API key in the X-API-Key header. Keys are prefixed sulta_sk_ and can be generated or rotated from Settings → API keys.
| Header | Value |
|---|---|
| X-API-Key | sulta_sk_... |
| Authorization | Bearer sulta_sk_... |
Keep keys secret. Do not expose them in client-side code or public repositories.
List agents
/api/agentsReturns all agents owned by the account tied to the supplied API key.
Request
curl https://ai.sultatech.com/api/agents \
-H "X-API-Key: sulta_sk_..."Response
[
{
"id": "agent_abc123",
"name": "Support Bot",
"type": "customer_support",
"description": "Handles tier-1 support queries.",
"isPublic": false
},
{ ... }
]Send a message
/api/agents/chatSend a message to a specific agent. The agent's configured system prompt, context, guardrails, and enabled tools are applied automatically. Set stream: true to receive a streamed plain-text response.
Request body
| Parameter | Type | Description | |
|---|---|---|---|
| agentId | string | required | ID of the agent to query. Obtain from List agents. |
| message | string | required | The user message to send. |
| stream | boolean | optional | When true the response is streamed as plain text chunks. |
| newChat | boolean | optional | Mark the request as a new conversation for usage tracking. |
cURL
curl -X POST https://ai.sultatech.com/api/agents/chat \
-H "Content-Type: application/json" \
-H "X-API-Key: sulta_sk_..." \
-d '{
"agentId": "agent_abc123",
"message": "What is your return policy?",
"stream": false
}'Request body
{
"agentId": "agent_abc123",
"message": "What is your return policy?",
"stream": false,
"newChat": true
}Response
{
"content": "Our return policy allows returns within 30 days...",
"model": "gemini-3-flash-preview",
"usage": {
"inputTokens": 241,
"outputTokens": 73,
"totalTokens": 314
}
}Response fields
| Field | Type | Description |
|---|---|---|
| content | string | The agent's reply. |
| model | string | Model identifier used to generate the response. |
| usage.inputTokens | number | Tokens consumed by the input (prompt + context). |
| usage.outputTokens | number | Tokens in the generated response. |
| usage.totalTokens | number | Sum of input and output tokens. |
Streaming
Pass "stream": true to receive the response as an HTTP chunked stream. Each chunk is a plain-text fragment — concatenate them in order to reconstruct the full reply. There is no wrapper envelope or SSE framing.
JavaScript
const res = await fetch("https://ai.sultatech.com/api/agents/chat", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "sulta_sk_..."
},
body: JSON.stringify({
agentId: "agent_abc123",
message: "Summarise this month's KPIs.",
stream: true
})
});
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
const reader = res.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { value, done } = await reader.read();
if (done) break;
process.stdout.write(decoder.decode(value));
}Error codes
The API returns standard HTTP status codes. Error bodies are plain text.
| Status | Meaning |
|---|---|
| 400 | Bad request — missing required fields in the request body. |
| 401 | Missing or invalid API key. |
| 403 | API key does not have access to the requested agent. |
| 404 | Agent not found. |
| 429 | Rate limit exceeded. Reduce request frequency and retry. |
| 500 | Internal server error or model provider failure. |