API Usage
Ce contenu n’est pas encore disponible dans votre langue.
This guide covers the core functionality of the Apprise API: sending notifications. You can send notifications in two ways:
- Stateless: You provide the configuration URLs in the request payload.
- Stateful: You reference a pre-saved configuration Key.
Response formats
Section titled “Response formats”By default, endpoints return text/plain. If you prefer JSON, send Accept: application/json.
For notification endpoints (/notify and /notify/{KEY}), you can also request a simple HTML log view by sending Accept: text/html. This is mainly useful for human testing in a browser.
Stateless Notifications
Section titled “Stateless Notifications”Stateless notifications are ideal for “sidecar” usage where you don’t want to manage persistent configuration on the server. You must provide the urls parameter in every request.
Basic JSON Request
Section titled “Basic JSON Request”The most common method is sending a JSON payload to /notify.
Endpoint: POST /notify
curl -X POST \ -H "Content-Type: application/json" \ -d '{ "urls": "mailto://user:pass@gmail.com", "body": "Backup completed successfully.", "title": "System Status" }' \ http://localhost:8000/notifyFile Attachments
Section titled “File Attachments”To send attachments, use multipart/form-data. The API accepts standard file uploads or remote URLs. You can use attach (recommended) or attachment as the field name.
# Upload a local filecurl -X POST \ -F "urls=discord://webhook_id/token" \ -F "body=See attached log." \ -F "attach=@/var/log/syslog" \ http://localhost:8000/notify
# Reference a remote URL (Apprise will download and forward it)curl -X POST \ -F "urls=discord://webhook_id/token" \ -F "body=Security Camera Snapshot" \ -F "attach=http://camera-ip/snapshot.jpg" \ http://localhost:8000/notifyStateful Notifications
Section titled “Stateful Notifications”Stateful notifications allow you to simplify your client code. You store the complex URLs on the server once, assigned to a Key, and your client simply references that Key.
Endpoint: POST /notify/{KEY}
Sending to a Key
Section titled “Sending to a Key”If you have saved a configuration under the key my-alerts:
curl -X POST \ -H "Content-Type: application/json" \ -d '{ "body": "Database connection failed", "type": "warning" }' \ http://localhost:8000/notify/my-alertsTagging
Section titled “Tagging”Stateful configurations support tagging, allowing you to notify specific subgroups of your saved URLs.
Logic:
- Space, +, or &: AND (intersection)
- Comma or |: OR (union)
Examples below show the two most common patterns.
# Notify services tagged "devops" OR "admin"curl -X POST -d '{"tag": "devops,admin", "body": "..."}' ...
# Notify services tagged "devops" AND "critical"curl -X POST -d '{"tag": "devops critical", "body": "..."}' ...Payload Mapping (Hooks)
Section titled “Payload Mapping (Hooks)”Sometimes you cannot change the payload format sent by a third-party tool (e.g., Grafana, Prometheus). Apprise API allows you to map incoming JSON keys to Apprise-compatible keys using URL parameters.
Syntax: ?:incoming_field=apprise_field
Example:
Your tool sends {"message": "Server Down", "severity": "high"}, but Apprise expects body and type.
curl -X POST \ -d '{"message": "Server Down", "severity": "high"}' \ "http://localhost:8000/notify/my-alerts?:message=body&:severity=type"