Skip to main content

Notifications API

POST /v1/notifications

Secret key, scope notifications:send. Rate-limited per key. Accepts Idempotency-Key.

{
"target": { "externalIds": ["user_123", "user_456"] },
"content": {
"en": {
"title": "Your order is on its way",
"body": "Order #48213 ships today. Track it in the app.",
"url": "acme://orders/48213",
"image": "https://cdn.acme.example/orders/48213.jpg",
"actions": [{ "id": "track", "title": "Track" }, { "id": "help", "title": "Help", "url": "acme://support" }]
},
"tr": { "title": "Siparişin yola çıktı", "body": "#48213 bugün kargoda." },
"_default": "en"
},
"data": { "screen": "order", "id": "48213" },
"ttl": 86400,
"collapseId": "order-48213",
"priority": "high",
"presentation": { "sound": "default", "badge": 1, "threadId": "orders", "icon": "https://cdn.acme.example/icon.png" },
"bypass": { "quietHours": true }
}

target — exactly one selector

SelectorTypeLimit
externalIdsstring[]1–1000
userIdsObjectId[]1–1000
subscriptionIdsObjectId[]1–1000
segmentsegment node
segmentIdObjectId of a saved segment
alltrue

Users resolve to all their opted-in, non-invalidated devices.

Other fields

FieldTypeDefaultNotes
contentcontent mapone of content / templateId / silentContent. Placeholders allowed.
templateIdObjectIdCopy and defaults from a template; fields in the request override
silentbooleanfalseBackground push, no alert; content optional; web skipped. Silent pushes
dataRecord<string,string>keys ≤ 64, values ≤ 1024 chars
ttlint seconds2592000 – 2 419 200 (4 weeks)
collapseIdstring ≤ 64
priority"high" | "normal""high"delivery urgency (APNs 10/5, FCM high/normal)
presentationobjectsound, badge (0–99999), threadId, icon, interruptionLevel (passive|active|time-sensitive|critical), relevanceScore (0–1), channelId
bypass{ frequencyCap?, quietHours? }Delivery rules

Response 202 Accepted

{ "id": "66f3…", "status": "sending" }

id is a campaign id (transactional: true). Poll GET /v1/campaigns/:id/stats for the outcome, or subscribe to webhooks.

Errors

StatusCodeWhy
401unauthorizedmissing/invalid key
403forbiddenpublic key, or missing notifications:send
422invalid_bodysee details[] — most often target (zero or two selectors) or content._default
429rate_limitedper-key limit
409 / 422idempotency_in_progress / idempotency_key_reusedIdempotency
503database_unavailableMongo down

Examples

Everyone, silent data-only refresh (badge only, no sound):

{ "target": { "all": true }, "content": { "en": { "title": "Sync", "body": "Refreshing" }, "_default": "en" },
"presentation": { "sound": "none", "badge": 0 }, "priority": "normal", "bypass": { "frequencyCap": true, "quietHours": true } }

A segment:

{ "target": { "segment": { "and": [ { "field": "tags.plan", "op": "eq", "value": "trial" }, { "field": "createdAt", "op": "lt", "value": "-13d" } ] } },
"content": { "en": { "title": "Your trial ends tomorrow", "body": "Keep your streak — upgrade today.", "url": "acme://upgrade" }, "_default": "en" } }