Skip to main content
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": {}
}
'

Request

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

HeaderTypeDescription
AuthorizationstringProvide the customer token as Bearer <jwt>.
x-shop-idstringIdentify the shop.
Content-TypestringAlways set to application/json.

Body parameters

FieldTypeRequiredDescription
subscriptionobjectYesPush subscription object from browser.
subscription.endpointstringYesPush service endpoint URL.
subscription.expirationTimeinteger/nullNoSubscription expiration time.
subscription.keysobjectYesEncryption keys object.
subscription.keys.p256dhstringYesP-256 public key.
subscription.keys.authstringYesAuthentication secret.
labelstringNoDevice 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

Authorization
string
header
required

JWT issued by the Salesive Store API for authenticated shoppers.

x-shop-id
string
header
required

Optional storefront identifier sent as a header to scope responses to a specific shop. Try It requests remember this value once provided.

Body

application/json
endpoint
string
keys
object

Response

201

Subscription created