Skip to content

Create customer subscriptions

POST
/merchants/{merchantCode}/customers/{customerId}/subscriptions
curl --request POST \
--url https://customer.shopgate.io/v1/merchants/example/customers/example/subscriptions \
--header 'Content-Type: application/json' \
--data '{ "subscriptions": [ { "code": "default", "subscriptionType": "productInventoryRestocked", "entityType": "product", "entityId": "p1", "status": "active", "params": {} } ] }'

Create new customer subscriptions

merchantCode
required
string
customerId
required
string
Media typeapplication/json
object
subscriptions
required
Array<object>
<= 100 items
object
code

Subscription code. This needs to be unique within every user

string
Example
1-wedding
subscriptionType
required

Type of subscription

string
Allowed values: productInventoryRestocked
entityType
required

The entity for which the subscription should be created

string
Allowed values: product
entityId
required

Id of the referenced entity, depending on entity type

string
status
string
Allowed values: active inactive triggered
params

Additional subscription properties

object
key
additional properties
any
Example
{
"code": "default",
"subscriptionType": "productInventoryRestocked",
"entityType": "product",
"entityId": "p1",
"status": "active",
"params": {}
}

Subscriptions were created

Media typeapplication/json
object
codes
Array<string>
errors
Array<object>
object
code
number
message
string
validationError

(optional) The original validation error that occured.

object
code
string
message
string
paramName
string
paramValue
string
entity
string
entityIndex

The index of the element the error refers to in the list of elements passed, starting from 0.

number
entityId
string
subentityPath
Array<string>
Example
{
"codes": [
"5dfc8839-8866-43ed-9238-a09d92cd2353"
],
"errors": [
{
"code": 409,
"entity": "subscription",
"entityId": "sub_1",
"entityIndex": 0,
"reason": "Subscription code found more than once",
"subentityPath": []
}
]
}

Access denied

Media typeapplication/json
object
code

Machine readable error code

string
message
required

Human readable error code

string
Examplegenerated
{
"code": "example",
"message": "example"
}

Merchant or Customer not found

Media typeapplication/json
object
code

Machine readable error code

string
message
required

Human readable error code

string
Examplegenerated
{
"code": "example",
"message": "example"
}

Unexpected error

Media typeapplication/json
object
code

Machine readable error code

string
message
required

Human readable error code

string
Examplegenerated
{
"code": "example",
"message": "example"
}