Overview
The Files API allows you to upload, download, and manage files for use in conversations, agents, and assistants. All file endpoints are prefixed with/api/files.
Upload File
Upload a file to LibreChat:Request Body (Multipart Form Data)
File to upload
Endpoint to associate file with (e.g.,
openAI, anthropic)Agent ID to attach file to
Assistant ID to attach file to
Tool resource type (e.g.,
code_interpreter, file_search)Whether this is a temporary message attachment (vs permanent agent file)
Custom file ID (optional, will be auto-generated if not provided)
Response
Unique file identifier
Original filename
Server file path
MIME type
File size in bytes
Owner user ID
Upload timestamp
List Files
Retrieve all files for the authenticated user:Response
Returns an array of file objects:Get Agent Files
Retrieve files attached to a specific agent:Path Parameters
Agent ID
Response
Returns an array of files attached to the agent (excludes thetext field for performance).
Download File
Download a file:Path Parameters
User ID who owns the file
File ID to download
Response
Returns the file with appropriate headers:Download Code Output
Download output from code interpreter:Path Parameters
Code execution session ID (21 characters, alphanumeric with - and _)
File ID from code execution (21 characters, alphanumeric with - and _)
Response
Streams the code output file.Delete Files
Delete one or more files:Request Body
Array of file objects to delete
File ID (must be UUID or OpenAI format:
file-*, assistant-*)File path on server
Agent ID (for unlinking files from agent)
Assistant ID (for unlinking files from assistant)
Tool resource to unlink from (e.g.,
code_interpreter, file_search)Response
Authorization
- Users can delete their own files
- Users with EDIT permission on an agent can delete files attached to that agent
- Users with EDIT permission on an assistant can delete files attached to that assistant
Get File Configuration
Retrieve file upload configuration:Response
File support configuration per endpoint
Maximum file size in bytes
Supported MIME types
File Sources
LibreChat supports multiple file storage backends:Local Storage
Amazon S3
OpenAI Files
Azure OpenAI
Code Execution Output
Supported File Types
Images
image/pngimage/jpegimage/webpimage/gif
Documents
application/pdftext/plaintext/markdowntext/csvapplication/json
Code Files
text/x-pythontext/javascripttext/x-typescripttext/htmltext/css
Office Documents
application/vnd.openxmlformats-officedocument.wordprocessingml.document(DOCX)application/vnd.openxmlformats-officedocument.spreadsheetml.sheet(XLSX)application/vnd.openxmlformats-officedocument.presentationml.presentation(PPTX)
File Size Limits
Default limits (configurable per deployment):- Single file: 10 MB
- Total per conversation: 50 MB
- Assistant files: 50 MB per file
- Images: 20 MB per file
Rate Limiting
File upload endpoints have specific rate limits:- IP-based limit: Protects against abuse from single IP
- User-based limit: Limits uploads per authenticated user
- Speech endpoints: Separate limits for STT/TTS