Getting started

Call the Leni HTTP API with your project API key. Sandbox, development, and production keys all use the same base URL—the key itself defines which environment you are in. Documented routes live under /users/*. The guides cover authentication, optional file uploads, and the JSON or multipart shapes each endpoint expects.

Base URL

Every API key—sandbox, development, or production—calls the same host:

Base URL
https://api.prod.ca-central-1.leni.co

Append the route path to this host—for example https://api.prod.ca-central-1.leni.co/users/custom-analysts for GET /users/custom-analysts, or https://api.prod.ca-central-1.leni.co/users/run-models for POST /users/run-models. Use HTTPS only. There is no separate sandbox hostname; swap keys when you move from trial to billed usage.

Key environments

When you create a key in the developer portal, you choose its environment. That value is stored on the key and is what the API uses for rate limits, billing, and sandbox quota—not the URL you call.

Key environmentWhat changes
sandboxFixed call allowance per key (Sandbox quota, 402 when exhausted). Lower rate limit. No API credit charges on run-models.
developmentBilled run-models via API credits (Pricing). Mid-tier rate limit. No sandbox call quota.
productionSame billing model as development. Highest rate limit. No sandbox call quota.

Send the key you want on each request. To test without billing, use a sandbox key against the same base URL; to go live, use a production key—no endpoint or host change required.

Quick start

Send your API key on every request (see Authentication). A lightweight check that the gateway and your key work:

curl -sS -X GET "https://api.prod.ca-central-1.leni.co/users/custom-analysts" \
  -H "X-Api-Key: $LENI_API_KEY"

A successful response is JSON—for example a custom_models array when you have custom analysts configured. 401 means the key is missing or invalid; 429 or 402 mean rate limit or sandbox quota (see links below).

Request format

TopicDetails
AuthenticationX-Api-Key, Authorization: Bearer, or ?apiKey= full details
JSON bodiesContent-Type: application/json for most POST routes without file bytes.
File uploadsmultipart/form-data with parts named files, or JSON with a files / filesBase64 base64 array — File uploads
IdentityThe authenticated user is always the API key owner. Run-models and memory routes merge your key context with any user fields in the body; custom analyst routes do not accept a user object.

Before you integrate

  1. Authentication — how to send your API key on each request.
  2. Pricing — per-model token rates and how API credits are deducted on run-models calls.
  3. Rate limits and Sandbox quota — per-key request caps, 429 responses, and sandbox call limits (402).
  4. File uploads — multipart and JSON base64 attachments, limits, and field shapes.
  5. Browse API Reference in the sidebar for Leni AI (run models, chat data, session id), Memory, Custom analysts, and other sections as they are documented.

API endpoints

All routes below require your project API key. Paths are relative to https://api.prod.ca-central-1.leni.co.

Leni AI

MethodPathPurpose
POST/users/run-modelsPrompts, attachments, sessions, summaries
GET/users/me/chat-messagesList chat messages (newest first)
GET/users/me/chat-messages/:messageIdOne message row (owner)
GET/users/me/chat-sessions/:sessionIdSession metadata when the owner participates
GET/users/me/chat-sessions/:sessionId/messagesTranscript for the session
POST/users/me/chat-sessions/attachmentsResolve file anchors in summaries
POST/users/me/chat-sessions/message-responsesRaw message_response rows

Memory

MethodPathPurpose
POST/users/get-user-memoryList memory for the key owner
POST/users/add-to-memoryCreate memory notes (optional files)
POST/users/update-memoryUpdate memory notes (optional files)

Custom analysts

MethodPathPurpose
POST/users/custom-analystsCreate a custom analyst
PUT/users/custom-analysts/:analystIdUpdate a custom analyst
GET/users/custom-analystsList custom analysts
DELETE/users/custom-analysts/:analystIdDelete a custom analyst

See the dedicated pages for POST /users/run-models, POST /users/add-to-memory, and the topics in the sidebar for full request bodies and examples.