---
title: "Send a push notification campaign to a OneSignal-defined audience"
method: POST
path: "/api/admin/push-campaigns/send"
tags: ["Admin Push Campaigns"]
---

# Send a push notification campaign to a OneSignal-defined audience

`POST /api/admin/push-campaigns/send`

## Request

- Base URL: `https://api.rewritelifestyle.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.rewritelifestyle.ai/api/admin/push-campaigns/send`
- Auth: HTTP bearer

Requires at least one targeting dimension (refuses to broadcast to all users). Persists a row in push_campaigns with the audit trail and returns the OneSignal-reported recipient count.

## Request body

- SendPushCampaignDto
  - `title` string, required: Notification heading. Max 80 chars recommended.
  - `body` string, required: Notification body. Max 200 chars recommended.
  - `data` object: Optional deep-link payload delivered to the app (e.g. { screen: "Subscription" })
  - `targeting` PushCampaignTargetingDto, required
    - `platforms` string[]: Restrict to platforms (OneSignal device_type). Empty = all.
    - `appVersion` string: App version, e.g. "2.4.1"
    - `appVersionOp` '=' | '!=' | '>' | '<' | '>=' | '<=': Comparison operator for appVersion. Default "=".
    - `role` string: Filter by user role tag (e.g. "client", "lead")
    - `subscriptionTier` string: Filter by subscription_tier tag
    - `isFounder` string: Filter by is_founder tag ("true" / "false")
    - `isEnrolled` string: Filter by is_enrolled tag ("true" / "false")
    - `includedSegments` string[]: OneSignal segment names (created in dashboard). Combined with filters via OR.
  - `expectedRecipientCount` number: Recipient count the admin saw in the preview. Used as a sanity check — if OneSignal returns a much larger audience the send is rejected.
  - `testUserId` number: Send only to this one user ID, bypassing targeting entirely — for trying out a campaign before sending it to a real audience. When set, `targeting` may be empty.

## Response `201`

- unknown

---

[API](https://skmtc.dev/rewritelifestyle/apis/rewrite-lifestyle-api.md) - [All operations](https://skmtc.dev/rewritelifestyle/apis/rewrite-lifestyle-api/llms.txt) - [OpenAPI document](https://skmtc.dev/rewritelifestyle/apis/rewrite-lifestyle-api/revisions/28695827f27a?raw)
