Sulta AI/API Reference

Agent API

HTTP access to your agents — list, chat, and stream responses.

v1https://ai.sultatech.com

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/api

Authentication

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.

HeaderValue
X-API-Keysulta_sk_...
AuthorizationBearer sulta_sk_...

Keep keys secret. Do not expose them in client-side code or public repositories.

List agents

GET/api/agents

Returns all agents owned by the account tied to the supplied API key.

Request

bash
curl https://ai.sultatech.com/api/agents \
  -H "X-API-Key: sulta_sk_..."

Response

json
[
  {
    "id": "agent_abc123",
    "name": "Support Bot",
    "type": "customer_support",
    "description": "Handles tier-1 support queries.",
    "isPublic": false
  },
  { ... }
]

Send a message

POST/api/agents/chat

Send 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

ParameterTypeDescription
agentIdstringrequiredID of the agent to query. Obtain from List agents.
messagestringrequiredThe user message to send.
streambooleanoptionalWhen true the response is streamed as plain text chunks.
newChatbooleanoptionalMark the request as a new conversation for usage tracking.

cURL

bash
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

json
{
  "agentId": "agent_abc123",
  "message": "What is your return policy?",
  "stream": false,
  "newChat": true
}

Response

json
{
  "content": "Our return policy allows returns within 30 days...",
  "model": "gemini-3-flash-preview",
  "usage": {
    "inputTokens": 241,
    "outputTokens": 73,
    "totalTokens": 314
  }
}

Response fields

FieldTypeDescription
contentstringThe agent's reply.
modelstringModel identifier used to generate the response.
usage.inputTokensnumberTokens consumed by the input (prompt + context).
usage.outputTokensnumberTokens in the generated response.
usage.totalTokensnumberSum 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

js
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.

StatusMeaning
400Bad request — missing required fields in the request body.
401Missing or invalid API key.
403API key does not have access to the requested agent.
404Agent not found.
429Rate limit exceeded. Reduce request frequency and retry.
500Internal server error or model provider failure.