API Reference

REST API endpoints for programmatic access to Tekton AI services.

Authentication

API requests require a valid JWT token obtained via the /auth/login endpoint. Include the token in the Authorization header:

Authorization: Bearer <your-jwt-token>

API access is available on Professional and Enterprise plans.

Endpoints

POST /api/chat

Send a message to the AI assistant. Returns a Server-Sent Events (SSE) stream.

Request Body

ParameterTypeRequiredDescription
messagestringYesThe user message/prompt
documentContentstringNoDocument context for DocMan
caseDescriptionstringNoCase description for context
jsonDatastringNoJSON data for context
modelstringNoOverride the AI model
systemPromptstringNoCustom system prompt

Response (SSE stream)

data: {"type": "delta", "text": "Here is "}
data: {"type": "delta", "text": "the response..."}
data: {"type": "done"}
data: [DONE]

Example

curl -X POST http://localhost:8051/api/chat \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>" \
  -d '{"message": "Create a bar chart of sales by region"}'

POST /api/transform

Transform document content using AI. Returns an SSE stream.

ParameterTypeRequiredDescription
promptstringYesTransformation instruction
documentContentstringNoCurrent document content
modelstringNoOverride the AI model

Example

curl -X POST http://localhost:8051/api/transform \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>" \
  -d '{"prompt": "Make this more formal", "documentContent": "Hey, here is the report..."}'

POST /api/suggest

Get AI suggestions for a placeholder field. Returns JSON (not streaming).

ParameterTypeRequiredDescription
placeholderstringYesPlaceholder name (e.g., "client_name")
documentContentstringNoDocument context
caseDescriptionstringNoCase description
jsonDatastringNoCase data as JSON string

Response

{
  "suggestions": [
    "Acme Corporation",
    "Global Industries Ltd",
    "TechCorp Inc"
  ]
}

GET /api/status

Check the status of the AI backend.

Response

{
  "status": "ok",
  "backend": "claude-code",
  "version": "1.0.0",
  "model": "(default)"
}

Possible backend values: "claude-code", "direct-api"

GET /api/logs

Retrieve recent server log entries (admin only).

ParameterTypeRequiredDescription
linesnumberNoNumber of log lines to return (default: 50)

Response

{
  "logs": ["[2026-01-15T10:00:00Z] [INFO] [startup] Server started..."],
  "total": 1250
}

Error Handling

Errors return standard HTTP status codes with a JSON body:

{
  "error": "message is required"
}

Rate Limits

API rate limits depend on your plan:

Tip: Monitor your usage via the account dashboard. Rate limit headers (X-RateLimit-Remaining) are included in API responses.