Home · Developers · Guides · API Reference

APIs

API Reference

REST surface conventions and shapes

This document provides a concise reference for the core public APIs in Nova Coder.

REST API Route Modules

The Nova Coder REST API is organized into modular route files for better maintainability:

routes_common.py

Common utilities shared across all route modules.

Functions:

  • success_response(data, message) - Create a success JSON response. data is included whenever it is not None, empty lists/dicts/zeros are preserved (do not re-add a falsy check; empty collections are meaningful payloads).
  • error_response(error, error_code, details, status_code) - Create an error JSON response
  • paginated_response(data, total, page, page_size) - Create a paginated JSON response
  • generate_csrf_token() - Generate a new CSRF token
  • validate_csrf_token(request) - Validate CSRF token from request
  • set_csrf_cookie(response, token, request) - Set CSRF cookie on response
  • require_csrf(func) - Decorator to require CSRF token validation
  • rate_limit(limit) - Decorator to apply rate limiting

routes_auth.py

Authentication and session management routes.

Endpoints:

  • GET /api/auth/csrf-token - Generate CSRF token
  • POST /api/auth/login - Authenticate and create session
  • POST /api/auth/logout - Clear session
  • GET /api/auth/status - Check authentication status

routes_chat.py

Chat and messaging routes.

Endpoints:

  • GET /api/chat/history - Get chat history
  • POST /api/chat - Send message to agent
  • POST /api/chat/clear - Clear chat history

routes_system.py

System status and health routes.

Endpoints:

  • GET /api/rate-limit/status - Rate limiting status
  • GET /api/rate-limit/config - Rate limiting configuration
  • GET /api/rate-limit/stats - Rate limiting statistics
  • GET /api/status - Application status
  • GET /api/health - Detailed health metrics

routes_web.py

Web UI routes.

Endpoints:

  • GET / - Serve web dashboard

routes_webhooks.py

Webhook management routes.

Endpoints:

  • POST /api/webhooks - Create webhook
  • GET /api/webhooks - List webhooks (data.webhooks + data.total)
  • GET /api/webhooks/{webhook_id} - Get webhook
  • DELETE /api/webhooks/{webhook_id} - Delete webhook
  • GET /api/webhooks/stats - Webhook statistics

routes_ai.py

AI system features routes.

Endpoints:

  • POST /api/ai/multimodal/process - Process multimodal messages
  • GET /api/ai/multimodal/config - Multimodal configuration
  • POST /api/ai/multimodal/enable - Enable multimodal
  • POST /api/ai/multimodal/disable - Disable multimodal
  • GET /api/ai/systems/status - AI systems status
  • POST /api/ai/batch/request - Add batch request
  • POST /api/ai/batch/process - Process batch
  • GET /api/ai/batch/metrics - Batch metrics
  • POST /api/ai/error-handling/fallback - Register fallback provider
  • POST /api/ai/error-handling/circuit-breaker/reset - Reset circuit breaker
  • POST /api/ai/rag/store - Store RAG document
  • GET /api/ai/rag/search - Search RAG store
  • GET /api/ai/rag/documents - List RAG documents
  • DELETE /api/ai/rag/documents/{key} - Delete RAG document
  • POST /api/ai/rag/clear - Clear RAG store
  • POST /api/ai/rag/generate - Generate RAG response

routes_agents.py

Agent management routes.

Endpoints:

  • GET /api/agents - List agents (paginated)
  • POST /api/agents/run - Run agent task
  • GET /api/agent-features/config - Get features configuration
  • POST /api/agent-features/config - Update features configuration
  • GET /api/agent-features/status - Get features status
  • POST /api/agent-features/enable - Enable feature
  • POST /api/agent-features/disable - Disable feature

For detailed information about the modular route system, see API Modular Routes.

Kernel

NovaService

class NovaService(ABC):
    name: str

    def initialize(self) -> None
    def start(self) -> None
    def stop(self) -> None
    def dispose(self) -> None
    def health(self) -> ServiceHealth

Container

Method Description
register(key, factory, singleton=True) Register a service
register_instance(key, instance) Register an existing instance
resolve(key) Retrieve a service
is_registered(key) Check if a service exists
clear() Remove all registrations

EventBus

