Skip to main content

Documentation Index

Fetch the complete documentation index at: https://koreai.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

The conversation API provides three interaction modes: agent-backed chat (ABL runtime execution), streaming LLM completions, and non-streaming LLM completions. All chat endpoints require authentication and enforce per-tenant rate limits (see API overview). Base path: /api/v1/chat

Agent-backed chat

Execute a message through the ABL runtime against a deployed agent project. The platform creates a session on the first call and reuses it on subsequent calls via sessionId.

POST /api/v1/chat/agent

Send a message to an agent and receive a response with full execution context including trace events and state updates. Auth required: Yes (JWT, API key, or SDK token)

Request body

FieldTypeRequiredDescription
projectIdstringYesProject containing the agent(s) to execute
messagestringYesUser message text (min 1 character)
sessionIdstringNoExisting session ID to resume. Omit to create a new session
deploymentIdstringNoSpecific deployment to target
environmentstringNoTarget environment (dev, staging, production)
agentIdstringNoOverride which agent handles the first turn
metadataobjectNoOptional per-message metadata for the current turn only
testContextobjectNoTest context for development (requires write permissions)
Test context fields (optional):
FieldTypeDescription
gatherValuesobjectPre-populated gather step values
sessionVariablesobjectInitial session variable values
callerContextobjectSimulated caller context (userId, channel, customAttributes)
toolMocksarrayMock tool responses for testing (max 50)
skipOnStartbooleanSkip the agent’s on_start handler
startAtStepstringBegin execution at a specific step

Per-message metadata

POST /api/v1/chat/agent accepts an optional metadata object for turn-scoped context:
{
  "projectId": "clx1abc2d0000ab12cd34ef56",
  "message": "Look up this account",
  "metadata": {
    "accountId": "acct_123",
    "context": { "tier": "gold" }
  }
}
Per-message metadata is validated server-side and is available only for the current turn. Use session.messageMetadata as the canonical prompt/template path. message_metadata remains available as the tool-context alias for context_access.read. If you need the data on later turns, copy the fields you care about into session state during that same turn.

Response body

FieldTypeDescription
sessionIdstringSession ID (use this for subsequent messages)
responsestringAgent’s text response
actionobjectAction metadata (e.g., { type: "continue" })
stateobjectSession state updates
traceEventsarrayExecution trace events (if any occurred)
voiceConfigobjectVoice configuration (if voice-enabled)
richContentobjectRich content variants (markdown, HTML, etc.)
actionsobjectInteractive action elements

Example request

curl -X POST https://agents.kore.ai/api/v1/chat/agent \
  -H "Authorization: Bearer abl_sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "projectId": "clx1abc2d0000ab12cd34ef56",
    "message": "I need help resetting my password"
  }'

Example response

{
  "sessionId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "response": "I can help you reset your password. Could you provide me with the email address associated with your account?",
  "action": {
    "type": "continue"
  },
  "state": {
    "currentStep": "gather-email",
    "intent": "password_reset"
  },
  "traceEvents": [
    {
      "type": "llm_call",
      "data": {
        "model": "claude-sonnet-4-20250514",
        "usage": { "inputTokens": 245, "outputTokens": 38 }
      }
    }
  ]
}

Resuming a session

Pass the sessionId from the first response to continue the conversation:
curl -X POST https://agents.kore.ai/api/v1/chat/agent \
  -H "Authorization: Bearer abl_sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "projectId": "clx1abc2d0000ab12cd34ef56",
    "sessionId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "message": "user@example.com"
  }'

Error responses

StatusErrorCause
400Invalid requestMissing required fields or validation failure
400Invalid message metadatametadata exceeds server-side validation limits
404Project not found or has no agentsInvalid projectId or project has no agent DSL
404Session not foundInvalid sessionId or cross-tenant session access
410Deployment is retiredTargeted deployment has been retired
429Session message rate limit exceededToo many messages in the session window
429Concurrent session limit exceededTenant has too many active sessions
429Execution queue fullServer execution queue is at capacity
503Runtime not configuredModel resolution or tenant credentials not set up

Streaming chat completion

Stream a chat completion with token-by-token delivery via Server-Sent Events (SSE).

