Skip to content

REST API

Production REST API with 30+ endpoints, API key auth, rate limiting, plan gating, and WebSocket support.

Nella exposes a production REST API for programmatic access to search, verification, context tracking, workspace management, and authentication. Built on Express with Supabase auth, Redis rate limiting, and Zod validation.

Base URL

EnvironmentURL
Productionhttps://mcp.getnella.dev/api/v1
Localhttp://localhost:8080/api/v1

Authentication

All API endpoints require an API key via the Authorization header or X-API-Key header:

curl -H "Authorization: Bearer nella_your_key_here" \
  https://mcp.getnella.dev/api/v1/workspaces

API keys are prefixed with nella_ and stored as SHA-256 hashes in the database. Each key has scopes that control access:

Default scopes: workspaces:read, search:read, validate:run, context:read

ScopeDescription
workspaces:readList and view workspaces
workspaces:writeCreate, update, delete workspaces
search:readExecute searches
validate:runRun validations
context:readRead context entries
context:writeWrite context entries
auth:readList API keys and agents
auth:writeCreate/revoke API keys
adminFull access (bypasses all scope checks)

Rate Limiting

Requests are rate-limited per API key using a Redis sliding window (sorted set):

WindowDefault Limit
Per minute60
Per hour1,000
Per day10,000

Standard rate limit headers are included in every response:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 1706889600

Fallback

If Redis is unavailable, rate limiting falls back to an in-memory Map. Rate limit failures are non-blocking — requests are allowed through if the limiter errors.

Endpoints

Health & Status

MethodPathAuthDescription
GET/healthLiveness probe
GET/readyReadiness probe (?deep=true for full check)
GET/metricsPrometheus-compatible metrics
MethodPathScopeDescription
POST/api/v1/searchsearch:readHybrid/semantic/lexical search
POST/api/v1/search/batchsearch:readBatch up to 20 queries
POST/api/v1/verifysearch:readCode verification against index

Search request:

{
  "query": "authentication middleware",
  "workspace": "workspace-id",
  "limit": 10,
  "mode": "hybrid",
  "filter": { "language": "typescript", "path": "src/**" }
}

Batch search:

{
  "queries": [
    { "query": "auth middleware", "limit": 5 },
    { "query": "rate limiting", "limit": 5 }
  ]
}

Workspaces

MethodPathScopeDescription
GET/api/v1/workspacesworkspaces:readList with cursor pagination
POST/api/v1/workspacesworkspaces:writeCreate workspace
GET/api/v1/workspaces/:idworkspaces:readGet by ID
PATCH/api/v1/workspaces/:idworkspaces:writeUpdate config/name
DELETE/api/v1/workspaces/:idworkspaces:writeRemove workspace
POST/api/v1/workspaces/:id/indexworkspaces:writeTrigger indexing (async, returns 202)
GET/api/v1/workspaces/:id/index/statusworkspaces:readIndex status
POST/api/v1/workspaces/:id/syncworkspaces:writeTrigger cloud sync (async, returns 202)

Context

MethodPathScopeDescription
GET/api/v1/contextcontext:readGet context entries
POST/api/v1/context/assumptionscontext:writeAdd assumption
GET/api/v1/context/assumptionscontext:readGet assumptions status
GET/api/v1/context/files/*context:readFile change history
GET/api/v1/context/dependenciescontext:readDependency diff
POST/api/v1/context/changescontext:writeRecord file changes
GET/api/v1/context/sessionscontext:readActive context sessions
DELETE/api/v1/context/sessions/:idcontext:writeDelete session

Validation

MethodPathScopeDescription
POST/api/v1/validate/checkvalidate:runPre-flight safety check
POST/api/v1/validate/validatevalidate:runConstraint validation
POST/api/v1/validate/runvalidate:runFull validation run

Auth

MethodPathScopeDescription
POST/api/v1/auth/keysauth:writeCreate API key
GET/api/v1/auth/keysauth:readList user’s keys
DELETE/api/v1/auth/keys/:idauth:writeRevoke key (soft delete)
POST/api/v1/auth/agentsauth:writeRegister agent
GET/api/v1/auth/agentsauth:readList agents
GET/api/v1/auth/usageauth:readUsage stats (today/month/total)

Plan Gating

Certain features require specific plans. The middleware checks your plan before allowing the request:

FeatureFreeStarterProTeam
Search tierBasicAdvancedPremiumPremium
RAG indexingFullFull
Code verification
Custom constraints
Context trackingFullFull
SSO
Audit logs

Resource limits by plan:

ResourceFreeStarterProTeam
Requests/month5K25K100K500K
Projects1310Unlimited
Members11550
Storage50 MB250 MB2 GB10 GB
Workspaces015Unlimited

Self-Hosted

Self-hosted and unlinked API keys bypass plan gates entirely.

Middleware Stack

Every request passes through these middleware layers (in order):

#MiddlewareDescription
1helmet()Security headers (CSP, HSTS, etc.)
2compression()Response compression
3CORSConfigurable origins with credentials
4JSON parser5 MB body limit
5Request IDX-Request-Id from header or crypto.randomUUID()
6Request loggerStructured JSON with duration tracking
7apiKeyAuthSHA-256 key lookup in Supabase
8requireScope()Scope enforcement per endpoint
9createRateLimitMiddleware()Redis sliding window
10requirePlanFeature()Plan-based feature gating
11validateBody/Query/Params()Zod schema validation
12Route handlerBusiness logic
13Error handlerConsistent JSON error envelope

Error Responses

All errors follow a consistent JSON envelope:

{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Too many requests. Retry after 12 seconds.",
    "details": { "retryAfter": 12 },
    "requestId": "req_abc123"
  }
}

WebSocket

The API server includes WebSocket support on the same port for real-time events:

ws://localhost:8080/ws

Events include session updates, indexing progress, and context changes.

Job Queue

Long-running operations (indexing, sync) are processed via BullMQ with graceful Redis fallback:

  • Indexing triggers return 202 Accepted immediately
  • Job progress is available via WebSocket or status endpoint
  • Graceful shutdown drains active jobs with a 10-second timeout

Environment Variables

VariableRequiredDefaultDescription
PORTNo8080Server port
HOSTNo0.0.0.0Bind address
NODE_ENVNodevelopmentEnvironment
SUPABASE_URLYesSupabase project URL
SUPABASE_SERVICE_ROLE_KEYYesSupabase service role key
REDIS_URLNoRedis for rate limiting + job queue
DATABASE_URLNoDirect database access
JWT_SECRETNoJWT signing secret
API_KEY_SALTNoAdditional salt for API key hashing
VOYAGE_API_KEYNoVoyage AI for embeddings
OPENAI_API_KEYNoOpenAI for embeddings
ALLOWED_ORIGINSNoapp.getnella.dev,...CORS allowed origins
LOG_LEVELNoinfoLog verbosity