> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pushbase.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Push Notification (API)

> Push notification through REST API

Pushbase provides a REST API endpoint for sending push notifications programmatically. This is commonly used when notification content is dynamic or triggered by specific events.

### Preparing Notification Data for Push

To guarantee delivery, notification content must conform to the following format.

Only the following `title` and `body` properties are required.

```ts theme={null}
interface Device {
  title: string;
  body: string;

  /* Target audience. Default to everyone.Available from dashboard.*/
  segment_id?: number;

  /* When notification will be delivered. Default to `instant` */
  delivery?: "instant" | "scheduled";

  /* For deep linking to a custom route. default to 1 for Main Screen */
  link_id?: number;

  /*  Applied while notification is scheduled. Must be ISO 8601 datetime string.
   * Scheduled in your local time and must be future date..
   */
  scheduled_at?: string;
}
```

Follow example below on how to use our REST API to import devices for subscription.

```js theme={null}
const API_URL = "https://api.pushbase.dev/broadcasts/client-push";
const API_KEY = "YOUR_API_KEY"; // Available in Pushbase dashboard app setting section

const myHeaders = new Headers();
myHeaders.append("x-api-key", API_KEY);
myHeaders.append("Content-Type", "application/json");

/* Replace this with the subscribed device records from your existing database.
 *
 */
const notification = {
  title: "Terms & Policies updates",
  body: "We have updated our policies and terms. Review now.",

  /* Important: this is where you define target users from the dashboard.*/
  segment_id: 1,
  /* When notification will be delivered. Only `instant` and `scheduled` supported. */
  delivery: "instant",
  /* For deep linking to a custom route. default to 1 for Main Screen */
  link_id: 1,
  /*  Applied while notification is scheduled. Must be future ISO 8601 datetime string. Scheduled in your local time.*/
  scheduled_at: "2026-05-12T05:50:00",
};

const raw = JSON.stringify(notification);

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  redirect: "follow",
};

fetch(API_URL, requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

<Tip>
  Having trouble setting up or configuring the SDK? Our support team is here to
  help — [feel free to reach
  out](mailto:hello@pushbase.dev?subject=Pushbase%20Product%20Support)
</Tip>