POST /api/v1/chat/stream

Auth required: Yes

Request body

FieldTypeRequiredDescription
projectIdstring (CUID)YesProject ID
messagesarrayYesMessage array (min 1). See message schema below
sessionIdstringNoSession ID for rate limiting
toolsarrayNoTool definitions for function calling
modelIdstringNoOverride the project’s default model
tierstringNoModel tier: fast, balanced, or powerful
temperaturenumberNoSampling temperature (0-2)
maxTokensintegerNoMaximum output tokens (1-200,000)
Message schema:
FieldTypeRequiredDescription
rolestringYessystem, user, assistant, or tool
contentstring or arrayYesText content or multimodal content array
namestringNoName for the message author
tool_call_idstringNoID of the tool call this message responds to
tool_callsarrayNoTool calls made by the assistant
Tool schema:
FieldTypeRequiredDescription
namestringYesTool name
descriptionstringYesTool description
parametersobjectYesJSON Schema for tool parameters

SSE event types

EventDataDescription
metadata{ modelId, provider, source }Resolved model information
text_delta{ delta }Incremental text chunk
tool_call_start{ id, name }Tool call initiated
tool_call_delta{ id, arguments }Incremental tool call arguments
tool_call_end{ id, name, arguments }Tool call completed
usage{ inputTokens, outputTokens }Token usage update
error{ error }Stream error
complete{ inputTokens, outputTokens, totalTokens, estimatedCost, latencyMs }Stream finished

Example request

curl -X POST https://agents.kore.ai/api/v1/chat/stream \
  -H "Authorization: Bearer abl_sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "projectId": "clx1abc2d0000ab12cd34ef56",
    "messages": [
      { "role": "system", "content": "You are a helpful assistant." },
      { "role": "user", "content": "Explain quantum computing in one paragraph." }
    ],
    "temperature": 0.7,
    "maxTokens": 500
  }'

Example SSE response

event: metadata
data: {"modelId":"claude-sonnet-4-20250514","provider":"anthropic","source":"tenant"}

event: text_delta
data: {"delta":"Quantum computing"}

event: text_delta
data: {"delta":" leverages the principles"}

event: usage
data: {"inputTokens":42,"outputTokens":128}

event: complete
data: {"inputTokens":42,"outputTokens":128,"totalTokens":170,"estimatedCost":0.0012,"latencyMs":2340}

Non-streaming chat completion

Receive a complete chat response in a single JSON payload.

POST /api/v1/chat/complete

Auth required: Yes

Request body

Same schema as POST /api/v1/chat/stream.

Response body

FieldTypeDescription
contentstringComplete response text
toolCallsarrayTool calls (if any)
modelstringResolved model ID
finishReasonstringWhy generation stopped (e.g., end_turn, max_tokens)
usage.inputTokensnumberInput token count
usage.outputTokensnumberOutput token count
usage.totalTokensnumberTotal token count
usage.estimatedCostnumber or nullEstimated cost in USD
latencyMsnumberEnd-to-end latency in milliseconds

Example request

curl -X POST https://agents.kore.ai/api/v1/chat/complete \
  -H "Authorization: Bearer abl_sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "projectId": "clx1abc2d0000ab12cd34ef56",
    "messages": [
      { "role": "user", "content": "What is 2+2?" }
    ]
  }'

Example response

{
  "content": "2 + 2 = 4.",
  "model": "claude-sonnet-4-20250514",
  "finishReason": "end_turn",
  "usage": {
    "inputTokens": 12,
    "outputTokens": 8,
    "totalTokens": 20,
    "estimatedCost": 0.0001
  },
  "latencyMs": 450
}

Usage metrics

GET /api/v1/chat/usage

Retrieve aggregated chat usage metrics for a project. Auth required: Yes

Query parameters

ParameterTypeRequiredDescription
projectIdstringYesProject ID to query
startDatestringNoISO 8601 start date
endDatestringNoISO 8601 end date
groupBystringNoSet to model for per-model breakdown

Response body

{
  "summary": {
    "totalTokens": 125000,
    "totalCost": 4.5,
    "requestCount": 342,
    "avgLatency": 1250
  },
  "byModel": [
    {
      "modelId": "claude-sonnet-4-20250514",
      "provider": "anthropic",
      "totalTokens": 100000,
      "totalCost": 3.6,
      "requestCount": 280
    }
  ]
}

