Sending pushes
Every way to send a push to Opush, what the server returns, and how errors and limits work.
You send a push with one HTTP request to https://opu.sh. There are several ways to write that request. They all accept the same parameters and produce the same notification, so pick whichever fits your tool.
The push URL uses the common format and parameter names, so tools that send pushes by URL (Uptime Kuma, Apprise, iOS Shortcuts, your own scripts) work with Opush too.
Path segments (GET)
Put the text right in the URL. This is the quickest way to send from a terminal or a tool that only takes a URL.
| URL | What you get |
|---|---|
https://opu.sh/YOUR_KEY/<body> | Body only |
https://opu.sh/YOUR_KEY/<title>/<body> | Title and body |
https://opu.sh/YOUR_KEY/<title>/<subtitle>/<body> | Title, subtitle, and body |
curl https://opu.sh/YOUR_KEY/Server%20alert/prod-1/CPU%20at%2095%25URL-encode each segment. If your text contains / or is long, use query parameters or JSON instead.
Query parameters (GET)
Add any parameter to the query string. You can mix this with path segments.
curl "https://opu.sh/YOUR_KEY/Disk%20almost%20full?group=servers&level=timeSensitive&url=https://grafana.example.com"You can also put everything in the query:
curl "https://opu.sh/YOUR_KEY?title=Build%20passed&body=main%20%23128&group=ci"Form data (POST)
Send the parameters as application/x-www-form-urlencoded or multipart/form-data. curl --data-urlencode handles the encoding for you.
curl -X POST https://opu.sh/YOUR_KEY \
--data-urlencode "title=Nightly report" \
--data-urlencode "body=3 new signups, 0 errors" \
--data-urlencode "group=reports"POST also works on the path forms, such as https://opu.sh/YOUR_KEY/<title>/<body>. The extra parameters go in the request body.
JSON (POST)
Send a JSON body to https://opu.sh/push with your key in device_key. This is the cleanest option for code: no URL encoding, and numbers can be real numbers.
curl -X POST https://opu.sh/push \
-H "Content-Type: application/json" \
-d '{
"device_key": "YOUR_KEY",
"title": "Payment failed",
"body": "Invoice #1042 for $49.00",
"level": "timeSensitive",
"group": "billing"
}'/push accepts POST only. You can also POST JSON to https://opu.sh/YOUR_KEY, in which case you don't need device_key in the body.
Several devices at once
To send the same push to more than one device, use device_keys in a JSON body sent to /push. It can be an array or a comma-separated string.
curl -X POST https://opu.sh/push \
-H "Content-Type: application/json" \
-d '{
"device_keys": ["KEY_FOR_IPHONE", "KEY_FOR_ANDROID"],
"title": "Release v2.0 is out"
}'device_keys only works in a JSON body. There is a maximum number of keys per request. If you go over it, you get a 400 error that states the limit.
When the same push reaches several devices on one account, opening or dismissing it on one device clears it on the others.
How parameters are combined
You can put a parameter in the path, the query, and the body at the same time. When the same name appears more than once, this order wins:
- Path segments
- Query string
- Request body (form or JSON)
Parameter names are not case-sensitive: isArchive and isarchive are the same.
Responses
Every response is JSON in the push response format (code, message, timestamp). The HTTP status matches code.
{ "code": 200, "message": "success", "timestamp": 1793546000 }| Field | Meaning |
|---|---|
code | Same as the HTTP status |
message | success on success. scheduled when the push was scheduled for later. Otherwise a short English explanation of the error. |
timestamp | Server time in Unix seconds |
data | Extra details, only when there is something to report (for example, the schedule ID and time) |
A batch request (device_keys) always returns 200. Check each device in data:
{
"code": 200,
"message": "success",
"timestamp": 1793546000,
"data": [
{ "code": 200, "device_key": "KEY_FOR_IPHONE" },
{ "code": 400, "device_key": "KEY_FOR_ANDROID", "message": "failed to get device token: device key not found" }
]
}Errors
| Status | When it happens | What to do |
|---|---|---|
400 | The key doesn't exist, a parameter is invalid (for example, a broken button), or the JSON can't be parsed | Read message, fix the request |
403 | The account was suspended, or the device already has as many scheduled pushes as your plan allows | Contact support, or cancel a schedule |
404 | The URL isn't a push URL (the key must be exactly 22 letters and digits) | Copy the push URL again from the app or web console |
413 | The push is larger than 4096 bytes, the limit set by Apple's push service | Shorten the text, or move long content behind a url |
429 | Too many pushes in a short time, or your plan's pushes for today are used up | Wait for the number of seconds in the Retry-After header, then retry. For the daily limit, that can be until midnight UTC |
500 | Delivery to Apple or Google failed | Retry later |
503 | The device can't be reached (its push token expired), or the server is busy | Open the Opush app on the device to refresh its token. If the server is busy, wait for Retry-After |
A 503 saying the device is unreachable keeps coming back until the app is opened on that device.
Limits
- Each push must fit in 4096 bytes after Opush builds the notification.
- Each device can receive a limited number of pushes per minute. Over that, you get
429withRetry-After. - Your plan also sets how many pushes you can send. See Pricing.
Don't hard-code limits in your scripts. Handle 429 and retry after the time the server tells you.
Health checks
These endpoints help monitoring tools and push clients check the server:
| Endpoint | Response |
|---|---|
GET https://opu.sh/ping | { "code": 200, "message": "pong", ... } |
GET https://opu.sh/healthz | Plain text ok |
GET https://opu.sh/info | Server version |