Introduction
LibreChat provides a comprehensive REST API for managing conversations, messages, agents, files, and more. All API endpoints are prefixed with/api and require authentication.
Base URL
All API requests should be made to:localhost:3080 with your domain.
Authentication
LibreChat supports two authentication methods:- JWT Authentication: Session-based authentication using JWT tokens (recommended for web applications)
- API Keys: Token-based authentication for programmatic access
API Endpoints
LibreChat’s API is organized into the following categories:Core Resources
- Conversations - Manage chat conversations, titles, and archives
- Messages - Create, retrieve, and update messages within conversations
- Users - User account management and settings
AI Features
- Agents - Create and manage AI agents with custom capabilities
- Presets - Save and load conversation presets
- Prompts - Manage prompt libraries and prompt groups
Files & Media
- Files - Upload, download, and manage file attachments
Configuration
- Custom Endpoints - Configure custom AI model endpoints
- MCP Servers - Manage Model Context Protocol server integrations
Authentication
- Auth - Login, registration, password reset, and 2FA
Rate Limiting
Most endpoints implement rate limiting to prevent abuse:- IP-based limits: Applied per IP address
- User-based limits: Applied per authenticated user
- Special limits: File uploads, imports, and message endpoints have specific rate limits
Error Handling
The API uses standard HTTP status codes:| Status Code | Description |
|---|---|
200 | Success |
201 | Created |
204 | No Content |
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
500 | Internal Server Error |
Pagination
Many list endpoints support cursor-based pagination:Number of results to return
Pagination cursor from previous response
Filtering & Search
Many endpoints support filtering and search:WebSocket Connections
For real-time features, LibreChat uses Server-Sent Events (SSE) for streaming responses:SDK Support
LibreChat provides TypeScript type definitions inpackages/data-provider:
API Versioning
Some endpoints support versioning:/api/agents/v1/*- Agent API v1/api/assistants/v1/*- Assistants API v1/api/assistants/v2/*- Assistants API v2