Lyren API Reference for Developers

Public developer API routes for Chat, Tools, Memory, Knowledge Base, Business, Workflows, Scheduler, Calendar, and Connectors.

Note: This page documents public developer API endpoints. Internal Lyren Chat features such as code generation and code preview are separate from the developer API and are not listed here.

Base URL

All endpoints are relative to your Lyren API server domain.

text
https://YOUR_DOMAIN

Modules

Lyren developer API includes these public modules.

text
- Health
- Limits
- Chat
- Tools
- Memory
- Knowledge Base
- Business
- Workflows
- Scheduler
- Calendar
- Connectors

Authentication

Most developer API endpoints require your API key in the x-api-key header.

http
x-api-key: YOUR_API_KEY
Content-Type: application/json

User identity

Memory, Knowledge Base, Business, Workflows, Scheduler, Calendar, and Connectors are user-scoped. Send x-user-id so data stays tied to the correct user in your app.

http
x-api-key: YOUR_API_KEY
x-user-id: user_123
Content-Type: application/json

GET /v1/limits

Returns the current plan and limits for the API key.

bash
curl https://YOUR_DOMAIN/v1/limits \
  -H "x-api-key: YOUR_API_KEY"

GET /health

Health check endpoint. Use this to confirm the API server is running.

bash
curl https://YOUR_DOMAIN/health

POST /v1/chat/completions

Create a chat completion from messages.

json
{
  "model": "lyren",
  "messages": [
    { "role": "user", "content": "Hello from my app." }
  ],
  "temperature": 0.3,
  "max_tokens": 400
}
json response
{
  "id": "chatcmpl_example",
  "object": "chat.completion",
  "model": "lyren",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello. How can I help?"
      },
      "finish_reason": "stop"
    }
  ]
}

Tools

Utility endpoints for summarize, translate, rewrite, extract, fetch, and fetch plus summarize.


POST /v1/tools/summarize

Summarize text.

json
{
  "text": "We need to ship v1 in 7 days. Backend is behind. QA has not started."
}

POST /v1/tools/translate

Translate text into a target language.

json
{
  "text": "Hello, how are you?",
  "target_language": "Spanish"
}

POST /v1/tools/rewrite

Rewrite text in a selected style while keeping the original meaning.

json
{
  "text": "We are late on the project.",
  "style": "professional"
}

POST /v1/tools/extract

Extract information from text using an instruction.

json
{
  "text": "Jane Doe (jane@acme.com) reported checkout error. Urgency: high.",
  "instruction": "Extract the customer name, email, issue, and urgency."
}

POST /v1/tools/fetch

Fetch a URL and return extracted readable text.

json
{
  "url": "https://example.com/article"
}

POST /v1/tools/fetch_and_summarize

Fetch a URL and return a summary.

json
{
  "url": "https://example.com/article"
}

POST /v1/memory/save

Save a structured memory item for a specific user.

headers
x-api-key: YOUR_API_KEY
x-user-id: user_123
Content-Type: application/json
json
{
  "content": "User prefers short answers and bullet points.",
  "tags": "preferences,formatting,style",
  "memory_type": "note",
  "category": "preferences",
  "project": "Lyren",
  "importance": 7,
  "pinned": true
}


POST /v1/memory/forget

Delete a saved memory item by ID.

json
{
  "id": 42
}

POST /v1/memory/task/save

Save a task into task memory.

json
{
  "title": "Finish API docs",
  "description": "Rewrite docs to match public developer routes.",
  "project": "Lyren",
  "tags": "docs,api",
  "status": "open",
  "priority": 8,
  "pinned": true
}


POST /v1/memory/ranked-context

Return the best memory and task context for chat injection.

json
{
  "query": "continue the API reference rewrite",
  "memory_limit": 8,
  "task_limit": 5,
  "include_tasks": true,
  "project": "Lyren"
}

POST /v1/knowledge/upload

Upload a document into the Knowledge Base.

bash
curl -X POST https://YOUR_DOMAIN/v1/knowledge/upload \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-user-id: user_123" \
  -F "file=@./policy.pdf"

POST /v1/knowledge/ask

Ask a question grounded in the user’s uploaded documents.

json
{
  "question": "Summarize our refund policy and list exceptions.",
  "top_k": 6
}

Business

Business endpoints provide structured scoring and analysis for developer apps.


POST /v1/business/lead-score

Score a lead and estimate close probability.

json
{
  "budget_usd": 5000,
  "company_size": 120,
  "timeline_days": 14,
  "stage": "proposal",
  "source": "inbound",
  "engagement": {
    "email_opens": 4,
    "email_replies": 1,
    "meetings": 1,
    "site_visits": 6,
    "demo_requested": true
  }
}

POST /v1/business/churn-risk

Estimate churn risk from activity, billing, and support signals.

json
{
  "usage_last_30d": [12, 11, 10, 10, 9, 8, 7, 7, 6, 6, 5, 5, 5, 4, 4],
  "tickets_last_30d": 3,
  "refunds_last_90d": 1,
  "failed_payments_last_30d": 2,
  "last_active_days": 18,
  "nps": 3
}

POST /v1/business/revenue-leaks

Analyze refunds, chargebacks, failed payments, downgrades, and cancellations.

json
{
  "currency": "USD",
  "events": [
    { "type": "refund", "amount": 39.99 },
    { "type": "failed_payment", "amount": 49.00 },
    { "type": "chargeback", "amount": 99.00 },
    { "type": "cancellation", "mrr": 49.00 },
    { "type": "downgrade", "mrr_delta": -30.00 }
  ]
}

POST /v1/workflows/save

Save or update a workflow definition for the current user.

