Developer Docs · API Reference

API Reference

REST API endpoints for Condrox AI. Covers the public process, health, and creative routes, plus 24 admin endpoints for memory, knowledge, agents, pipeline, and state management.

Overview

The Condrox AI API exposes the cognitive pipeline over HTTP. It runs on FastAPI with Uvicorn. All request and response bodies use JSON.

PropertyValue
Base URLhttp://localhost:8000 (configurable)
ProtocolHTTP / HTTPS
AuthenticationAPI key via X-API-Key header
Rate limiting100 req/min global, 30 req/min for /process
Content typeapplication/json
FrameworkFastAPI with Uvicorn

Public Endpoints

POST /process

Process a natural language input through the full cognitive pipeline. This is the primary endpoint for conversational and code interactions.

Request body

{
  "text": "string",
  "context": "optional string",
  "mode": "optional string (code|analyze|architect|explain|default)"
}

Response 200

{
  "response": "string",
  "mode": "string",
  "intent": "string",
  "emotion": "string",
  "processing_time_ms": "number",
  "pipeline_stages": "array"
}

Other responses

Example

curl -X POST http://localhost:8000/process \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Explain how the pipeline works", "mode": "explain"}'

GET /health

Health check endpoint. No authentication required.

Response 200

{
  "status": "healthy",
  "version": "3.4.0",
  "uptime_seconds": "number"
}

Example

curl http://localhost:8000/health

GET /creative

Generate creative output through emotion to music mapping. Returns a music prompt and color palette derived from the input emotion.

Request body

{
  "emotion": "string",
  "text": "string"
}

Response 200

{
  "music_prompt": "string",
  "palette": "string",
  "emotion": "string"
}

Example

curl -X GET http://localhost:8000/creative \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"emotion": "curious", "text": "stars over a quiet ocean"}'

GET /

API root. Returns a listing of available endpoints.

Example

curl http://localhost:8000/

Admin Endpoints

24 endpoints for system administration. All require an admin-level API key sent in the X-API-Key header.

Health and Config

MethodPathDescription
GET/admin/healthDetailed system health
GET/admin/configCurrent configuration
PUT/admin/configUpdate configuration

Memory Management

MethodPathDescription
GET/admin/memoryList all memory items
GET/admin/memory/{key}Get specific memory item
POST/admin/memoryAdd memory item
PUT/admin/memory/{key}Update memory item
DELETE/admin/memory/{key}Delete memory item

Knowledge Management

MethodPathDescription
GET/admin/knowledgeList knowledge domains
GET/admin/knowledge/{domain}Get domain items
POST/admin/knowledgeAdd knowledge item
PUT/admin/knowledge/{id}Update knowledge item
DELETE/admin/knowledge/{id}Delete knowledge item

Agent Management

MethodPathDescription
GET/admin/agentsList all agents and their status
GET/admin/agents/{name}Get specific agent info

Pipeline Info

MethodPathDescription
GET/admin/pipelineGet pipeline stage information
GET/admin/pipeline/stagesList all 18 stages

State Management

MethodPathDescription
GET/admin/stateGet current BrainState
POST/admin/state/saveSave state to SQLite
POST/admin/state/loadLoad state from SQLite

Authentication

All protected endpoints require the X-API-Key header. Admin endpoints require an admin-level key, which grants access to the /admin/* routes.

curl -H "X-API-Key: YOUR_API_KEY" http://localhost:8000/admin/memory

Rate Limiting

Limits are applied per IP address. The /process endpoint has a tighter cap because each request runs the full 18-stage pipeline.

ScopeLimitReason
Global100 req/min per IPDefault for all routes
/process30 req/min per IPCompute-heavy pipeline
/admin/*60 req/min per IPAdministrative operations

Error Handling

Every error response follows the same shape. The error_code field is a stable machine-readable identifier.

StatusMeaningTrigger
200SuccessRequest completed
400Bad RequestMalformed JSON or missing required fields
401UnauthorizedMissing or invalid API key
404Not FoundUnknown endpoint or resource
422Unprocessable EntityValidation error
429Too Many RequestsRate limit exceeded
500Internal Server ErrorUnhandled server fault

Error response shape

{
  "detail": "string",
  "error_code": "string"
}

SDK Examples

Python (requests)

import requests

BASE_URL = "http://localhost:8000"
API_KEY = "YOUR_API_KEY"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

# Process a request
response = requests.post(
    f"{BASE_URL}/process",
    headers=headers,
    json={"text": "Explain the reasoning engine", "mode": "explain"},
)
print(response.status_code)
print(response.json())

# Health check (no auth)
health = requests.get(f"{BASE_URL}/health")
print(health.json())

# Creative output
creative = requests.get(
    f"{BASE_URL}/creative",
    headers=headers,
    json={"emotion": "curious", "text": "a quiet forest at dawn"},
)
print(creative.json())

JavaScript (fetch)

const BASE_URL = "http://localhost:8000";
const API_KEY = "YOUR_API_KEY";

const headers = {
  "X-API-Key": API_KEY,
  "Content-Type": "application/json",
};

// Process a request
fetch(`${BASE_URL}/process`, {
  method: "POST",
  headers,
  body: JSON.stringify({
    text: "Refactor this function for readability",
    mode: "code",
  }),
})
  .then((res) => res.json())
  .then((data) => console.log(data));

// Health check (no auth)
fetch(`${BASE_URL}/health`)
  .then((res) => res.json())
  .then((data) => console.log(data));

// Creative output
fetch(`${BASE_URL}/creative`, {
  method: "GET",
  headers,
  body: JSON.stringify({ emotion: "happy", text: "sunlight on water" }),
})
  .then((res) => res.json())
  .then((data) => console.log(data));

cURL

# Process
curl -X POST http://localhost:8000/process \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "What is BM25 retrieval", "mode": "explain"}'

# Health
curl http://localhost:8000/health

# Creative
curl -X GET http://localhost:8000/creative \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"emotion": "philosophical", "text": "the shape of silence"}'

# Admin: list memory
curl -H "X-API-Key: YOUR_ADMIN_KEY" http://localhost:8000/admin/memory

# Admin: list pipeline stages
curl -H "X-API-Key: YOUR_ADMIN_KEY" http://localhost:8000/admin/pipeline/stages