# Group Push Notification API

Send push notifications to a group of Indie Push subscribers using the Group Push Notification API.

> **Required:**
>
> You must follow the [Indie Registration
> Guide](/docs/indie-push-notifications/registration) instructions before using
> the API listed on this page. Group Push APIs will not work without first
> following the [Indie Registration
> Guide](/docs/indie-push-notifications/registration)

## Prerequisites

1. **Create a free Native Notify account**

   Create a free [NativeNotify.com](https://dashboard.nativenotify.com/sign-up-one)
   account to get your Native Notify App ID and App Token.

## Send Group Push Notification API

Send push notifications to a group of Indie Push subscribers using the Group Push Notification API below.

Post to this URL:

```bash
https://app.nativenotify.com/api/indie/group/notification
```

Use this POST body:

```bash
{
  subIDs: ['indie-sub-id-1', 'indie-sub-id-2', 'indie-sub-id-3'],
  appId: app-id-number,
  appToken: "app-token-string",
  title: 'put your push notification title here as a string',
  message: 'put your push notification message here as a string'
}
```

You can also send an optional pushData object with your post. Here's an example:

```bash
{
  ...,
  pushData: '{ "yourProperty": "yourPropertyValue" }'
}
```

**Notes:**

- Push notifications will NOT work on an emulator/simulator. Push notifications only work on an actual device.
- Send the body as JSON with the `Content-Type: application/json` header. axios sets it for you; `fetch` and server languages such as Python must set it — without it the server cannot read your `appId` / `appToken` and answers `401`.
- The endpoint also accepts `bigPictureURL` and Expo's modern message fields (`subtitle`, `badge`, `ttl`, `expiration`, `interruptionLevel`, `categoryId`, `channelId`, `collapseId`, `contentAvailable`, `mutableContent`, `sound`) — see [Rich Notifications](/docs/rich-notifications).

### Response

- `201` with the text `Success!` — the push went out to the registered IDs in the list. IDs that are not registered to the app are skipped without an error, so check them first with the [Get ONE Successfully Registered ID](/docs/indie-push-notifications/api#get-one-successfully-registered-id) API when it matters.
- `201` with an explanation and **nothing sent** when the account's free trial has ended, or when the membership does not include group pushes. Check that the body is exactly `Success!`.
- `400` — `subIDs` missing or not an array, a missing `title` / `message`, an invalid rich field, or a payload over Expo's 4 KiB limit.
- `401` — the `appId` / `appToken` pair does not match an app.
