Skip to main content

Welcome to the Kortix API

The Kortix API provides a RESTful interface for building AI-powered applications. Access agent execution, thread management, file uploads, and more through a unified API.

Base URLs

Kortix provides different base URLs depending on your environment:
All API requests must be made to the /v1 prefix. For example:

API Architecture

The Kortix API is built with:
  • FastAPI Framework: High-performance async Python API
  • PostgreSQL Database: Powered by Supabase with real-time capabilities
  • Redis Caching: For authentication, rate limiting, and performance optimization
  • CloudWatch Metrics: System monitoring and logging (production)

Key Features

  • Multi-tenancy: Account-based resource isolation
  • Real-time Streaming: Server-Sent Events (SSE) for agent runs
  • File Uploads: Support for multiple file types with validation
  • Webhook Integration: Trigger-based automation
  • Sandbox Execution: Isolated code execution environments

Rate Limits

The API implements several rate limiting mechanisms to ensure fair usage:

Concurrent Request Limits

integer
default:"25"
Maximum concurrent IP addresses allowed per instance
Source: api.py:69

API Key Usage Throttling

API key last_used_at timestamps are throttled to reduce database load:
integer
default:"900"
Minimum seconds between last_used_at updates (default: 15 minutes)
Source: core/services/api_keys.py:447-448

Billing-Based Limits

Rate limits vary by subscription tier:
  • Free Tier: Limited concurrent runs
  • Paid Tiers: Higher concurrency and priority execution
  • Enterprise: Custom limits
Limits are enforced at the account level and checked before agent execution.

Request Format

All requests must include proper authentication headers:

Content Types

The API accepts and returns JSON by default:
For file uploads, use multipart/form-data:

Response Format

All responses follow a consistent structure:
string
HTTP status indicator (e.g., “ok”, “error”)
object
Response payload containing requested data
string
ISO 8601 timestamp of the response

Success Response Example

See Errors for error response format.

Health Check

Monitor API health and status:

Health Response

Source: api.py:444-465

Graceful Shutdown

During deployment, the health check returns 503 when shutting down:
This ensures Kubernetes stops routing traffic before terminating the pod. Source: api.py:450-459

System Metrics

Access real-time system metrics:
integer
Total active agent runs across all instances
integer
Number of active Redis stream keys
integer
Streams without database records (should be 0)
Source: api.py:480-496

CORS Configuration

The API supports cross-origin requests from:
  • https://www.kortix.com
  • https://kortix.com
  • https://dev.kortix.com
  • https://staging.kortix.com
  • https://*.kortix.com (all subdomains)
  • https://*-kortixai.vercel.app (Vercel preview deployments)
  • http://localhost:3000 (local development)
Source: api.py:331-358

Allowed Methods

Allowed Headers

Next Steps

Authentication

Learn how to authenticate with API keys and JWT tokens

Error Handling

Understand error responses and status codes