Send push notifications from your server
The push REST API: send or schedule a notification to users, tags or platforms with POST /v1/push/messages, then read its status and results.
Order updates, chat messages and reminders come from your backend. Send them with one request to POST /v1/push/messages — the same notifications the dashboard sends, marked API in the list.
Authentication#
Use your app's secret API key from Settings → App credentials (sk_live_…) — see API keys. Keep it on your servers, never in the app.
Authorization: Bearer sk_live_…
Send a notification#
curl -X POST https://app.codeonair.com/v1/push/messages \
-H "Authorization: Bearer sk_live_…" \
-H "Content-Type: application/json" \
-d '{
"title": "Your order has shipped 📦",
"body": "Arriving Thursday. Track it in the app.",
"url": "/orders/1042",
"data": { "order_id": "1042" },
"audience": { "user_ids": ["user_1024"] }
}'{
"id": "push_…",
"source": "api",
"name": null,
"title": "Your order has shipped 📦",
"body": "Arriving Thursday. Track it in the app.",
"image_url": null,
"url": "/orders/1042",
"data": { "order_id": "1042" },
"options": {},
"audience": { "user_ids": ["user_1024"] },
"status": "scheduled",
"scheduled_at": "2026-10-25T09:30:00.000Z",
"stats": { "targeted": 0, "sent": 0, "failed": 0, "opened": 0, "open_rate": 0 },
"errors": {},
"error": null,
"created_at": "2026-10-25T09:30:00.000Z",
"started_at": null,
"completed_at": null
}Sending happens in the background, so the response comes straight back. A notification sent “now” is created as scheduled for the current time, moves to sending within seconds and ends as sent (or failed if nothing could be delivered). Read it again with GET /v1/push/messages/:id to see stats and errors.
Request fields#
| Field | Meaning |
|---|---|
title | Required. Up to 150 characters. |
body | Up to 1,000 characters. |
image_url | An https:// image URL (under 1 MB). |
url | Opened on tap: https://…, your scheme (myapp://…) or a path starting with /. Empty opens the app. |
data | Up to 20 string values for your app; keys can't start with coa_, google. or gcm.. Under 3 KB. |
options | sound (true/false), badge (0–9999), android_channel, ttl_seconds (0–2,419,200), collapse_key. |
audience | Who gets it — see below. Empty or missing: everyone who allowed notifications. |
send | "now" (default), "schedule" (with scheduled_at) or "draft". |
scheduled_at | With send: "schedule" — an ISO 8601 date and time, in the future and at most 90 days ahead. |
name | Optional internal name shown in the dashboard. |
Audience
| Field | Selects |
|---|---|
platforms | ["ios"], ["android"] or both. |
user_ids | Devices of these users (the user ID your app sets). Up to 10,000. |
tags | Devices with these tags (up to 50); tags_match is "any" (default) or "all". |
device_ids | Specific devices (dev_…), up to 100 — e.g. from the Devices page. |
Filters combine: a device must match all the ones you give.
{
"title": "Your cart is waiting",
"body": "Checkout in one tap — your items are saved.",
"audience": { "platforms": ["android"], "tags": ["vip"] },
"send": "schedule",
"scheduled_at": "2026-11-01T10:00:00+05:30"
}Endpoints#
| Method | Path | What it does |
|---|---|---|
| POST | /v1/push/messages | Send, schedule or save a draft |
| GET | /v1/push/messages?status=&source=&before= | The latest 50, newest first; before= an ISO date for older ones |
| GET | /v1/push/messages/:id | One notification with its stats and errors |
| PATCH | /v1/push/messages/:id | Change a draft or scheduled one (send only the fields to change) |
| POST | /v1/push/messages/:id/cancel | Cancel a draft, scheduled or sending notification |
| DELETE | /v1/push/messages/:id | Delete a draft or cancelled one (204) |
| POST | /v1/push/audience | { audience } → how many devices it reaches now |
Errors#
Errors use the same shape as the rest of the API: { "error": { "code": "…", "message": "…" } }.
| Status | Code | When |
|---|---|---|
| 400 | invalid_title, invalid_url, invalid_data, invalid_audience, invalid_schedule… | A field is invalid — the message says which and why. |
| 401 | unauthorized | Missing or wrong API key — or only an App ID was sent. |
| 403 | forbidden | A publishable key was used; these endpoints need the secret key. |
| 404 | not_found | No notification with that id in this app. |
| 409 | not_editable, not_cancellable, not_deletable | It has already been sent (or isn't a draft / cancelled). |
| 429 | rate_limited | More than 600 requests a minute with one key. |
error says “Your plan's monthly push limit was reached.”