Developer Docs

Lyren Docs for Developers

Learn how to build with Lyren API: Developer Chat with always-on Memory, Tools, Memory, Knowledge Base, Business APIs, Workflows, Scheduler, Calendar, and Connectors.

Chat requires x-user-id
POST /v1/chat/completions always includes Lyren Memory. Send x-user-id so memory is scoped to the correct user in your app.
Use API Reference for exact endpoint details
This page explains setup and concepts. For exact routes, headers, request bodies, responses, and errors, use API Reference.

Overview

Lyren runs as an HTTP API gateway. Your backend calls Lyren using x-api-key. User-scoped features use x-user-id. Developer Chat always uses Memory, so it also requires x-user-id.

Public developer modules
  • GET /health — health check
  • GET /v1/limits — plan and limits
  • POST /v1/chat/completions — chat with always-on memory
  • POST /v1/tools/* — summarize, translate, rewrite, extract, fetch
  • POST /v1/memory/* — notes, task memory, ranked context
  • POST /v1/knowledge/* — upload and ask from documents
  • POST /v1/business/* — lead, churn, revenue analysis
  • POST /v1/workflows/* — workflow definitions
  • POST /v1/schedule/* — scheduled jobs
  • POST /v1/calendar/* — calendar actions
  • POST /v1/connectors/* — source connectors
How Lyren is used
  • Call Lyren from your backend, not frontend JavaScript
  • Keep API keys private and server-side
  • Pass stable user IDs for memory and user-scoped modules
  • Use redact_output where available for safer output
  • Use API Reference for exact payload shapes

Getting started

Start with the public base URL, your API key, and a stable user ID from your application.

What you need
  • Base URL: https://lyren-gateway-api.onrender.com
  • API key header: x-api-key
  • User ID header: x-user-id
  • JSON header: Content-Type: application/json
Backend use only
Do not put your Lyren API key in browser JavaScript, mobile apps without a backend proxy, public repositories, screenshots, or client-side code.

Install

Lyren is an HTTP API. Store credentials in environment variables and send requests from your backend.

Recommended environment variables
  • LYREN_BASE_URLhttps://lyren-gateway-api.onrender.com
  • LYREN_API_KEY — your private API key
  • LYREN_USER_ID — your application user id

Python quickstart

Use an HTTP client such as httpx.

bash
pip install httpx
bash
export LYREN_BASE_URL="https://lyren-gateway-api.onrender.com"
export LYREN_API_KEY="YOUR_API_KEY"
export LYREN_USER_ID="user_123"
python
import os
import httpx

BASE = os.getenv("LYREN_BASE_URL", "https://lyren-gateway-api.onrender.com").rstrip("/")
KEY = os.getenv("LYREN_API_KEY", "")
USER_ID = os.getenv("LYREN_USER_ID", "user_123")

def headers(user_scoped: bool = True):
    h = {
        "x-api-key": KEY,
        "Content-Type": "application/json"
    }
    if user_scoped:
        h["x-user-id"] = USER_ID
    return h

def chat(prompt: str):
    response = httpx.post(
        f"{BASE}/v1/chat/completions",
        headers=headers(user_scoped=True),
        json={
            "model": "lyren-dev-standard",
            "messages": [
                {"role": "user", "content": prompt}
            ],
            "memory_limit": 8,
            "task_limit": 5,
            "redact_output": True
        },
        timeout=45
    )
    response.raise_for_status()
    return response.json()

if __name__ == "__main__":
    result = chat("Say hello from Lyren and remember this user context.")
    print(result["choices"][0]["message"]["content"])

Node.js quickstart

Node 18+ includes fetch.

bash
export LYREN_BASE_URL="https://lyren-gateway-api.onrender.com"
export LYREN_API_KEY="YOUR_API_KEY"
export LYREN_USER_ID="user_123"
js
const BASE = (process.env.LYREN_BASE_URL || "https://lyren-gateway-api.onrender.com").replace(/\/+$/, "");
const KEY = process.env.LYREN_API_KEY || "";
const USER_ID = process.env.LYREN_USER_ID || "user_123";

function headers(userScoped = true) {
  const h = {
    "x-api-key": KEY,
    "Content-Type": "application/json"
  };

  if (userScoped) {
    h["x-user-id"] = USER_ID;
  }

  return h;
}

async function chat(prompt) {
  const response = await fetch(`${BASE}/v1/chat/completions`, {
    method: "POST",
    headers: headers(true),
    body: JSON.stringify({
      model: "lyren-dev-standard",
      messages: [
        { role: "user", content: prompt }
      ],
      memory_limit: 8,
      task_limit: 5,
      redact_output: true
    })
  });

  if (!response.ok) {
    throw new Error(await response.text());
  }

  return response.json();
}

(async () => {
  const result = await chat("Say hello from Lyren and use my saved memory.");
  console.log(result.choices[0].message.content);
})();

cURL quickstart

Use cURL for quick testing.

bash
curl -X POST https://lyren-gateway-api.onrender.com/v1/chat/completions \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-user-id: user_123" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "lyren-dev-standard",
    "messages": [
      { "role": "user", "content": "Write 3 bullets about what Lyren can do." }
    ],
    "memory_limit": 8,
    "task_limit": 5,
    "redact_output": true
  }'

Quickstart flow

  1. Store your API key server-side.
  2. Set LYREN_BASE_URL to https://lyren-gateway-api.onrender.com.
  3. Pass x-api-key with every protected request.
  4. Pass x-user-id for Developer Chat and user-scoped modules.
  5. Call POST /v1/chat/completions with lyren-dev-standard.
  6. Use API Reference for exact request and response details.
Memory save example
bash
curl -X POST https://lyren-gateway-api.onrender.com/v1/memory/save \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-user-id: user_123" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "User prefers concise answers and implementation steps.",
    "tags": "preferences,formatting,style",
    "memory_type": "note",
    "category": "preferences",
    "project": "Lyren",
    "importance": 8,
    "pinned": true
  }'

Authentication

Protected Lyren API requests use your API key in the x-api-key header.

http
x-api-key: YOUR_API_KEY
Content-Type: application/json
Key safety
Keep your API key on your backend. Do not expose it in browser code, public GitHub repositories, screenshots, or client-side applications.

User identity headers

Send a stable x-user-id to keep user-scoped data isolated. Developer Chat requires it because memory is always enabled.

http
x-api-key: YOUR_API_KEY
x-user-id: user_123
Content-Type: application/json
Required for
/v1/chat/completions, Memory, Knowledge Base, Business, Workflows, Scheduler, Calendar, and Connectors.

Security checklist

  • Store API keys in backend environment variables.
  • Never expose keys in frontend JavaScript.
  • Use x-user-id for user-scoped routes.
  • Regenerate exposed keys immediately.
  • Use redact_output where available.
  • Use server-side proxies for browser-facing apps.

Chat

POST /v1/chat/completions Auth: x-api-key + x-user-id Memory always on

Use Chat for product assistants, support copilots, drafting, explanation, planning, and user-aware experiences. Developer Chat always includes Lyren Memory, so every chat completion is scoped to a user.

Memory cannot be disabled
Legacy request fields such as use_memory may be accepted for compatibility, but Developer Chat keeps memory enabled.

Tools

POST /v1/tools/* Text utilities URL fetch tools

Tools provide utility actions such as summarize, translate, rewrite, extract, URL fetch, and fetch plus summarize. Upgraded tools support safer validation, optional redaction, max character controls, metadata, and daily cap details.

  • POST /v1/tools/summarize
  • POST /v1/tools/translate
  • POST /v1/tools/rewrite
  • POST /v1/tools/extract
  • POST /v1/tools/fetch
  • POST /v1/tools/fetch_and_summarize

Memory

Memory stores user preferences, project facts, long-term notes, and task context. Developer Chat automatically uses ranked memory and task context.

  • POST /v1/memory/save — save user memory
  • POST /v1/memory/search — search user memory
  • POST /v1/memory/forget — delete memory
  • POST /v1/memory/task/save — save task memory
  • POST /v1/memory/task/search — search task memory
  • POST /v1/memory/ranked-context — retrieve ranked context

Knowledge Base

Knowledge Base lets developers upload documents and ask grounded questions from those documents. It is user-scoped and requires x-user-id.

  • POST /v1/knowledge/upload — upload a document
  • POST /v1/knowledge/ask — ask document-grounded questions

Business

Business endpoints return structured insights from your own data, such as lead scoring, churn risk, revenue leak analysis, and history.

Included business capabilities
  • Lead score
  • Churn risk
  • Revenue leaks
  • User-scoped history
User scope
Pass x-user-id so business history stays associated with the correct user.

Workflows

Workflows let developers save reusable multi-step definitions for repeated actions inside their apps.

  • POST /v1/workflows/save — save or update workflow definition
  • GET /v1/workflows/list — list workflow definitions

Scheduler

Scheduler lets developers create jobs that run later, such as reminders, follow-ups, and webhook actions.

  • POST /v1/schedule/create — create a scheduled job
  • GET /v1/schedule/list — list scheduled jobs
  • GET /v1/schedule/status/{job_id} — inspect a job
  • POST /v1/schedule/cancel/{job_id} — cancel a job

Calendar

Calendar features support scheduling actions such as provider listing, free/busy lookup, event creation, and booking flows.

  • GET /v1/calendar/providers
  • POST /v1/calendar/freebusy
  • POST /v1/calendar/create-event
  • POST /v1/calendar/book

Connectors

Connectors let developers store and manage user-scoped source configurations such as sitemaps, websites, RSS feeds, docs, APIs, webhooks, and custom sources.

  • POST /v1/connectors/create — create connector
  • GET /v1/connectors/list — list connectors
Allowed connector kinds
sitemap, website, rss, docs, api, webhook, and custom.

Models

Developer Chat supports these public chat modes:

  • lyren-dev-fast — concise and fast responses
  • lyren-dev-standard — balanced default mode
  • lyren-dev-deep — deeper reasoning and implementation detail

Response shape

Many upgraded Lyren routes return consistent fields so developers can parse responses more easily.

json
{
  "ok": true,
  "result": {},
  "meta": {},
  "daily_caps": {
    "kind": "chat",
    "used_today": 12,
    "limit_daily": 2500,
    "remaining_today": 2488
  }
}

Errors

Errors return an HTTP status plus a JSON body.

json
{
  "error": "missing_user_id",
  "message": "x-user-id is required for /v1/chat/completions because Developer Chat always includes memory."
}
  • 401 — missing or invalid API key
  • 400 — invalid request or missing user ID
  • 403 — feature not allowed for plan
  • 429 — rate limit or daily cap exceeded
  • 502 — backend model/tool failure

Limits

Limits are plan-based. Use GET /v1/limits to check the current plan and limits for your API key.

bash
curl https://lyren-gateway-api.onrender.com/v1/limits \
  -H "x-api-key: YOUR_API_KEY"

Frequently Asked Questions

Common questions about Lyren docs, setup, authentication, chat memory, quickstart, modules, errors, and limits.

What are Lyren Docs for?

Lyren Docs explain how developers set up, authenticate, and use Lyren modules such as chat with always-on memory, tools, memory, knowledge base, business, workflows, scheduler, calendar, and connectors.

What is the difference between Docs and API Reference?

Docs explain concepts, setup, and how to use Lyren. API Reference provides exact routes, headers, request bodies, response examples, and error shapes.

What is the Lyren API base URL?

The Lyren API base URL is https://lyren-gateway-api.onrender.com.

How do I authenticate requests to Lyren?

Send your API key using the x-api-key header. For user-scoped features, also send x-user-id. JSON requests should include Content-Type: application/json.

Does Developer Chat require x-user-id?

Yes. Lyren Developer Chat always includes memory, so x-user-id is required for POST /v1/chat/completions.

Can developers disable memory in Lyren Chat?

No. Developer Chat always includes Lyren Memory. Legacy use_memory fields may be accepted for compatibility, but memory remains enabled.

Can I call Lyren directly from browser JavaScript?

No. Your Lyren API key should stay on your backend and should not be exposed in browser code, public repositories, screenshots, or client-side applications.

What model names are used for Developer Chat?

Lyren Developer Chat supports lyren-dev-fast, lyren-dev-standard, and lyren-dev-deep.

What can the Tools API do?

The Tools API can summarize, translate, rewrite, extract information, fetch URL text, and fetch plus summarize web content.

What is Lyren Memory?

Lyren Memory stores user-scoped notes, preferences, project facts, and task context so AI features can respond with continuity across sessions.

What is the Knowledge Base API?

The Knowledge Base API lets developers upload documents and ask grounded questions against user-scoped uploaded files.

What business features are included in Lyren?

Lyren includes business routes for lead score, churn risk, revenue leak analysis, and business history when enabled in the backend.

Do the docs explain workflows, scheduler, calendar, and connectors?

Yes. The docs explain how workflows save reusable definitions, scheduler runs delayed jobs, calendar handles scheduling actions, and connectors manage user-scoped source configurations.

What happens when I exceed API limits?

Limits are plan-based. When exceeded, Lyren commonly returns a 429 response with a JSON error body.