This document provides a comprehensive reference for MouseTrap's REST API endpoints. The API is built with FastAPI and serves both the web UI and potential external integrations.
- Default:
http://localhost:39842/api - Configurable via
PORTenvironment variable
Currently, MouseTrap does not implement authentication. All endpoints are publicly accessible on the configured port.
List all configured sessions.
Response:
[
{
"label": "session-name",
"mam_id": "your_mam_id",
"session_type": "auto",
"mam_ip": "1.2.3.4",
"check_frequency": 30
}
]Get detailed configuration for a specific session.
Parameters:
label(path): Session label/name
Response:
{
"label": "session-name",
"mam_id": "your_mam_id",
"session_type": "auto",
"mam_ip": "1.2.3.4",
"check_frequency": 30,
"perk_automation": {
"min_points": 0,
"upload_credit": {
"enabled": false,
"gb": 1,
"trigger_type": "time",
"trigger_days": 7
},
"vip": {
"enabled": false,
"weeks": 4,
"trigger_type": "time",
"trigger_days": 7
}
},
"proxy_label": null
}Create or update a session configuration.
Parameters:
label(path): Session label/name
Request Body:
{
"mam_id": "your_mam_id",
"session_type": "auto",
"mam_ip": "1.2.3.4",
"check_frequency": 30,
"proxy_label": null
}Delete a session configuration.
Parameters:
label(path): Session label/name
Get the current status for a specific session.
Query Parameters:
label(required for session data): Session label to query. If omitted, the response returnsconfigured: falsealong with a list of available session labels.force(optional): Set to1to bypass the cache and perform a fresh status check immediately.
Response (configured session):
{
"configured": true,
"status_message": "OK",
"mam_id": "your_mam_id",
"points": 50000,
"mam_cookie_exists": true,
"wedge_active": false,
"vip_active": true,
"current_ip": "1.2.3.4",
"current_ip_asn": "12345",
"mam_session_as": "AS12345 Some ISP",
"mam_seen_asn": "12345",
"mam_seen_as": "AS12345 Some ISP",
"configured_ip": "1.2.3.4",
"configured_asn": "12345",
"check_freq": 15,
"last_check_time": "2025-09-04T12:00:00+00:00",
"next_check_time": "2025-09-04T12:15:00+00:00",
"auto_update_seedbox": null,
"details": {},
"detected_public_ip": "1.2.3.4",
"detected_public_ip_asn": "12345",
"detected_public_ip_as": "AS12345 Some ISP",
"proxied_public_ip": null,
"proxied_public_ip_asn": null,
"proxied_public_ip_as": null,
"ip_monitoring_mode": "auto"
}Response (no label provided or label not found):
{
"configured": false,
"status_message": "No session label provided. Use ?label=<name>. Available sessions: [\"Primary\"]",
"available_sessions": ["Primary"],
"last_check_time": null,
"next_check_time": null,
"details": {},
"detected_public_ip": "1.2.3.4",
"detected_public_ip_asn": "12345"
}Manually trigger seedbox update for a session.
Parameters:
label(path): Session label/name
Test ASN mismatch notification for a session (debugging/testing only).
Request Body:
{
"label": "session-name"
}Response:
{
"success": true,
"message": "Test ASN mismatch notification sent for session 'session-name'"
}Notes:
- Only works for ASN Locked sessions
- Sends test notification via configured notification channels
- Simulates ASN mismatch detection scenario (403 error due to ASN change)
- Use for testing notification delivery without waiting for actual ASN changes
Update automation settings for a session.
Parameters:
label(path): Session label/name
Request Body:
{
"min_points": 10000,
"upload_credit": {
"enabled": true,
"gb": 50,
"trigger_type": "time",
"trigger_days": 14
},
"vip": {
"enabled": true,
"weeks": 8,
"trigger_type": "points",
"trigger_point_threshold": 30000
}
}Manually trigger a purchase.
Parameters:
label(path): Session label/nameitem_type(path): One ofupload,vip
Request Body (for upload credit):
{
"gb": 50
}Request Body (for VIP):
{
"weeks": 4
}List all configured proxies.
Response:
{
"proxy-name": {
"host": "proxy.example.com",
"port": 8080,
"username": "user",
"password": "pass"
}
}Create or update proxy configuration.
Request Body:
{
"label": "proxy-name",
"host": "proxy.example.com",
"port": 8080,
"username": "user",
"password": "pass"
}Delete a proxy configuration.
Parameters:
label(path): Proxy label/name
Test a proxy and return detected IP.
Parameters:
label(path): Proxy label/name
Response:
{
"success": true,
"detected_ip": "1.2.3.4",
"asn": "AS12345",
"message": "Proxy test successful"
}List all port monitoring configurations.
Response:
[
{
"name": "gluetun-monitor",
"primary_container": "gluetun",
"primary_port": 8080,
"secondary_containers": ["qbittorrent", "prowlarr"],
"interval": 5,
"public_ip": null,
"status": "OK",
"last_check": "2025-09-04T12:00:00Z"
}
]Create a new port monitoring configuration.
Request Body:
{
"name": "monitor-name",
"primary_container": "container_name",
"primary_port": 8080,
"secondary_containers": ["container2", "container3"],
"interval": 5,
"public_ip": "1.2.3.4"
}Update an existing port monitoring configuration.
Delete a port monitoring configuration.
Parameters:
name(path): Monitor configuration name
List all available Docker containers.
Response:
[
{
"name": "gluetun",
"status": "running",
"id": "container_id_here"
}
]Get current notification configuration.
Response:
{
"email": {
"enabled": true,
"smtp_server": "smtp.gmail.com",
"smtp_port": 587,
"username": "user@gmail.com",
"recipient": "recipient@gmail.com"
},
"webhook": {
"enabled": true,
"url": "https://discord.com/api/webhooks/...",
"discord": true
},
"event_rules": {
"automation_success": {
"email": false,
"webhook": true
},
"automation_failure": {
"email": true,
"webhook": true
}
}
}Update notification configuration.
Test email notification configuration.
Test webhook notification configuration.
Test Apprise notification configuration.
Test Pushover notification configuration.
Raises: 400 if user_key or api_token are not configured.
Retrieve event log entries.
Query Parameters:
filter(optional): Filter by session label or "global"limit(optional): Number of entries to return (default: 50)
Response:
[
{
"timestamp": "2025-09-04T12:00:00Z",
"event": "automation_success",
"event_type": "automation_success",
"label": "session-name",
"details": "VIP purchase successful (4 weeks)",
"status": "success",
"auto_update": "N/A"
}
]Clear all event log entries.
Basic health check endpoint.
Response:
{
"status": "healthy",
"timestamp": "2025-09-04T12:00:00Z"
}Get application version information.
Response:
{
"version": "1.0.0",
"build_date": "2025-09-04",
"git_commit": "abc123"
}All endpoints may return error responses in the following format:
{
"success": false,
"error": "Error message describing what went wrong",
"details": "Additional technical details (optional)"
}Common HTTP status codes:
200: Success400: Bad Request (invalid parameters)404: Not Found (session/proxy/monitor not found)500: Internal Server Error
MouseTrap implements internal rate limiting for MaM API calls:
- Status checks: Maximum once per hour per session
- Seedbox updates: Maximum once per hour per session
- Purchase attempts: No built-in rate limiting (respects MaM's limits)
Rate limiting information is included in status responses when active.