Skip to content

REST API

The Komand Gateway exposes a REST API for all platform operations. All endpoints require JWT authentication (except /api/auth/* and /health) and return responses in the ApiResponse<T> envelope format.

http://localhost:5000 # Development
https://app.komand.ai # Managed cloud

All API requests (except auth endpoints) require a JWT Bearer token:

Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Tokens are obtained via the login endpoint and expire after 60 minutes. Use the refresh endpoint to obtain a new token without re-authenticating.

All endpoints return the ApiResponse<T> envelope:

{
"success": true,
"data": { ... },
"error": null,
"meta": null
}

Error responses:

{
"success": false,
"data": null,
"error": "Descriptive error message"
}

Paginated responses include metadata:

{
"success": true,
"data": [ ... ],
"error": null,
"meta": {
"total": 150,
"page": 1,
"pageSize": 50
}
}
HeaderDescription
AuthorizationBearer {token} — required for all authenticated endpoints
Content-Typeapplication/json — required for POST/PUT requests
X-Request-IdCorrelation ID for request tracing (auto-generated if not provided)

Returns the system health status. No authentication required.

Terminal window
curl http://localhost:5000/health

Authenticate with email and password. Returns a JWT token and user info.

Request:

{ "email": "[email protected]", "password": "your-password" }

Response:

{
"success": true,
"data": {
"token": "eyJhbGciOiJIUzI1NiIs...",
"refreshToken": "rt_abc123...",
"user": {
"id": "user-001",
"name": "Jane",
"email": "[email protected]",
"initials": "J"
}
}
}

Refresh an expired access token.

Request:

{ "refreshToken": "rt_abc123..." }

Response:

{
"success": true,
"data": {
"token": "eyJhbGciOiJIUzI1NiIs...",
"refreshToken": "rt_def456..."
}
}
SettingDefault
Issuerkomand.ai
Audiencekomand.ai
Token expiration60 minutes
Refresh token expiration7 days

Token claims: sub (user ID), email, name, jti (unique token ID).


Send a message through the WebChat channel. Requires authentication. The session is created automatically on first contact.

Request:

FieldTypeRequiredDefaultMax LengthDescription
senderIdstringYes128Unique user identifier
textstringYes10,000Message content
displayNamestringNonull256User display name
accountIdstringNo"default"128Account identifier
Terminal window
curl -X POST http://localhost:5000/api/webchat/message \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{ "senderId": "user-1", "text": "Hello!", "displayName": "Alice" }'

Response:

{
"success": true,
"data": {
"text": "Hi Alice! How can I help you today?",
"timestamp": "2026-02-23T10:30:02Z",
"sessionId": "WebChat:default:user-1"
}
}

Session key format: WebChat:{accountId}:{senderId}


Create or update an agent configuration. Returns 201 Created.

Request: AgentConfig object.

FieldTypeRequiredDefaultMax Length
agentIdstringYes128
namestringYes256
descriptionstringNonull1,000
systemPromptstringNo"You are a helpful enterprise AI assistant."50,000
modelProviderstringNo"anthropic"128
modelIdstringNo"claude-sonnet-4-20250514"128
maxContextTokensintNo100,000
enabledSkillIdsstring[]No[]
allowedChannelsstring[]No[]
Terminal window
curl -X POST http://localhost:5000/api/agents/ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"agentId": "sales-bot",
"name": "Sales Assistant",
"systemPrompt": "You are a friendly sales assistant.",
"enabledSkillIds": ["crm-contact-lookup"]
}'

Retrieve an agent’s configuration.

ParameterMax Length
agentId128
Terminal window
curl -H "Authorization: Bearer $TOKEN" \
http://localhost:5000/api/agents/sales-bot

GET /api/agents/{agentId}/history/{sessionId}

Section titled “GET /api/agents/{agentId}/history/{sessionId}”

Get conversation history for a session.

ParameterTypeDefaultRange
agentIdpathmax 128 chars
sessionIdpathmax 256 chars
maxTurnsquery501–500
Terminal window
curl -H "Authorization: Bearer $TOKEN" \
"http://localhost:5000/api/agents/sales-bot/history/WebChat:default:user-1?maxTurns=20"

Response:

{
"success": true,
"data": [
{
"role": "user",
"content": "What's the pricing?",
"timestamp": "2026-02-23T10:30:00Z",
"toolCallIds": null
},
{
"role": "assistant",
"content": "The Pro plan is $49/month...",
"timestamp": "2026-02-23T10:30:02Z",
"toolCallIds": ["exec-abc-123"]
}
]
}

DELETE /api/agents/{agentId}/history/{sessionId}

Section titled “DELETE /api/agents/{agentId}/history/{sessionId}”

Clear conversation history for a session. Returns 204 No Content.

Terminal window
curl -X DELETE -H "Authorization: Bearer $TOKEN" \
http://localhost:5000/api/agents/sales-bot/history/WebChat:default:user-1

Store a key-value memory entry.

Request:

{ "key": "company_timezone", "value": "Australia/Brisbane" }
FieldMax Length
key256
value100,000

Recall a memory value by key.

ParameterMax Length
key256

Response:

{
"success": true,
"data": { "key": "company_timezone", "value": "Australia/Brisbane" }
}

Get session information.

ParameterMax Length
sessionId256

Response:

{
"success": true,
"data": {
"sessionId": "WebChat:default:user-1",
"channel": "WebChat",
"channelAccountId": "default",
"senderId": "user-1",
"boundAgentId": "default",
"messageCount": 12,
"createdAt": "2026-02-23T10:00:00Z",
"lastActivityAt": "2026-02-23T10:15:30Z"
}
}

Bind an agent to a session.

Request:

{ "agentId": "sales-bot" }

End a session and clear its state. Returns 204 No Content.


Register a new skill. Returns 201 Created.

Request: SkillDefinition object (see Skills guide for the full contract). Required fields: skillId, name, version.

List skills with pagination and filtering.

ParameterTypeDefaultRangeDescription
publisherIdstringnullFilter by publisher
verifiedOnlyboolnullOnly verified skills
Terminal window
curl -H "Authorization: Bearer $TOKEN" \
"http://localhost:5000/api/skills/?verifiedOnly=true&publisherId=komand-official"

Get a skill definition.

ParameterMax Length
skillId128

Unregister a skill. Returns 204 No Content.


HTTP StatusMeaningExample
200SuccessSuccessful GET or POST
201CreatedAgent or skill created
204No ContentSuccessful DELETE
400Bad RequestValidation error (missing field, invalid range)
401UnauthorizedMissing or invalid JWT token
404Not FoundAgent, session, or skill doesn’t exist
429Too Many RequestsRate limit exceeded
504Gateway TimeoutGrain didn’t respond within 30 seconds

All route parameters and request bodies are validated at the Gateway:

ConstraintValue
Agent ID max length128 characters
Session ID max length256 characters
Skill ID max length128 characters
Memory key max length256 characters
Memory value max length100,000 characters
System prompt max length50,000 characters
WebChat text max length10,000 characters
maxTurns range1–500 (default 50)
pageSize range1–200 (default 50)
Grain call timeout30 seconds

The Gateway also exposes a SignalR hub at /hubs/chat for real-time bi-directional messaging. See Message Flow for hub methods and details.

In development mode, Swagger UI is available at /swagger for interactive API exploration. Set DOTNET_ENVIRONMENT=Development to enable.