Create/update subscription
curl --request POST \
--url https://store.salesive.com/api/v1/push-subscriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-shop-id: <api-key>' \
--data '
{
"endpoint": "<string>",
"keys": {}
}
'import requests
url = "https://store.salesive.com/api/v1/push-subscriptions"
payload = {
"endpoint": "<string>",
"keys": {}
}
headers = {
"Authorization": "Bearer <token>",
"x-shop-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'x-shop-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({endpoint: '<string>', keys: {}})
};
fetch('https://store.salesive.com/api/v1/push-subscriptions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://store.salesive.com/api/v1/push-subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'endpoint' => '<string>',
'keys' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-shop-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://store.salesive.com/api/v1/push-subscriptions"
payload := strings.NewReader("{\n \"endpoint\": \"<string>\",\n \"keys\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("x-shop-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://store.salesive.com/api/v1/push-subscriptions")
.header("Authorization", "Bearer <token>")
.header("x-shop-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"endpoint\": \"<string>\",\n \"keys\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://store.salesive.com/api/v1/push-subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["x-shop-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"endpoint\": \"<string>\",\n \"keys\": {}\n}"
response = http.request(request)
puts response.read_bodyPush Subscriptions
Create/update subscription
Create or update a push subscription.
POST
/
push-subscriptions
Create/update subscription
curl --request POST \
--url https://store.salesive.com/api/v1/push-subscriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-shop-id: <api-key>' \
--data '
{
"endpoint": "<string>",
"keys": {}
}
'import requests
url = "https://store.salesive.com/api/v1/push-subscriptions"
payload = {
"endpoint": "<string>",
"keys": {}
}
headers = {
"Authorization": "Bearer <token>",
"x-shop-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'x-shop-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({endpoint: '<string>', keys: {}})
};
fetch('https://store.salesive.com/api/v1/push-subscriptions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://store.salesive.com/api/v1/push-subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'endpoint' => '<string>',
'keys' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-shop-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://store.salesive.com/api/v1/push-subscriptions"
payload := strings.NewReader("{\n \"endpoint\": \"<string>\",\n \"keys\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("x-shop-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://store.salesive.com/api/v1/push-subscriptions")
.header("Authorization", "Bearer <token>")
.header("x-shop-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"endpoint\": \"<string>\",\n \"keys\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://store.salesive.com/api/v1/push-subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["x-shop-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"endpoint\": \"<string>\",\n \"keys\": {}\n}"
response = http.request(request)
puts response.read_bodyRequest
POST /push-subscriptions
Authorization: Bearer {{token}}
x-shop-id: {{shopId}}
Content-Type: application/json
{
"subscription": {
"endpoint": "https://fcm.googleapis.com/fcm/send/abc123",
"expirationTime": null,
"keys": {
"p256dh": "BNPx...example...key",
"auth": "abc123auth"
}
},
"label": "Chrome Desktop"
}
Headers
| Header | Type | Description |
|---|---|---|
Authorization | string | Provide the customer token as Bearer <jwt>. |
x-shop-id | string | Identify the shop. |
Content-Type | string | Always set to application/json. |
Body parameters
| Field | Type | Required | Description |
|---|---|---|---|
subscription | object | Yes | Push subscription object from browser. |
subscription.endpoint | string | Yes | Push service endpoint URL. |
subscription.expirationTime | integer/null | No | Subscription expiration time. |
subscription.keys | object | Yes | Encryption keys object. |
subscription.keys.p256dh | string | Yes | P-256 public key. |
subscription.keys.auth | string | Yes | Authentication secret. |
label | string | No | Device label (e.g., “Chrome Desktop”). |
Successful response
{
"status": 201,
"success": true,
"message": "Subscription created successfully",
"data": {
"_id": "678bd8f2e37452d19efcb4ea",
"user": "69360693a7a8f7dc8ae32d6d",
"shop": "68b8f52575da81b332af29f1",
"endpoint": "https://fcm.googleapis.com/fcm/send/abc123",
"keys": {
"p256dh": "BNPx...example...key",
"auth": "abc123auth"
},
"label": "Chrome Desktop",
"createdAt": "2025-01-18T12:35:00.000Z"
}
}
Error response
{
"status": 400,
"success": false,
"message": "Subscription object is required",
"data": {}
}
Authorizations
JWT issued by the Salesive Store API for authenticated shoppers.
Optional storefront identifier sent as a header to scope responses to a specific shop. Try It requests remember this value once provided.
Response
201
Subscription created
Was this page helpful?
⌘I