Sessions

Sessions track the conversation state for agent-backed chat interactions. Sessions are project-scoped. Base path: /api/projects/:projectId/sessions

POST /api/projects/:projectId/sessions

Create a new test session for a specific agent. Auth required: Yes Permission: session:execute

Request body

FieldTypeRequiredDescription
agentIdstringYesAgent ID or path (e.g., domain/agent-name)

Response body

{
  "success": true,
  "session": {
    "id": "sess_abc123",
    "agentId": "agent-id",
    "agentName": "support-agent",
    "createdAt": "2026-03-11T10:00:00.000Z"
  }
}

GET /api/projects/:projectId/sessions

List sessions with pagination and filtering. Auth required: Yes Permission: session:read

Query parameters

ParameterTypeDefaultDescription
limitinteger50Items per page (max 200)
offsetinteger0Items to skip
statusstringFilter by status (active, ended)
channelstringFilter by channel (api, web_debug, voice)

Response body

{
  "success": true,
  "total": 25,
  "offset": 0,
  "limit": 50,
  "sessions": [
    {
      "id": "sess_abc123",
      "runtimeSessionId": "a1b2c3d4-...",
      "agentName": "support-agent",
      "status": "active",
      "channel": "api",
      "messageCount": 12,
      "traceEventCount": 45,
      "tokenCount": 3200,
      "estimatedCost": 0.05,
      "errorCount": 0,
      "durationMs": 45000,
      "createdAt": "2026-03-11T10:00:00.000Z",
      "lastActivityAt": "2026-03-11T10:05:00.000Z"
    }
  ]
}

GET /api/projects/:projectId/sessions/:id

Get detailed information about a specific session. Auth required: Yes Permission: session:read

DELETE /api/projects/:projectId/sessions/:id

Delete a session and its associated data. Auth required: Yes

POST /api/projects/:projectId/sessions/:id/reset

Reset a session’s state, allowing the conversation to restart. Auth required: Yes

GET /api/projects/:projectId/sessions/:id/traces

Get execution trace events for a session. Auth required: Yes Permission: session:read

Query parameters

ParameterTypeDescription
eventTypestringFilter by event type
decisionKindstringFilter by decision kind
spanIdstringFilter by span ID
includestringSet to metrics to include aggregated metrics

GET /api/projects/:projectId/sessions/:id/metrics

Get aggregated metrics for a specific session. Auth required: Yes Permission: session:read

Working with attachments

Upload

curl -X POST https://agents.kore.ai/api/projects/proj_123/sessions/sess_abc123/attachments \
  -H "Authorization: Bearer your-token" \
  -F "file=@document.pdf"
Response:
{
  "success": true,
  "attachmentId": "att_abc123",
  "filename": "document.pdf",
  "mimeType": "application/pdf",
  "sizeBytes": 245760
}

Send with attachment

curl -X POST https://agents.kore.ai/api/v1/chat/send \
  -H "Authorization: Bearer your-token" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "sess_abc123",
    "message": "Please summarize this document",
    "attachmentIds": ["att_abc123"]
  }'

Retrieving conversation history

curl -X GET "https://agents.kore.ai/api/v1/sessions/sess_abc123/transcripts" \
  -H "Authorization: Bearer your-token"
Response:
{
  "success": true,
  "messages": [
    {
      "id": "msg_001",
      "role": "user",
      "content": "What are your business hours?",
      "timestamp": "2026-03-11T10:00:00Z"
    },
    {
      "id": "msg_002",
      "role": "assistant",
      "content": "Our business hours are Monday through Friday, 9 AM to 5 PM EST.",
      "timestamp": "2026-03-11T10:00:02Z"
    }
  ]
}

Providing feedback

Submit user feedback on agent responses:
curl -X POST https://agents.kore.ai/api/v1/feedback \
  -H "Authorization: Bearer your-token" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "sess_abc123",
    "messageId": "msg_002",
    "rating": "positive",
    "comment": "Accurate and helpful response"
  }'

Next steps