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 environment | What changes |
|---|---|
sandbox | Fixed call allowance per key (Sandbox quota, 402 when exhausted). Lower rate limit. No API credit charges on run-models. |
development | Billed run-models via API credits (Pricing). Mid-tier rate limit. No sandbox call quota. |
production | Same 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
| Topic | Details |
|---|---|
| Authentication | X-Api-Key, Authorization: Bearer, or ?apiKey= — full details |
| JSON bodies | Content-Type: application/json for most POST routes without file bytes. |
| File uploads | multipart/form-data with parts named files, or JSON with a files / filesBase64 base64 array — File uploads |
| Identity | The 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
- Authentication — how to send your API key on each request.
- Pricing — per-model token rates and how API credits are deducted on run-models calls.
- Rate limits and Sandbox quota — per-key request caps, 429 responses, and sandbox call limits (402).
- File uploads — multipart and JSON base64 attachments, limits, and field shapes.
- 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
| Method | Path | Purpose |
|---|---|---|
| POST | /users/run-models | Prompts, attachments, sessions, summaries |
| GET | /users/me/chat-messages | List chat messages (newest first) |
| GET | /users/me/chat-messages/:messageId | One message row (owner) |
| GET | /users/me/chat-sessions/:sessionId | Session metadata when the owner participates |
| GET | /users/me/chat-sessions/:sessionId/messages | Transcript for the session |
| POST | /users/me/chat-sessions/attachments | Resolve file anchors in summaries |
| POST | /users/me/chat-sessions/message-responses | Raw message_response rows |
Memory
| Method | Path | Purpose |
|---|---|---|
| POST | /users/get-user-memory | List memory for the key owner |
| POST | /users/add-to-memory | Create memory notes (optional files) |
| POST | /users/update-memory | Update memory notes (optional files) |
Custom analysts
| Method | Path | Purpose |
|---|---|---|
| POST | /users/custom-analysts | Create a custom analyst |
| PUT | /users/custom-analysts/:analystId | Update a custom analyst |
| GET | /users/custom-analysts | List custom analysts |
| DELETE | /users/custom-analysts/:analystId | Delete 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.