Skip to content

API Reference

LeanCore exposes a comprehensive REST API with 80+ endpoints across 40 controllers. All endpoints require JWT authentication unless noted as public.

Authentication

Login

POST /auth/login
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "your-password"
}

Returns an accessToken for subsequent API calls.

Using the Token

Authorization: Bearer <accessToken>

Include the Authorization header on all authenticated requests.

Organization Context

X-Org-Id: <organization-uuid>

Many endpoints require the X-Org-Id header to scope the request to a specific organization.

Endpoint Groups

Authentication (3 endpoints)

MethodPathDescription
POST/auth/loginAuthenticate and get JWT
POST/auth/refreshRefresh an expiring token
GET/auth/verifyVerify token validity

Registration (1 endpoint)

MethodPathDescription
POST/registerPublic -- create organization + admin user

Organizations (4 endpoints)

MethodPathDescription
GET/orgsList all organizations
GET/orgs/{id}Get organization details
PUT/orgs/{id}Update organization
PATCH/orgs/{id}/billing-emailUpdate billing email

Users (6 endpoints)

MethodPathDescription
GET/users/meGet current user
GET/usersList users in organization
POST/users/inviteInvite a new user
PUT/users/{id}Update user
DELETE/users/{id}Remove user
PATCH/users/{id}/roleChange user role

Specialists (6 endpoints)

MethodPathDescription
GET/specialistsList specialists (paginated)
POST/specialistsCreate specialist
GET/specialists/{id}Get specialist details
PUT/specialists/{id}Update specialist
DELETE/specialists/{id}Remove specialist
POST/specialists/wizardAI-assisted specialist creation

Chat (5 endpoints)

MethodPathDescription
POST/api/chat/streamSend message (streaming response)
POST/api/chat/asyncSend message (async)
GET/api/chat/sessionsList chat sessions
GET/api/chat/sessions/{id}Get session messages
POST/api/chat/uploadUpload file to chat

MCP Integration (7 endpoints)

MethodPathDescription
GET/orgs/{orgId}/mcpsList connected systems
POST/orgs/{orgId}/mcpsConnect a system
PUT/orgs/{orgId}/mcps/{id}Update connection
DELETE/orgs/{orgId}/mcps/{id}Disconnect system
POST/orgs/{orgId}/mcps/{id}/syncSync tools
GET/orgs/{orgId}/mcps/{id}/toolsList available tools
GET/mcp/catalogBrowse system catalog

Billing (10 endpoints)

MethodPathDescription
GET/billing/credits/balanceGet current balance
GET/billing/credits/usageGet usage history
GET/billing/model-ratesGet AI model pricing
GET/billing/packagesList available packages
POST/billing/credits/grantAdd credits
GET/billing/capacityGet capacity overview
GET/billing/alertsGet budget alerts
POST/billing/alerts/acknowledgeAcknowledge an alert
GET/billing/circuitGet circuit breaker status
POST/billing/circuit/toggleToggle circuit breaker

Workspaces (10 endpoints)

MethodPathDescription
GET/workspacesList workspaces
POST/workspacesCreate workspace
GET/workspaces/{id}Get workspace
PUT/workspaces/{id}Update workspace
DELETE/workspaces/{id}Delete workspace
GET/workspaces/{id}/threadsList threads
GET/workspaces/{id}/artifactsList artifacts
POST/workspaces/{id}/filesUpload file
GET/workspaces/{id}/filesList files
DELETE/workspaces/{id}/files/{fileId}Delete file

Tasks & Projects (4 endpoints)

MethodPathDescription
GET/projectsList projects
POST/projectsCreate project
GET/tasksList tasks
POST/tasksCreate task

Response Format

All API responses use standard HTTP status codes:

CodeMeaning
200Success
201Created
400Bad request (validation error)
401Unauthorized (missing/invalid token)
402Payment required (budget exhausted)
403Forbidden (insufficient role)
404Not found
500Internal server error

LeanCore AI - Hire smarter. Not more.