> For the complete documentation index, see [llms.txt](https://user.netmera.com/netmera-developer-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://user.netmera.com/netmera-developer-guide/api-documentation/recipes/targeting-by-segment-or-profile.md).

# Targeting a Push Campaign by Segment or Profile Attribute

Send a push to a segment or to users that match profile attributes, optionally scheduled.

This recipe shows how to send a push notification to a segment, or to the users whose profile attributes match your conditions, and how to schedule the send for a later time. Segments and profile attributes let Netmera select the audience, so your request does not carry user lists.

## When to Use

This recipe fits campaigns where the audience is defined by behavior or by profile data, such as frequent users or users who chose a language. To define the audience from your own backend with a tag, see [Sending a Push Campaign to a Tagged Audience](/netmera-developer-guide/api-documentation/recipes/sending-push-to-tagged-audience.md).

## Prerequisites

* REST API key of the application
* For segment targeting: a segment created in the Netmera panel or with `createSegment`, whose `segmentStatus` is `READY`. See [Creating and Managing Segments](/netmera-developer-guide/api-documentation/recipes/creating-and-managing-segments.md).
* For profile targeting: the codes of the profile attributes, available in the panel under **Developers > Profile Attributes > Code** or from `app/profile-attributes`

## Step 1: Send to a Segment

Set the segment in the `target` object of `sendBulkNotification`.

```bash
curl https://restapi.netmera.com/rest/3.0/sendBulkNotification \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'X-netmera-api-key: <API_KEY>' \
  --data '{
  "message": {
    "title": "Exclusive Offer",
    "text": "Enjoy an exclusive offer for frequent users.",
    "platforms": ["IOS", "ANDROID"]
  },
  "target": {
    "segment": "frequent_users"
  }
}'
```

To reach several segments in one send, pass an array, for example `"segment": ["frequent_users", "churn"]`.

{% hint style="info" %}
The segments in `target.segment` are checked before the campaign is created. A request that names a deleted segment, a segment that does not exist, or a segment that has never been calculated returns HTTP 400, and no campaign is created. When `target.segment` is a list, one failing segment rejects the whole request. A segment that is being calculated again after an update is accepted with its previous user list.
{% endhint %}

**Expected result:** The request is accepted and returns a `notificationKey`.

## Step 2: Send by Profile Attributes

To select users by their profile data, set `target.profile` with one or more attributes.

```bash
curl https://restapi.netmera.com/rest/3.0/sendBulkNotification \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'X-netmera-api-key: <API_KEY>' \
  --data '{
  "message": {
    "title": "Special Offer",
    "text": "Check out our offer.",
    "platforms": ["IOS", "ANDROID"]
  },
  "target": {
    "profile": {
      "language": ["English", "Turkish"],
      "name": "John"
    }
  }
}'
```

The notification is sent to the users who satisfy **all** attributes in `target.profile`. When an attribute is an array attribute, a single value targets users whose attribute contains that value, and an array of values targets users whose attribute contains any of them.

{% hint style="warning" %}
The `target` object cannot be empty. To send a notification to all users, use `"sendToAll": true`.
{% endhint %}

**Expected result:** The request is sent with the profile conditions in `target.profile`.

## Step 3: Schedule the Send

To deliver the message at a later time, add a `schedule` object to the request of Step 1 or Step 2.

```json
"schedule": {
  "startTime": "2026-11-01T15:30:00",
  "localTimezone": false
}
```

**Expected result:** The notification is scheduled for the given date and time.

## Step 4: Read the Delivery Statistics

The response contains the `notificationKey`. Pass it to `getPushStats` as shown in [Sending a Push Campaign to a Tagged Audience](/netmera-developer-guide/api-documentation/recipes/sending-push-to-tagged-audience.md).

## Verification Checklist

* The segment name matches the segment in the panel
* `getSegment` returns `segmentStatus` `READY` for a segment created or reopened through the REST API
* Profile attribute keys match the codes of the attributes
* All conditions in `target.profile` are intended to apply together
* `target` is not empty
* `platforms` lists every platform that should receive the message

## Related Pages

For all targeting options, see the Bulk Notifications with Features section of the [Notifications](/netmera-developer-guide/api-documentation/rest-api/notifications.md) page. To create the segments that this recipe targets, see [Creating and Managing Segments](/netmera-developer-guide/api-documentation/recipes/creating-and-managing-segments.md). To set the profile attributes that this recipe targets, see [Registering Users and Building a Profile](/netmera-developer-guide/api-documentation/recipes/registering-users-and-profiles.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://user.netmera.com/netmera-developer-guide/api-documentation/recipes/targeting-by-segment-or-profile.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
