---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://appmetrica.yandex.com/docs/en/mobile-api/push/use-cases.md
  - https://appmetrica.yandex.com/docs/ru/mobile-api/push/use-cases.md
---
> **Documentation Index:** Fetch the complete configuration index at https://appmetrica.yandex.com/docs/en/llms.txt

# Use cases

## Creating a group {#create}

To send a push message you should define the unique name of the group. Each sending is owned by any created group. It allows you to group message sendings in the report.

To create a group make the following request [`POST /push/v1/management/groups`](https://appmetrica.yandex.com/docs/en/mobile-api/push/post-groups.md):

```
curl -X POST \
  'https://push.api.appmetrica.yandex.net/push/v1/management/groups' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: OAuth <your_token>' \
  -d '{"group":{"app_id":XXXXXX,"name":"the_name_of_the_group"}}'
```

where `<your_token>` is an OAuth token that can be obtained using [instructions](https://appmetrica.yandex.com/docs/en/mobile-api/intro/authorization.md#get-oauth-token).

If the request is successful, you will receive a response that looks like:

```
{
  "group": {
    "id": XXXXXX,
    "app_id": XXXXXX,
    "name": "the_name_of_the_group"
  }
}
```

The received `group_id` must be used for further push messages sending.

## Sending a push message {#send-push}

To send a push you should specify the group ID and a dispatch tag. Multiple dispatches can have the same tag. The tag is an arbitrary string displayed in reports at the second level.

To send a push message, make the following request [`POST /push/v1/send-batch`](https://appmetrica.yandex.com/docs/en/mobile-api/push/post-send-batch.md):

```
curl -X POST
'https://push.api.appmetrica.yandex.net/push/v1/send-batch'
-H 'Authorization: OAuth <your_token>'
-H 'Content-Type: application/json'
-d '{
  "push_batch_request": {
    "group_id": 12324,
    "tag": "some_tag",
    "batch": [
      {
        "messages": {
          "android": {
            "silent": false,
            "content": {
              "title": "Sample android title",
              "text": "Sample android text",
              "icon": "46",
              "icon_background": "#FFFFFFFF",
              "banner": "http://example.png",
              "data": "foobarbaz",
              "priority": -2,
              "collapse_key": 2001,
              "vibration": [0, 500],
              "led_color": "#FFFFFF",
              "led_interval": 50,
              "led_pause_interval": 50,
              "time_to_live": 180
            }
          },
          "iOS": {
            "silent": false,
            "content": {
              "text": "Sample iOS text",
              "badge": "0",
              "data": "foobarbaz",
              "sound": "disable"
            }
          }
        },
        "devices": [
          {
            "id_type": "ios_ifa",
            "id_values": ["8003C3CF-A3BC-4DDD-B6DF-1DD......"]
          },
          {
            "id_type": "google_aid",
            "id_values": ["8e4dd44b-82ec-43d0-a5de-321......"]
          }
        ]
      }
    ]
  }
}'
```

where `<your_token>` is an OAuth token that can be obtained using [instructions](https://appmetrica.yandex.com/docs/en/mobile-api/intro/authorization.md#get-oauth-token).

{% note info %}

The description of the request fields is given in the section [Sending push messages](https://appmetrica.yandex.com/docs/en/mobile-api/push/post-send-batch.md).

{% endnote %}

If the request is successful, you will receive a response that looks like:

```
{
  "push_response": {
  "transfer_id": XXXXXX
  }
}
```

The recieved `transfer_id` is used to check the status of sending.

## Checking the status of sending {#check-transfer}

To check the status of sending use the `transferId` dispatch identifier.

{% note info %}

You can also check the status by using the specified value of the `client_transfer_id` field. For more information, see [Sending push messages](https://appmetrica.yandex.com/docs/en/mobile-api/push/post-send-batch.md).

{% endnote %}

To check the status make the following request [`GET /push/v1/status/{transferId}`](https://appmetrica.yandex.com/docs/en/mobile-api/push/get-status-id.md):

```
curl -X GET \
  'https://push.api.appmetrica.yandex.net/push/v1/status/XXXXXX' \
  -H 'Authorization: OAuth <your_token>'
```

where `<your_token>` is an OAuth token that can be obtained using [instructions](https://appmetrica.yandex.com/docs/en/mobile-api/intro/authorization.md#get-oauth-token).

You will receive a response that looks like:

```
{
  "transfer": {
    "creation_date": "2017-11-03T18:29:25+03:00",
    "id": XXXXXX,
    "status": "failed",
    "tag": "some_tag",
    "group_id": XXXXXX,
    "errors": [
      "Invalid push credentials for platform android"
    ]
  }
}
```

{% note info %}

The description of the response fields is given in the section [Checking the status of sending with transferId](https://appmetrica.yandex.com/docs/en/mobile-api/push/get-status-id.md).

{% endnote %}

## Getting a push campaign report {#report}

To get a push campaign report, use the [Reporting API](https://appmetrica.yandex.com/docs/en/mobile-api/stat/intro.md).

To get the information about sending use the following request

```
curl -X GET \
  'https://api.appmetrica.yandex.com/stat/v1/data?limit=10&date1=today&date2=today&ids=XXXXXX&metrics=ym:pc:users&dimensions=ym:pc:group,ym:pc:tag,ym:pc:transfer'
  -H 'Authorization: OAuth <your_token>'
```

where `<your_token>` is an OAuth token that can be obtained using [instructions](https://appmetrica.yandex.com/docs/en/mobile-api/intro/authorization.md#get-oauth-token).

If the request is successful, you will receive a response that looks like:

```
{
  "dimensions": [
    {
      "id": "1",
      "name": "the_name_of_the_group"
    },
    {
      "name": "some_tag"
    },
    {
      "name": "99"
    }
  ],
  "metrics": [
      1
  ]
}
...
```

<!-- source: en/_includes/feedback-button-2.md -->
If you didn't find the answer you were looking for, you can use the feedback form to submit your question. Please describe the problem in as much detail as possible. Attach a screenshot if possible.

<a href="../../troubleshooting/feedback-new">
  <span class="button">Contact support</span>
</a>

<a href="../../troubleshooting/feedback-docs">
  <span class="button">Suggest an improvement for documentation</span>
</a>
<!-- endsource: en/_includes/feedback-button-2.md -->
