How to Send Notifications to Gotify Using CURL

Learn how to quickly send notifications to your Gotify server using the curl command.

Prerequisites

  • A running Gotify server
  • Your Gotify server’s IP address and port
  • An application token from your Gotify server

Basic Command Structure

curl -X POST "http://<IP>:<PORT>/message?token=<TOKEN>" \
     -F "title=<TITLE>" \
     -F "message=<MESSAGE>"

Replace the placeholders with your specific details:

  • <IP>: Your Gotify server’s IP address
  • <PORT>: Your Gotify server’s port number
  • <TOKEN>: Your Gotify application token
  • <TITLE>: Notification title
  • <MESSAGE>: Notification content

Example

curl -X POST "http://192.168.1.100:8080/message?token=AbC123XyZ" \
     -F "title=Backup Alert" \
     -F "message=Weekly backup completed successfully"

Tips

  • Use double quotes around the entire URL to handle special characters.
  • For complex messages, consider storing the content in a variable:
message="Line 1\nLine 2\nLine 3"
curl -X POST "http://<IP>:<PORT>/message?token=<TOKEN>" \
     -F "title=Multiline Message" \
     -F "message=$message"

Further Reading

For advanced usage and additional parameters, refer to the Gotify API documentation.