Launch Single Web Pushes V2

Prev Next

Insider One's Web Push API allows you to launch Single Web Push notifications from your back-end without using the InOne panel.

The Web Push API v2 differs from the Web Push API v1 in two ways: its rate limit is 6000 requests per minute, and its endpoint includes the v2 version.

Endpoint and Headers

POST https://web-push.api.useinsider.com/v2/single/campaign_id

Visit our Postman collection to test this request.

Header

Sample Value

Description

Authorization

Bearer 1a2b3c4d5e6f

This key is required to authorize your request. Refer to API Authentication Tokens to generate your token.

Content-Type

application/json

This header specifies the media type of the resource.

Body Parameters

Each request body requires partner_id, title, description, image, link, and ttl. If any of these fields is missing, the request returns 400 Bad Request.

Parameter

Description

Data Type

Required

partner_id

This is your partner identification number, available in Inone Settings > Account Settings.

String

Yes

title

Every request creates a push notification campaign in InOne with the push type set to Single Push. This is the title of the push content. It cannot exceed 100 characters.

String

Yes

description

This is the body of your push notification. It cannot be more than 255 characters. If it is a rich push that has a banner, it is limited to 30 characters.

String

Yes

image

The URL of the push notification icon. Only HTTPS URLs are accepted. This field is required in every request. If it is missing or empty, the request returns 400 Bad Request with the message image is a required field. The API does not fall back to the default icon set in your panel.

String

Yes

banner

This is the rich push notification image. Only HTTPS protocols are accepted.

String

No

link

The link of the Web push message.

String

Yes

include_unengage

Set to true to include unengaged tokens. If the field is not sent, unengaged users are excluded.

Boolean (true/false)

No

ttl

TTL stands for time to live. It is the maximum time the system will wait before attempting to send a push notification to an offline or temporarily unavailable user. TTL is limited to 240 hours.

String

Yes

target

Targeting options for the campaign (segmenting).

Object

Yes if is_all: false

     attribute

The attribute used for targeting, e.g., "d_wp_browser".

String

Yes, if the target is used.

     values

An array of values to target, e.g, ["Edg"]. You can send up to 20 values.

Array

Yes, if the target is used.

Using your default icon

The Default Icon option in the InOne panel is not available through the API. To show the same icon in API pushes, host the image at a public HTTPS URL and send that URL in the image field. The recommended size is 80x80 pixels, under 500 KB.

Sample Request

  • If you want to use default attributes, you must follow the format:

d_Default_attribute_name

  • If you want to use custom attributes, you must follow the format:

c_Custom_attribute_name

You can refer to the Default Attributes documentation for a full list of available default fields.

Before sending the request, make sure to:

  • Replace the authorization value with your API key.

  • Add your partner ID in partner_id.

  • Add your campaign name to the title.

When you send a Create a Single Web Push request, you will receive a campaign_id in the response. You use this campaign_id to launch your Single Web Push campaign.

The sample below displays a request to launch a Single Web Push campaign without segments: is_all: true.

curl --location --request POST 'https://web-push.api.useinsider.com/v2/single/campaign_id' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 1a2b3c4d5e6f' \
--data-raw '{
  "partner_id": "100000001",
  "title": "title of push",
  "description": "description of push",
  "image": "https://image.insiderone.com/mywebsite/webPushDefaultImage/JpVu9a2577074.jpeg",
  "banner": "https://image.insiderone.com/mywebsite/webPushDefaultImage/JpVu92577074.jpeg",
  "link": "https://image.insiderone.com",
  "include_unengage": true,
  "ttl": "1000"
}'

The sample below shows a request to launch a Single Web Push campaign with the is_all segment set to false.

The campaign language is set when you create the campaign, not in this request.

curl --location --request POST 'https://web-push.api.useinsider.com/v2/single/campaign_id' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 1a2b3c4d5e6f' \
--data-raw '{
  "partner_id": "10000001",
  "title": "title of push",
  "description": "description of push",
  "image": "https://image.insiderone.com/mywebsite/webPushDefaultImage/JpVu9aBX577074.jpeg",
  "banner": "https://image.insiderone.com/mywebsite/webPushDefaultImage/JpZLy12577074.jpeg",
  "link": "https://image.insiderone.com",
  "include_unengage": true,
  "ttl": "1000",
  "target": {
    "attribute": "d_wp_browser",
    "values": ["Edg"]
  }
}'

Sample Responses

200 OK

You'll see this response when you successfully launch your campaign.

{
  "success": true,
  "campaign_id": 1697300275
}

401 Unauthorized

{
"message": "Unauthorized"
}

424 Failed Dependency

{
  "message": "SERVICE:-"
}

Error Codes

  • 400 Bad Request

  • 401 Unauthorized Request

  • 424 Failed Dependency

  • 429 Request limit exceeded

Error reference

Use this table to identify and resolve the errors this endpoint returns. Each row shows the status code, the response body you receive, what causes it, and how to fix it.

Status

JSON response

Cause

Fix

400 Bad Request

The response can contain validation details.

The request contains malformed JSON, the campaign_id is missing or invalid, or a request field fails validation; for example, a required field is missing, an image or link is not a valid URL, ttl is not numeric, or a text value exceeds its limit.

Send valid JSON and check the request against the documented body parameters. Use the campaign_id returned when the Single Web Push campaign was created. Correct the specific validation issue returned in the response.

401 Unauthorized

{"message": "Unauthorized"}

The API key in the authorization header is missing, incorrect, or revoked.

Send a current API key as the authorization key in the request header. See API Authentication Tokens.

424 Failed Dependency

{ "message": "SERVICE:-" }

An upstream service that this endpoint depends on did not return a usable result. A related variant, SERVICE:-Campaign not found, indicates that the campaign_id in the path does not resolve to a campaign.

Confirm the campaign_id is correct and that the campaign still exists in your panel. If the message is the bare SERVICE: form and the campaign is valid, retry with exponential backoff, then contact the Insider One team if it persists.

429 Too Many Requests

The configured request limit for the endpoint was exceeded. The default limit is 6,000 requests per minute.

Throttle requests according to the endpoint’s configured limit. Retry after the rate-limit window resets. Follow the Retry-After header when the response provides one. Do not retry every 429 immediately.

Limitations

  • All functions must be executed with an HTTPS POST request.

  • The API key should be provided as the authorization key in the request header. If the key is incorrect, the operation will not be executed, and an authorization error will return in the response.

  • The rate limit is 6000 requests per minute.

The default limit shown here is a standard baseline. If your use case requires higher capacity, feel free to reach out to the Insider One team. We can adjust it to fit your needs.