Introduction
The listmonk API is a RESTful HTTP API that provides programmatic access to all core functionality. It enables you to manage subscribers, lists, campaigns, templates, and more from external applications. Base URL:http://your-listmonk-instance:9000/api
Key Features
RESTful Design
Standard HTTP methods (GET, POST, PUT, DELETE) for intuitive API interactions
JSON Responses
All responses are in JSON format with consistent structure
Role-Based Access
Fine-grained permissions system for secure API access
Pagination Support
Efficient data retrieval with pagination for large datasets
Response Format
All successful API responses follow this structure:Error Handling
Error responses include an HTTP status code and a JSON body with error details:Common HTTP Status Codes
| Status Code | Description |
|---|---|
200 | Success |
201 | Created successfully |
400 | Bad request - invalid parameters |
401 | Unauthorized - authentication required |
403 | Forbidden - insufficient permissions |
404 | Resource not found |
500 | Internal server error |
Content Types
The API accepts and returns JSON data: Request Header:Pagination
List endpoints support pagination with query parameters:page- Page number (default: 1)per_page- Results per page (default: 20, max: 100)
Filtering and Searching
Many endpoints support filtering with query parameters: Subscribers:query- Search by name or emaillist_id- Filter by list membershipsubscription_status- Filter by status (confirmed, unconfirmed, unsubscribed)
query- Search by nametype- Filter by type (public, private, temporary)tags- Filter by tags
query- Search by namestatus- Filter by status (draft, running, scheduled, paused, cancelled, finished)
Rate Limiting
listmonk does not enforce rate limiting by default, but you should implement rate limiting in your application or reverse proxy to prevent abuse.
- Per-IP rate limits
- Per-user rate limits
- Transactional email rate limits based on your SMTP provider’s limits
Health Check
Test API availability with the health endpoint:curl
Quick Start Example
Here’s a complete example of creating a subscriber and adding them to a list:Authenticate
Obtain your API credentials from the dashboard. See Authentication for details.
API Resources
Subscribers
Manage subscriber data and subscriptions
Lists
Create and manage mailing lists
Campaigns
Create, schedule, and manage email campaigns
Templates
Manage email templates
Media
Upload and manage media files
Bounces
Handle email bounces and complaints
Transactional
Send one-off transactional emails
Import
Bulk import subscribers
Best Practices
Use Appropriate HTTP Methods
Use Appropriate HTTP Methods
- GET: Retrieve data (read-only, no side effects)
- POST: Create new resources
- PUT: Update existing resources
- DELETE: Remove resources
Handle Errors Gracefully
Handle Errors Gracefully
Always check the HTTP status code and parse error messages from the response body. Implement retry logic with exponential backoff for transient errors (5xx codes).
Respect Pagination
Respect Pagination
When fetching large datasets, use pagination to avoid timeouts and excessive memory usage. Process data in chunks rather than fetching everything at once.
Validate Input
Validate Input
Validate email addresses, ensure required fields are present, and sanitize user input before sending to the API.
Secure Your API Keys
Secure Your API Keys
Store credentials securely using environment variables or secrets management systems. Never commit API keys to version control.
Next Steps
Authentication
Learn how to authenticate your API requests
Subscriber API
Start managing subscribers programmatically