Skip to content

API Overview

The NimbleBrain HTTP API gives you programmatic access to chat, apps, conversations, tools, and real-time events. Every endpoint uses JSON over HTTP and follows consistent conventions.

http://localhost:27247

The default port is 27247. Override it with the --port flag or the http.port field in nimblebrain.json.

All request and response bodies use application/json. Set the Content-Type header on every request that includes a body:

Content-Type: application/json

SSE endpoints (/v1/chat/stream and /v1/events) return text/event-stream.

The API supports two authentication methods:

  • Bearer token — pass NB_API_KEY in the Authorization header
  • Session cookie — call POST /v1/auth/login to receive an nb_session HttpOnly cookie

When NB_API_KEY is not set, the API runs in dev mode with no authentication required. See Authentication for full details.

All errors return a JSON object with an error field and an optional message field:

{
"error": "not_found",
"message": "App \"weather\" not found"
}

Common error codes:

error ValueHTTP StatusMeaning
"bad_request"400Invalid request body or parameters
(empty body)401Authentication failed
"protected"403Bundle is protected from uninstall
"not_found"404Resource does not exist
"already_installed"409Bundle is already installed
"install_failed"500Bundle installation failed
"credentials_required"400Bundle needs API keys in the env field

Validation errors on request bodies return a 400 with a descriptive error or message string:

{
"error": "message is required and must be a string"
}

Every endpoint requires authentication unless noted otherwise.

MethodPathAuthDescription
POST/v1/auth/loginNoValidate API key, set session cookie
POST/v1/auth/logoutYesClear session cookie
GET/v1/auth/sessionYesCheck session validity
POST/v1/chatYesSynchronous chat
POST/v1/chat/streamYesStreaming chat (SSE)
GET/v1/appsYesList installed apps
POST/v1/apps/installYesInstall a bundle
DELETE/v1/apps/:nameYesUninstall an app
POST/v1/apps/:name/startYesStart a stopped app
POST/v1/apps/:name/stopYesStop a running app
GET/v1/apps/:name/resources/:pathYesFetch a UI resource
POST/v1/tools/callYesDirect tool invocation
GET/v1/conversationsYesList conversations
GET/v1/conversations/:id/historyYesGet conversation messages
DELETE/v1/conversations/:idYesDelete a conversation
PATCH/v1/conversations/:idYesUpdate conversation metadata
POST/v1/conversations/:id/forkYesFork a conversation
GET/v1/eventsYesWorkspace SSE event stream
GET/v1/workspaceYesBootstrap data
GET/v1/usageYesUsage statistics
GET/v1/skillsYesList loaded skills
GET/v1/healthNoHealth check
GET/v1/bundles/healthNoPer-bundle health
POST/mcpYesMCP server endpoint (Streamable HTTP)

CORS behavior depends on your configuration:

  • Dev mode (no NB_API_KEY set) — Access-Control-Allow-Origin: *
  • Production with ALLOWED_ORIGINS — only listed origins get CORS headers, with Access-Control-Allow-Credentials: true for cookie support
  • Production without ALLOWED_ORIGINS — same-origin only (no CORS headers)

The server handles OPTIONS preflight requests automatically with a 204 No Content response.

The API exposes two Server-Sent Events streams:

  1. Chat stream (POST /v1/chat/stream) — per-request stream of chat events. Events: text.delta, tool.start, tool.done, done, error. See Chat.
  2. Workspace stream (GET /v1/events) — persistent connection for workspace-level events. Events: bundle.installed, bundle.uninstalled, bundle.crashed, bundle.recovered, bundle.dead, data.changed, heartbeat. See Events.