The curl guide to trigger.fyi
The entire trigger.fyi API is a POST request. Everything available in the SDK is available via curl. Here’s the complete reference.
Plain text (simplest)
curl -X POST "https://trigger.fyi/$TRIGGER_FYI_SECRET_KEY" \
-d "Your message here"The body is the notification title — bold on the lock screen.
With a detail line
curl -X POST "https://trigger.fyi/$TRIGGER_FYI_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"title":"Job complete","body":"847 records in 4m 12s"}'body appears below the app name on the notification. On iOS: your-app · body text.
Levels
# Normal push (default)
curl -X POST "https://trigger.fyi/$TRIGGER_FYI_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"title":"Deploy complete","level":"normal"}'
# Feed only — no push, no lock screen
curl -X POST "https://trigger.fyi/$TRIGGER_FYI_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"title":"Cache warmed","level":"log"}'
# Urgency high
curl -X POST "https://trigger.fyi/$TRIGGER_FYI_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"title":"Payment failed","level":"critical","body":"[email protected]"}'Levels: normal (default), log (feed only), critical (urgency high).
With metadata
curl -X POST "https://trigger.fyi/$TRIGGER_FYI_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "New signup",
"body": "[email protected]",
"meta": {
"plan": "pro",
"country": "US",
"source": "organic"
}
}'Metadata is filterable in the feed and TUI. Filter by plan: pro to see only pro signups.
Test flag
curl -X POST "https://trigger.fyi/$TRIGGER_FYI_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"title":"Test notification","test":true}'Test events push and appear in the feed, but are excluded from the “no events yet” empty state. Used for pipe verification.
In a shell script
#!/bin/bash
KEY="${TRIGGER_FYI_SECRET_KEY:-}"
notify() {
[ -z "$KEY" ] && return
curl -s -X POST "https://trigger.fyi/$KEY" \
-H "Content-Type: application/json" \
-d "{\"title\":\"$1\",\"body\":\"${2:-}\"}" \
&>/dev/null &
}
notify_critical() {
[ -z "$KEY" ] && return
curl -s -X POST "https://trigger.fyi/$KEY" \
-H "Content-Type: application/json" \
-d "{\"title\":\"$1\",\"body\":\"${2:-}\",\"level\":\"critical\"}" \
&>/dev/null
}
notify "Starting backup"
rsync -az /data/ /backup/ || { notify_critical "Backup failed" "rsync exit $?"; exit 1; }
notify "Backup complete" "$(du -sh /backup | cut -f1)"&>/dev/null & sends the curl in the background. The script doesn’t wait for the notification.
Escaping in shell
Quoting JSON in shell is error-prone. Use a heredoc or a temp file for complex payloads:
# Heredoc
PAYLOAD=$(cat <<EOF
{
"title": "Deploy complete",
"body": "$(git rev-parse --short HEAD)",
"meta": {
"branch": "$(git rev-parse --abbrev-ref HEAD)",
"env": "production"
}
}
EOF
)
curl -s -X POST "https://trigger.fyi/$TRIGGER_FYI_SECRET_KEY" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"Response format
A successful send returns 200 OK with:
{ "ok": true }Errors return a non-200 status with an error message. The SDK swallows these — in curl, check $? or the HTTP status with -w "%{http_code}".
Key from environment
Don’t hardcode the key in scripts:
# In ~/.bashrc or ~/.zshrc
export TRIGGER_FYI_SECRET_KEY="your_key_here"
# In scripts — read from environment
curl -X POST "https://trigger.fyi/$TRIGGER_FYI_SECRET_KEY" -d "Done"Or store it in a .env file and source it:
source .env
curl -X POST "https://trigger.fyi/$TRIGGER_FYI_SECRET_KEY" -d "Done"Related: Push notifications from bash · Push notifications from Python · GitHub Actions notifications · What is trigger.fyi?