Docs

  • Channels Channels
  • Beams Beams
  • Developers
  • Support
  • Blog
  • Sign up
    • Search powered by Algolia
    • Sign in
    • Sign up
    • Channels
    • Beams
    • Getting started
      • Android
        • 1. Configure FCM
        • 2. Integrate SDK
        • 3. Initialize Beams
        • 4. Publish Notifications
      • iOS
        • 1. Configure APNS
        • 2. Integrate SDK
        • 3. Publish Notifications
      • Web
        • 1. SDK integration
        • 2. Safari configuration
      • Flutter
        • 1. Configure FCM and APNS
        • 2. Integrate SDK
        • 4. Publish Notifications
    • Concepts
      • Subscribers
      • Device interests
      • Authenticated users
      • Insights
      • Webhooks
    • Guides
      • Handle incoming notifications
        • Android
        • iOS
        • Web
        • Flutter
      • Publishing to multiple devices
      • Publish to specific user
        • Android
        • iOS
        • Web
        • Flutter
      • Web push guides
        • Using an existing service worker
        • Web notification permissions in Firefox
        • Handling Safari certificate expiration
    • Reference
      • Client SDKs
        • Android
        • iOS
        • Web
      • All Libraries
      • Server SDKs
        • Go
        • PHP
        • Node.js
        • Python
        • Java/Kotlin
        • Ruby
        • Swift
      • API
        • Publish API
        • Customer API
        • Device API
        • Reporting API
        • Webhooks
      • Platform Publish Formats
    • Pusher lab

    Publish API

    ∞ Publishing a notification to interest(s)

    POST https://<YOUR_INSTANCE_ID>.pushnotifications.pusher.com/publish_api/v1/instances/<YOUR_INSTANCE_ID>/publishes/interests

    ∞ Request headers

    The following headers are necessary:

    • Authorization: with the value in the following format: Bearer <YOUR_SECRET_KEY>.
    • Content-Type: with the value always set to application/json.

    ∞ Request body

    A JSON object with the following keys:

    ∞ interestsArray<string> Required

    Array of interests to send the push notification to, ranging from 1 to 100 per publish request.

    Where multiple interests are provided, the notification will be delivered to devices subscribed to any of the interests.
    Beams will also only deliver one notification to any devices that may be subscribed to multiple interests in the publish request.

    ∞ webhookUrlString Optional

    A URL to which we will send webhooks at key points throughout the publishing process. E.g., when the publish finishes.

    At least one of:

    ∞ apnsobject

    The payload to be sent to APNs. The full set of options for the APNs section of the notify call is described in Apple’s Payload Key Reference. For further examples, see Apple’s “Creating the Remote Notification Payload”.

    ∞ fcmobject

    The payload to be sent to FCM. The full set of options is described in Google docs under FCM downstream HTTP messages.

    ∞ webobject

    The payload to be sent to the web push gateway. Refer to Beams web push format reference.

    Each interest name can be up to 164 characters. Each character in the name must be an ASCII upper- or lower-case letter, a number, or one of _-=@,.;.

    ∞ Response Body

    A JSON object with the following fields:

    ∞ publishIdstring Required

    Unique string used to identify this publish request.

    ∞ Error Responses

    Title Status Code Description
    Invalid content type 400 Only application/json is supported.
    Incomplete Request 400 instance-id param is missing from path.
    Incomplete Request 400 Authorization header is missing.
    Bad request 400 Request body size is too large (max 10KiB).
    Bad request 400 Failed to read body as a JSON object.
    Unauthorized 401 Incorrect API Key.
    Payment Required 402 Publishing has been blocked due to being over plan limits. Refer to Beams plan limits article in our Support knowledge base.
    Instance not found 404 Could not find the instance.
    Unprocessable Entity 422 JSON does not our match schema.
    Rate Limited 429 Too many requests being made in quick succession (max 100 RPS).
    Something went wrong 500 Internal server error.

    ∞ Publishing a notification to user(s)

    POST https://<YOUR_INSTANCE_ID>.pushnotifications.pusher.com/publish_api/v1/instances/<YOUR_INSTANCE_ID>/publishes/users

    ∞ Request headers

    The following headers are necessary:

    • Authorization: with the value in the following format: Bearer <YOUR_SECRET_KEY>.
    • Content-Type: with the value always set to application/json.

    ∞ Request body

    A JSON object with the following keys:

    ∞ usersArray<string> Required

    Array of user IDs to send the push notification to, ranging from 1 to 1000 per publish request. User IDs are UTF-8 encoded strings of no more than 164 bytes

    At least one of:

    ∞ apnsobject

    The payload to be sent to APNs. The full set of options for the APNs section of the notify call is described in Apple docs Payload Key Reference. For further examples, visit Apple docs Creating the Remote Notification Payload.

    ∞ fcmobject

    The payload to be sent to FCM. The full set of options is described in Google docs under FCM downstream HTTP messages.

    ∞ webobject

    The payload to be sent to the web push gateway. Refer to the Beams web push format reference.

    ∞ Response Body

    A JSON object with the following fields:

    ∞ publishIdstring Required

    Unique string used to identify this publish request.

    ∞ Error Responses

    Title Status Code Description
    Invalid content type 400 Only application/json is supported.
    Incomplete Request 400 instance-id param is missing from path.
    Incomplete Request 400 Authorization header is missing.
    Bad request 400 Request body size is too large (max 200KiB).
    Bad request 400 Failed to read body as a JSON object.
    Unauthorized 401 Incorrect API Key.
    Payment Required 402 Publishing has been blocked due to being over plan limits. Refer to Beams plan limits articlein our Support knowledge base.
    Instance not found 404 Could not find the instance.
    Unprocessable Entity 422 JSON does not our match schema.
    Rate Limited 429 Too many requests being made in quick succession (max 100 RPS).
    Something went wrong 500 Internal server error.

    Contents

    • Publishing a notification to interest(s)
      • Request headers
      • Request body
      • Response Body
      • Error Responses
    • Publishing a notification to user(s)
      • Request headers
      • Request body
      • Response Body
      • Error Responses

    Spotted something that isn’t quite right? Create an issue on GitHub.

    Copyright © 2024 Pusher Ltd. All rights reserved.

    • Support,
    • Status
    • Follow Pusher on Twitter Twitter
    • Subscribe to Pusher’s channel on YouTube
    • Follow Pusher on LinkedIn
    • Follow Pusher on Github GitHub
    • Follow Pusher on Twitch Twitch
    • Follow Pusher on Discord Discord