Skip to content

API Reference

The LunaOS API is available at https://api.lunaos.ai. All endpoints return JSON and use standard HTTP status codes.

Base URL

https://api.lunaos.ai

Authentication

All API requests (except public endpoints) require authentication via one of:

MethodHeaderFormat
JWT TokenAuthorization: Bearer <token>Obtained from /auth/login
API KeyAuthorization: Bearer lnos_live_...Generated from /api-keys

Rate Limits

Rate limits are applied per-user/key and vary by tier:

TierLimitWindow
Free60 req/min1 minute
Pro600 req/min1 minute
Team6,000 req/min1 minute

Rate limit headers are included on every response:

http
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 57
X-RateLimit-Reset: 1707500460
Server-Timing: total;dur=45

Response Format

All responses follow a consistent format:

Success

json
{
  "data": { ... }
}

Error

json
{
  "error": "Description of the error",
  "code": "error_code",
  "detail": "Additional details (development only)"
}

Endpoints Overview

MethodPathAuthDescription
GET/healthService health check
POST/auth/signupCreate account
POST/auth/loginGet JWT token
GET/auth/meCurrent user info
GET/agents/listList all agents
POST/agents/executeRun an agent (SSE)
GET/chainsList chain presets
POST/chains/executeRun a chain (SSE)
POST/rag/indexIndex code for RAG
POST/rag/searchSearch indexed code
POST/billing/checkoutStart Stripe checkout
GET/billing/subscriptionCurrent subscription
GET/billing/usageMonthly usage stats
POST/billing/cancelCancel subscription
POST/billing/portalStripe customer portal
POST/api-keysGenerate API key
GET/api-keysList API keys
DELETE/api-keys/:idRevoke an API key

Security

The API enforces enterprise-grade security:

  • HSTS with 1-year max-age, includeSubDomains, preload
  • Content Security Policy with strict source restrictions
  • X-Frame-Options: DENY — prevents clickjacking
  • X-Content-Type-Options: nosniff — prevents MIME sniffing
  • Cross-Origin isolation (COOP, COEP, CORP)
  • Audit logging for all security-relevant events

Next Steps

Built with ❤️ for developers