json
{
  "name": "sales_followup",
  "definition": {
    "steps": [
      { "type": "rewrite", "style": "professional" },
      { "type": "extract", "instruction": "Extract action items." }
    ]
  }
}

GET /v1/workflows/list

List workflow definitions for the current user.

bash
curl https://YOUR_DOMAIN/v1/workflows/list \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-user-id: user_123"

POST /v1/schedule/create

Create a scheduled job that runs later.

json
{
  "run_at": "2026-03-20T18:30:00Z",
  "job_type": "webhook",
  "payload": {
    "webhook_url": "https://yourapp.com/hooks/reminder",
    "body": {
      "message": "Follow up with the lead."
    }
  }
}

GET /v1/schedule/list

List scheduled jobs for the current user.

bash
curl https://YOUR_DOMAIN/v1/schedule/list \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-user-id: user_123"

POST /v1/schedule/cancel/{job_id}

Cancel a scheduled job by ID.

bash
curl -X POST https://YOUR_DOMAIN/v1/schedule/cancel/JOB_ID \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-user-id: user_123"

Calendar

Calendar routes are user-scoped and should be included only if they are enabled in your deployed backend.

text
GET  /v1/calendar/providers
POST /v1/calendar/freebusy
POST /v1/calendar/create-event
POST /v1/calendar/book
json book example
{
  "title": "SEO Audit Call",
  "starts_at": "2026-03-20T18:30:00Z",
  "ends_at": "2026-03-20T19:00:00Z",
  "timezone": "America/New_York",
  "attendee_name": "Jane Doe",
  "attendee_email": "jane@example.com",
  "webhook_url": "https://yourapp.com/hooks/calendar"
}

POST /v1/connectors/create

Create a connector for the current user.

json
{
  "name": "Main Sitemap",
  "kind": "sitemap",
  "config": {
    "url": "https://example.com/sitemap.xml"
  }
}

GET /v1/connectors/list

List connectors for the current user.

bash
curl https://YOUR_DOMAIN/v1/connectors/list \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-user-id: user_123"

Portal endpoints

These endpoints belong to your developer portal service, not the public /v1 gateway modules.

text
POST /api/auth/signup
POST /api/auth/login
POST /api/auth/logout
GET  /api/me
GET  /api/keys/me
POST /api/keys/regenerate
POST /api/billing/checkout
POST /api/billing/portal
POST /api/billing/webhook
POST /api/auth/forgot-password
POST /api/auth/reset-password

Errors

Lyren returns JSON errors in a consistent shape.

json
{
  "error": "unauthorized",
  "message": "Missing or invalid API key."
}

Common cases: unauthorized, forbidden, invalid_request, rate_limit_exceeded, daily_cap_exceeded.

Frequently Asked Questions

Common questions about the Lyren API reference, authentication, routes, user identity, limits, and developer usage.

What is the Lyren API Reference?

The Lyren API Reference is the developer documentation page that lists public API routes, request examples, authentication headers, user identity requirements, and module-specific endpoints such as chat, tools, memory, knowledge, business, workflows, scheduler, calendar, and connectors.

Does this page include Lyren Chat code tools?

No. Lyren Chat code generation and code preview are internal Lyren Chat features. They are separate from the public developer API and should not be listed in this API Reference.

How do I authenticate requests to Lyren API?

Most Lyren API endpoints require your API key in the x-api-key header. Requests that send JSON should also include Content-Type: application/json.

When do I need to send x-user-id?

Send x-user-id for user-scoped features such as memory, knowledge base, business, workflows, scheduler, calendar, and connectors. This lets Lyren keep data and actions tied to the correct user in your app.

What is the base URL for Lyren API?

All routes in the API reference are relative to your Lyren server domain. In the examples, this is shown as https://YOUR_DOMAIN, which developers replace with the deployed Lyren API domain.

How do I check my plan and API limits?

Use GET /v1/limits to see the current plan and limits for your API key.

How do I test whether the Lyren API server is running?

Use GET /health. This is the health check endpoint and is the simplest way to confirm the API server is online.

What can I do with the chat endpoint?

The POST /v1/chat/completions endpoint lets developers send messages and receive chat completions from Lyren. It is the main route for building in-app assistants, support chat, and AI-driven conversational features.

What tools endpoints are available?

Lyren provides tools endpoints for summarizing, translating, rewriting, extracting information, fetching a URL, and fetching plus summarizing web content.

Does the API reference include memory routes?

Yes. The page documents memory save, search, forget, task memory, and ranked context routes. These endpoints are used for storing user preferences, project context, task data, and relevant memory for later retrieval.

How does knowledge base work in the API reference?

The knowledge base routes let developers upload documents and ask grounded questions against those files. The API reference includes routes for uploading documents and asking document-based questions.

What business routes are documented?

The API reference includes business routes for lead scoring, churn risk, and revenue leak analysis. These endpoints help developers build dashboards and business intelligence features inside their products.

Does the API reference cover workflows and scheduling?

Yes. It includes workflow save and list routes, as well as scheduler routes for creating, listing, and canceling jobs such as reminders, follow-ups, and webhook-based actions.

What are connectors in Lyren API?

Connectors are developer-defined ingestion/source configurations tied to a user. The API reference includes routes for creating and listing connectors.

What are portal endpoints?

Portal endpoints belong to the developer portal service rather than the public /v1 gateway modules. These include signup, login, logout, account routes, API key management, billing checkout, billing portal, webhook handling, and password reset flows.

What does an error response look like?

Lyren returns JSON errors in a consistent format with fields such as error and message. Common cases include unauthorized, forbidden, invalid request, rate limit exceeded, and daily cap exceeded.

Where do I manage my account and API key?

After signing up and completing billing, developers can log in to the dashboard to manage their account, view their API key, and access related developer settings.