Overview
Bark is a push notification tool on iOS. It is free, simple, and secure, based on APNs, and does not drain battery. It supports self-hosted servers and encrypted push.
Trigger Scenarios
- The user has important matters that need to be notified
- The user explicitly requests to push with Bark
- A push notification needs to be sent to an iOS device
Prerequisites
- The user has installed the Bark App on an iOS device
- The user's Bark Key has been obtained (open the App and copy the key from the test URL)
Push Methods
Basic Push (GET Request)
https://api.day.app/{key}/{body}
https://api.day.app/{key}/{title}/{body}
https://api.day.app/{key}/{title}/{subtitle}/{body}
Parameter Description:
key: The user's Bark Keytitle: Push title (slightly larger than body)subtitle: Push subtitlebody: Push content, use for line breaks\n
POST Request
Parameter names are the same as path parameters.
Advanced Features
Click to Jump to URL
https://api.day.app/{key}/url?url=https://www.example.com
Message Grouping
https://api.day.app/{key}/group?group=groupName
Custom Icon (iOS 15+)
https://api.day.app/{key}/icon?icon=http://example.com/avatar.jpg
Custom Sound
https://api.day.app/{key}/sound?sound=alarm
Loop Sound for 30 Seconds (Call Mode)
https://api.day.app/{key}/call?call=1
Encrypted Push
https://api.day.app/{key}/ciphertext?ciphertext=加密内容
Time-Sensitive Notification
https://api.day.app/{key}/title?level=timeSensitive
Available level values:
active: Default value, immediately lights up the screen to displaytimeSensitive: Time-sensitive notification, can also be displayed in Focus modepassive: Only added to the notification list, does not light up the screen
Critical Alert
https://api.day.app/{key}/title?level=critical
Ignores silent and Do Not Disturb modes, always plays sound and displays notification.
Push Script
Simple Push Script
#!/bin/bash
# bark_push.sh - Bark 推送脚本
KEY="${1:-your-bark-key}"
TITLE="${2:-通知}"
BODY="${3:-内容}"
# URL 编码
TITLE_ENCODED=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$TITLE'))")
BODY_ENCODED=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$BODY'))")
curl -s "https://api.day.app/${KEY}/${TITLE_ENCODED}/${BODY_ENCODED}"
Usage Example
# 简单推送
./bark_push.sh "your-key" "标题" "内容"
# 带跳转 URL
curl "https://api.day.app/your-key/url?url=https://example.com"
# 时效性通知
curl "https://api.day.app/your-key/提醒?level=timeSensitive"
Notes
- First-time use requires obtaining the user's Bark Key
- Time-sensitive notifications and critical alerts require user authorization in iOS Settings
- Self-hosted server users need to replace
api.day.appwith the self-hosted server address - It is recommended to URL-encode special characters in push content