Method Description
subscribe(event_name, handler) Register an event handler
unsubscribe(event_name, handler) Remove an event handler
subscribe_with_filter(filter_func, handler) Register a filtered event handler
unsubscribe_with_filter(filter_func, handler) Remove a filtered event handler
add_router(router_func) Add an event router
remove_router(router_func) Remove an event router
publish(event) Publish an event synchronously
publish_async(event) Publish an event asynchronously
get_history(event_name=None) Return recent published events
clear_history() Clear event history

Registry

Method Description
register_instance(name, instance) Register a service instance
register_type(name, service_type) Register a service class
get(name) Get an instance by name
get_type(name) Get a class by name
create(name, *args, **kwargs) Create a new instance
list_services() List registered instance names
list_types() List registered type names

HealthMonitor

Method Description
add_check(name, check) Register a health check
evaluate(services) Evaluate overall health
last_report() Get most recent health report
get_history(limit=None) Get health history
get_service_history(service_name) Get service-specific history
get_alerts(severity=None, limit=None) Get alerts
get_health_trend(hours) Get health trend
add_alert_callback(callback) Register alert callback
save_history(file_path) Save history to file
load_history(file_path) Load history from file

ServiceMesh

Method Description
register_service(instance) Register a service instance
unregister_service(service_name, instance_id) Unregister a service instance
get_service_instances(service_name) Get all instances of a service
get_healthy_instances(service_name) Get only healthy instances
select_instance(service_name) Select an instance using load balancing
health_check(service_name, health_check_func) Perform health checks
record_request(service_name, success, latency_ms) Record request metrics
get_metrics(service_name) Get metrics for a service
get_all_metrics() Get metrics for all services
set_load_balancing(strategy) Set load balancing strategy
get_mesh_status() Get overall mesh status
reset_metrics(service_name=None) Reset metrics

EventSourcingService

Method Description
save_event(event) Save an event and notify handlers
replay_events(aggregate_id, from_version=None) Replay events for an aggregate
reconstruct_state(aggregate, from_version=None) Reconstruct aggregate state from events
register_event_handler(event_type, handler) Register an event handler
get_event_store() Get the event store
save_to_file(file_path) Save event store to file
load_from_file(file_path) Load event store from file
get_aggregate_version(aggregate_id) Get aggregate version
create_snapshot(aggregate) Create and save a snapshot
get_all_events() Get all events in the store

LifecycleManager

Method Description
set_startup_order(order) Define service startup order
initialize_all() Initialize all services in order
start_all() Start all services in order
stop_all() Stop all services in reverse order

Runtime

RuntimeService

class RuntimeService(NovaService):
    def initialize(self) -> None
    def start(self) -> None
    def stop(self) -> None
    def health(self) -> ServiceHealth
    async def stream(self, prompt: str, provider_name: str | None = None, ...) -> AsyncIterator[str]
    def session(self, prompt: str, provider_name: str | None = None, ...) -> StreamingSession

Resolves AIService from the container and exposes two streaming entry points:

  • stream(), async iterator that yields tokens as they are produced
  • session(), returns a StreamingSession that captures tokens and final text

StreamingSession

class StreamingSession:
    async def __aiter__(self) -> AsyncIterator[str]
    def text(self) -> str
    @property
    def tokens(self) -> list[str]

stream_tokens

async def stream_tokens(provider: AIProvider, messages: list[ChatMessage]) -> AsyncIterator[str]

See Runtime Streaming for full documentation and usage examples.

Application

NovaApplication

Method Description
initialize() Build and wire all services
start() Initialize and start all services
run() Start and keep alive
stop() Stop and dispose all services
health() Return health report
status() Return status summary
is_running() Check if running

create_app

def create_app(
    project_path: Path | str | None = None,
    overrides: dict[str, Any] | None = None,
) -> NovaApplication

Configuration

AppConfig

class AppConfig(BaseSettings):
    app_name: str
    version: str
    data_dir: str
    model: ModelConfig
    workspace: WorkspaceConfig
    memory: MemoryConfig
    tools: ToolsConfig
    agents: AgentsConfig
    plugins: PluginsConfig
    api: ApiConfig
    logging: LoggingConfig

ApiConfig

class ApiConfig(BaseModel):
    host: str = "0.0.0.0"
    port: int = 8000
    token: str | None = None

