Send Notifications API


Instantly send push notifications to your users with this powerful API.

  • API Reference
  • Code Samples
  • Test it out
  • POST https://api.pushy.me/push?api_key=SECRET_API_KEY

    Note: Make sure to replace SECRET_API_KEY with your app's Secret API Key, available in the Dashboard. This is a backend API endpoint. Never expose your application's Secret API Key in your client code.

    API Request

    Sample Request Body

    {
        "to": "a6345d0278adc55d3474f5",
        "data": {
            "message": "Hello World!"
        },
        "notification": {
            "body": "Hello World \u270c",
            "badge": 1,
            "sound": "ping.aiff"
        }
    }

    Note: Please make sure to send the Content-type: application/json header with your request.

    Request Schema

    Field Description Example
    to*
    String[] / String
    A device token, an array of device tokens, a topic, or an array of topics (prefix topic names with /topics/).

    Note: Max number of tokens cannot exceed 100,000.
    ["a6345d0278adc55d3474f5"]
    data*
    Object
    The payload data you want to push to devices, limited to 4kb and accessible in your notification listener.

    Get in touch if you need to send larger payloads.
    {"message": "Hello World!"}
    time_to_live
    Integer
    Specifies how long (in seconds) the push notification should be kept if the device is offline.
    The default value is 1 month. The maximum value is 1 year.
    3600
    content_available
    Boolean (iOS)
    When set to true, your app's notification handler will be invoked even if the app is running in the background, making it possible to fetch updated content from the server or execute other custom logic without necessarily alerting the user.

    Requires the Background Modes -> Remote Notifications capability to be enabled.
    true
    mutable_content
    Boolean (iOS)
    When set to true, your app's Notification Service Extension will be invoked even if the app is running in the background, making it possible to download and display rich media attachments within your notification.

    Requires the Background Modes -> Remote Notifications capability to be enabled.
    true
    notification
    Object (iOS)
    iOS notification options, such as the alert message, sound, or badge number.
    - body
    String
    The main alert message, visible on the lock screen and in other areas on iOS. Supports Apple Emojis via their unicode representation. "Hello World \u270c"
    - badge
    Integer
    The number to display as the badge of the app icon. 1
    - sound
    String / Object
    The filename of a sound in the app bundle or in the Library/Sounds folder of your app's data container, or a sound dictionary object (iOS 12, more info) . "ping.aiff"
    - title
    String
    A short string describing the purpose of the notification, visible only on Apple Watch. Added in iOS 8.2. "Alert"
    - category
    String (iOS 10+)
    Your app's Notification Content Extension with the matching category will be invoked in order to display custom notification UI. "photo_notification"
    - loc_key
    String
    The localization key of a string present in your app's Localizable.strings file.

    Use this parameter to localize the notification body. Refer to the APNs Documentation for more information.
    "NOTIFICATION_TEXT"
    - loc_args
    String[]
    The replacement strings to substitute in place of the %@ placeholders of the localization string matching the specified loc_key.

    Use this parameter to localize the notification body. Refer to the APNs Documentation for more information.
    ["John", "1"]
    - title_loc_key
    String
    The localization key of a string present in your app's Localizable.strings file.

    Use this parameter to localize the notification title. Refer to the APNs Documentation for more information.
    "NOTIFICATION_TITLE"
    - title_loc_args
    String[]
    The replacement strings to substitute in place of the %@ placeholders of the localization string matching the specified title_loc_key.

    Use this parameter to localize the notification title. Refer to the APNs Documentation for more information.
    ["John", "1"]
    API Response

    Sample Response Body

    {
        "success": true,
        "id": "5ea9b214b47cad768a35f13a",
        "info": {
            "devices": 1
        }
    }
    Response Schema

    Field Description Example
    id
    String
    The push notification unique ID. Use it to check delivery status using the Notification Status API. "5ea9b214b47cad768a35f13a"
    success
    Boolean
    Returned if the API request was successful. true
    info
    Object
    Contains additional information about the notification, for debugging purposes. {"devices": 1}
    API Error Reference

    Sample Error Response

    {
        "code": "NO_RECIPIENTS", 
        "error": "No devices matched the specified condition."
    }
    Error Codes

    A list of endpoint-specific error codes, in addition to the global API errors.

    Error code Description HTTP status code
    NO_RECIPIENTS The to parameter did not resolve to any recipients, either due to invalid device tokens, or Pub/Sub topic(s) with zero subscribers. 400 Bad Request
    NO_APNS_AUTH Your app needs to be configured with an APNs Auth Key to send notifications to iOS devices. 400 Bad Request
    PAYLOAD_LIMIT_EXCEEDED Your data payload has exceeded 4kb in stringified JSON character length. 400 Bad Request
  • We provide code samples to help you implement this API request:

  • POST https://api.pushy.me/push?api_key=SECRET_API_KEY
    URL Param Value
    SECRET_API_KEY
    JSON Params

    JSON Param Value
    to*
    String[] / String
    data*
    Object

    Show optional params


    API Response

    500 CLIENT ERROR

    N/A