Controls REST API settings. host and port configure the bind address for novacoder serve. Set NOVACODER_API__TOKEN to require the X-API-Token header for all /api/* endpoints.

PluginsConfig

class PluginsConfig(BaseModel):
    plugins_dir: str | None = None
    enabled: bool = True

Controls plugin discovery. plugins_dir is an optional directory path for local plugins. enabled toggles plugin loading entirely.

ConfigLoader

Method Description
load(overrides=None) Load merged configuration
load_from_file(path) Load from a single file

AI Runtime

AIProvider

class AIProvider(ABC):
    @property
    def capabilities(self) -> ProviderCapabilities
    async def chat(self, messages, **kwargs) -> str
    async def complete(self, prompt, **kwargs) -> str
    async def stream(self, messages, **kwargs) -> AsyncIterator[str]
    async def embed(self, text, **kwargs) -> list[float]
    async def available_models(self) -> list[str]
    async def health_check(self) -> dict

ProviderManager

Method Description
register(name, provider_type) Register a provider class
load(name, **kwargs) Create or return a provider
get(name) Return existing provider
list_providers() List registered providers

ModelRouter

Method Description
select(task, **kwargs) Select provider by task
auto_select(task, context_length) Heuristic selection

Agents

Agent

class Agent(ABC):
    name: str
    description: str
    async def run(self, task: AgentTask) -> AgentResult

AgentTask

@dataclass
class AgentTask:
    id: str
    description: str
    goal: str
    context: dict[str, Any]
    priority: int

AgentResult

@dataclass
class AgentResult:
    success: bool
    output: Any | None
    summary: str
    errors: list[str]

AgentManager

Method Description
register(agent) Register an agent
get(name) Get an agent by name
list_agents() List registered agents
run(name, task) Execute a task with an agent
describe_all() Return agent metadata

Tools

Tool

class Tool(ABC):
    name: str
    description: str
    parameters: list[ToolParameter]
    permissions: list[str]
    def run(self, **kwargs) -> ToolResult
    async def arun(self, **kwargs) -> ToolResult
    def to_dict(self) -> dict

ToolResult

@dataclass
class ToolResult:
    success: bool
    output: Any | None
    error: str | None

ToolRegistry

Method Description
register(tool) Register a tool
unregister(name) Remove a tool
get(name) Get a tool by name
list_tools() List registered tools
execute(name, **kwargs) Execute a tool
describe_all() Return tool metadata

Workspace

ProjectScanner

Method Description
scan() Scan the project directory
get_files() Return indexed files
summary() Return project summary

SymbolExtractor

Method Description
extract(path) Extract symbols from a file

SymbolIndex

Method Description
add(symbols) Add symbols
find(name, kind) Find symbols
find_by_file(path) Symbols from a file
clear() Clear index

Memory

MemoryStore

Method Description
initialize() Create tables
close() Close connection
set(key, value, scope) Store value
get(key, scope) Retrieve value
get_all(scope) Retrieve all values
delete(key, scope) Delete value

MemoryScope

  • SESSION
  • WORKING
  • PROJECT
  • PERSISTENT
  • AGENT

Plugins

Plugin

class Plugin(ABC):
    name: str
    version: str
    def initialize(self) -> None
    def shutdown(self) -> None
    def register_tools(self) -> list[Tool]
    def register_agents(self) -> list[Agent]
    def register_providers(self) -> list[AIProvider]
    def register_extractors(self) -> dict[str, LanguageExtractor]
    def register_workflows(self) -> list[Plan]
    def register_commands(self) -> list[dict[str, Any]]
    def to_dict(self) -> dict

PluginService

Method Description
register(plugin) Register a plugin
list_plugins() List plugin metadata

Maintaining This Reference

When adding, removing, or changing a public API:

  1. Update the relevant section in this document.
  2. Keep signatures consistent with the source code.
  3. Add new sections for new subsystems.
  4. Cross-link related subsystem documentation.
  5. Verify that code examples still compile and run.

REST API Endpoints

Dashboard API

Endpoint Method Description
/api/dashboard GET Get system overview and statistics
/api/dashboard/stats GET Get detailed dashboard statistics
/api/dashboard/notifications GET Get system notifications, alerts, and updates

Planner API

Endpoint Method Description
/api/plan POST Generate execution plan from goal
/api/plan/execute POST Execute a previously generated plan
/api/plan/history GET Get history of previously generated plans
/api/plan/validate POST Validate plan structure and resource availability

Editor API

Endpoint Method Description
/api/editor/file GET Read file content
/api/editor/file POST Create new file
/api/editor/file PUT Update existing file
/api/editor/file DELETE Delete file
/api/editor/search GET Search code across files in workspace
/api/editor/symbols GET Extract code symbols from a file
/api/editor/format POST Format code in a file
/api/editor/collaborate POST Handle real-time collaboration events

Monitoring API

Endpoint Method Description
/api/monitoring/metrics GET Get system metrics
/api/monitoring/alerts GET Get monitoring alerts

Analytics API

Endpoint Method Description
/api/analytics/usage GET Get usage analytics
/api/analytics-api/performance GET Get performance analytics
/api/analytics/forecast POST Auto-train + forecast a metric series
/api/analytics/models GET/POST List / register prediction models
/api/analytics/models/{id}/train POST Train a registered model
/api/analytics/models/{id}/predict POST Predict N points ahead
/api/analytics/models/{id} DELETE Remove a prediction model
/api/analytics/report-templates GET List report templates
/api/analytics/reports POST Generate a report (template or custom; optional format render)
/api/analytics/export POST Export a dataset (json/csv/xml)
/api/analytics/exports GET List export jobs
/api/analytics/exports/{id} GET Get export status
/api/analytics/exports/cleanup POST Remove old export records

CI/CD API

Endpoint Method Description
/api/cicd/pipelines GET List CI/CD pipelines
/api/cicd/pipelines POST Create new pipeline (CI-CD system)
/api/cicd/pipelines/{pipeline_id}/run POST Execute pipeline
/api/cicd/runs GET List pipeline runs

Distributed API

Endpoint Method Description
/api/distributed/nodes GET List distributed nodes
/api/distributed/statistics GET Get distributed system statistics

Security API

Endpoint Method Description
/api/security/rules GET List security rules
/api/security/scan POST Scan code for security issues
/api/security/statistics GET Get security statistics
/api/security/zero-trust/identities GET List zero trust identities
/api/security/zero-trust/devices GET List zero trust devices
/api/security/zero-trust/access-request POST Submit zero-trust access request
/api/security/zero-trust/statistics GET Get zero trust statistics
/api/security/ml-threats/predict POST Run ML threat prediction (list: GET /api/security/ml-threats/models)
/api/security/ml-threats/statistics GET Get ML threat statistics
/api/security/behavioral/statistics GET Behavioral analysis statistics (events/alerts/record also available)
/api/security/behavioral/alerts GET List behavioral alerts
/api/security/behavioral/statistics GET Get behavioral analysis statistics
/api/security/automation/rules GET List automation rules
/api/security/automation/statistics GET Automation statistics (rules/process-event also available)
/api/security/automation/statistics GET Get automation statistics
/api/security/supply-chain/sboms GET List Software Bill of Materials
/api/security/supply-chain/sboms POST Generate Software Bill of Materials
/api/security/supply-chain/sboms/{sbom_id}/analyze GET Analyze dependencies for security issues
/api/security/supply-chain/sboms/{sbom_id}/attack-paths GET Analyze attack paths through dependencies
/api/security/supply-chain/statistics GET Get supply chain security statistics
/api/security/compliance/rules GET List compliance rules
/api/security/compliance/rules POST Add compliance rule
/api/security/compliance/reports POST Generate compliance report
/api/security/compliance/reports GET List compliance reports
/api/security/compliance/remediation/{action_id}/execute POST Execute remediation action
/api/security/compliance/statistics GET Get compliance automation statistics

Infrastructure API

Endpoint Method Description
/api/infrastructure/kubernetes/deployments GET List Kubernetes deployments
/api/infrastructure/kubernetes/deployments POST Create Kubernetes deployment
/api/infrastructure/kubernetes/services GET List Kubernetes services
/api/infrastructure/kubernetes/services POST Create Kubernetes service
/api/infrastructure/kubernetes/manifests GET Generate Kubernetes manifests
/api/infrastructure/kubernetes/statistics GET Get Kubernetes statistics
/api/infrastructure/kubernetes/helm-chart GET Generate Helm chart
/api/disaster-recovery/backups GET List disaster recovery backups
/api/disaster-recovery/backups POST Create disaster recovery backup
/api/disaster-recovery/backups/{backup_id}/restore POST Restore disaster recovery backup
/api/disaster-recovery/backups/{backup_id} DELETE Delete disaster recovery backup
/api/disaster-recovery/plans GET List disaster recovery plans
/api/disaster-recovery/plans POST Create disaster recovery plan
/api/disaster-recovery/plans/{plan_id}/execute POST Execute disaster recovery plan
/api/disaster-recovery/plans/{plan_id}/test POST Test disaster recovery plan
/api/disaster-recovery/failover POST Initiate failover to secondary region
/api/disaster-recovery/failover/revert POST Revert failover to primary region
/api/disaster-recovery/replication GET Get data replication status
/api/disaster-recovery/statistics GET Get disaster recovery statistics

Deployment API

Endpoint Method Description
/api/deployment/health GET Deployment service health
/api/deployment/status GET Current deployment status
/api/deployment/build-wheel POST Build a Python wheel artifact
/api/deployment/build-docker POST Build a Docker image ({image_name})
/api/deployment/artifacts GET List build artifacts
/api/deployment/deploy POST Trigger a deployment
/api/deployment/deployments GET List deployments
/api/deployment/deployments/{deployment_id} GET Get deployment detail
/api/deployment/deployments/{deployment_id}/rollback POST Roll back a deployment
/api/deployment/analytics GET Deployment statistics

Code Intelligence API

Endpoint Method Description
/api/code-intelligence/analyze POST Analyze code for issues
/api/code-intelligence/refactoring POST Get refactoring suggestions
/api/code-intelligence/metrics POST Calculate code quality metrics

Memory Governance API

Endpoint Method Description
/api/memory-advanced/versions GET List recorded memory versions
/api/memory-advanced/versions/{id} GET Get a single version
/api/memory-advanced/versions/{id}/rollback POST Restore a previous value
/api/memory-advanced/versions/compare POST Diff two versions
/api/memory-advanced/version-stats GET Versioning statistics
/api/memory-advanced/decay/config GET/POST Get / update decay policy
/api/memory-advanced/decay/preview POST Preview decay effect
/api/memory-advanced/decay/apply POST Apply decay now

Workflow Governance API

Endpoint Method Description
/api/workflows/execute POST Execute a workflow ({workflow, goal}; workflow_name optional)
/api/workflow-templates GET List workflow templates
/api/workflows/{name}/versions GET Version history for a workflow
/api/workflows/access/{grant,revoke,role,user-roles,role-permissions,permissions/{user_id},audit} GET/POST Workflow RBAC policy endpoints

Tool Approvals & Plugin Marketplace API

Endpoint Method Description
/api/tools/approvals GET List pending tool executions
/api/tools/approvals/{id}/approve POST Approve a pending execution
/api/tools/approvals/{id}/reject POST Reject a pending execution
/api/plugins/marketplace/list GET List marketplace plugins
/api/plugins/marketplace/register POST Register a marketplace plugin
/api/marketplace/agents GET List marketplace agents
/api/plugins/{name}/enable POST Enable a plugin
/api/plugins/{name}/disable POST Disable a plugin

Observability API

Endpoint Method Description
/metrics GET Prometheus text exposition (localhost only)
/api/monitoring/metrics/prometheus GET Token-protected Prometheus scrape
/api/monitoring/notification-channels GET List channels (data.channels + data.total)
/api/monitoring/notification-channels/pagerduty POST Add a PagerDuty notification channel
/api/monitoring/user-analytics/behaviors POST Record a user behavior event
/api/monitoring/opentelemetry/export GET/POST OTLP JSON export / write to file
/api/security/threats GET List detected threats (data.threats + data.total)
/api/webhooks GET List webhooks (data.webhooks + data.total)

Response-shape conventions

  • success_response payloads include data whenever it is not None, empty [], {}, and 0 are meaningful and preserved.
  • REST list endpoints diverge by module: some return bare arrays (/api/tools, /api/editor/files), others envelope under a named key (data.webhooks, data.channels, data.threats). Frontend queryFns normalize both, probe the live response before assuming.
  • Secrets are masked with ******** on GET and restored on write; do not round-trip the sentinel into real values.
  • Development Guide
  • Examples
  • Dashboard System
  • Planner
  • Editor System
  • Monitoring System
  • Analytics System
  • CI/CD System
  • Security System
  • Supply Chain Security
  • Compliance Automation
  • Distributed System
  • Kubernetes Integration
  • Disaster Recovery
  • Code Intelligence

Source: wiki/api-reference.md · rendered 2026-11-10