Subscriptions (REST API)

Manage Subscriptions

Method Objective

The method allows changing the status of the current user's subscriptions to notification channels.

Request

EndpointRequest TypeContent-Type
https://api.personaclick.com/subscriptions/managePOSTapplication/json

Parameters

NameTypeRequirementDescription
shop_idstringrequiredUnique Store Key in PersonaClick. Located there: Account > Settings > Store Settings
shop_secretstringrequiredStore Secret Key in PersonaClick. Located there: Account > Settings > Store Settings


Name

Type

Description

email

string

The current user's Email.

phonestring

The current user's phone number in international format.

A phone number in full international format may begin with a plus sign (+) followed by the country code, city (area) code, and phone number.

external_idstringStore side user ID.
loyalty_idstingThe Loyalty Program user ID (loyalty card).
telegram_idstingTelegram User ID.
email_bulkbooleanIt changes the current user's subscription status to bulk email campaigns.
email_chainbooleanIt changes the current user's subscription status to triggered email campaigns.
email_transactionalboolean

It changes the current user's subscription status for transactional email campaigns.

It's recommended that always use the "true" value, even if you don't use transactional messages.

sms_bulkbooleanIt changes the current user's subscription status to bulk SMS campaigns.
sms_chainbooleanIt changes the current user's subscription status to triggered SMS campaigns.
sms_transactionalboolean

It changes the current user's subscription status for transactional SMS campaigns.

It's recommended that always use the "true" value, even if you don't use transactional messages.

web_push_bulkbooleanIt changes the current user's subscription status to bulk webpush campaigns.
web_push_chainbooleanIt changes the current user's subscription status to triggered webpush campaigns.
web_push_transactionalboolean

It changes the current user's subscription status for transactional webpush campaigns.

It's recommended that always use the "true" value, even if you don't use transactional messages.

mobile_push_bulkbooleanIt changes the current user's subscription status to bulk app campaigns.
mobile_push_chainbooleanIt changes the current user's subscription status to triggered app campaigns.
mobile_push_transactionalboolean

It changes the current user's subscription status for transactional app campaigns.

It's recommended that always use the "true" value, even if you don't use transactional messages.

API Response Code

HTTP status code

Description
200 OK

The request was successful.

400 Bad RequestThere are no parameters to change the status of subscriptions.
403 ForbiddenThe request was unsuccessful.
404 Not FoundThere are no mandatory parameters in the request.

API Response Data

The response is JSON type with the following properties:

NameTypeDescription
statusstring

Current status. Can have one of two values:

  • success - the request was successful
  • error - the request was unsuccessful
messagestring

The text of the error if it occurred

Request Example

curl 'https://api.personaclick.com/subscriptions/manage' \
  -X 'POST' \
  -H 'content-type: application/json' \
  -d '{"email":"john.doe@examplemail.com","email_bulk":"true","email_chain":"true","email_transactional":"false","sms_bulk":"false","sms_chain":"true","sms_transactional":"false","web_push_bulk":"true","web_push_chain":"true","web_push_transactional":"false","mobile_push_bulk":"false","mobile_push_chain":"true","mobile_push_transactional":"false","shop_id":"0d42fd8b713d0752776ca589cc0056","shop_secret":"0123456789abcdef0123456789abcdef"}'


System Operations

Method Objective

The method allows marking email addresses with system statuses and unsubscribing from all types of campaigns.

Request

EndpointRequest TypeContent-Type
https://api.personaclick.com/subscriptions/callbackPOSTapplication/json

Parameters

NameTypeRequirementDescription
shop_idstringrequiredUnique Store Key in PersonaClick. Located there: Account > Settings > Store Settings
shop_secretstringrequiredStore Secret Key in PersonaClick. Located there: Account > Settings > Store Settings

Name

Type

Description

eventstring

Specifies the action to be performed with the email. Available values:

  • hard_bounced - use this event only for hard bounced emails, not for soft bounced emails, as the method will permanently remove the email from the database
  • complained - use this event for FBL requests when a user has marked an message as spam
  • blacklisted - use this event to send the email to the blacklist
  • unsubscribed - use this event to unsubscribe the email from all campaigns

email

string

Email address for marking.

API Response Code

HTTP status code

Description
200 OK

The request was successful.

400 Bad RequestThere is no event parameter, or the paramenter has an incorrect value.
403 ForbiddenThe request was unsuccessful.
404 Not FoundThere are no mandatory parameters in the request.

API Response Data

The response is JSON type with the following properties:

NameTypeDescription
statusstring

Current status. Can have one of two values:

  • success - the request was successful
  • error - the request was unsuccessful
messagestring

The text of the error if it occurred

Request Examples

# hard_bounce event
curl 'https://api.personaclick.com/subscriptions/callback' \
  -X 'POST' \
  -H 'content-type: application/json' \
  -d '{"email":"john.doe@examplemail.com","shop_id":"0d42fd8b713d0752776ca589cc0056","shop_secret":"0123456789abcdef0123456789abcdef","event":"hard_bounced"}'

# complained event
curl 'https://api.personaclick.com/subscriptions/callback' \
  -X 'POST' \
  -H 'content-type: application/json' \
  -d '{"email":"john.doe@examplemail.com","shop_id":"0d42fd8b713d0752776ca589cc0056","shop_secret":"0123456789abcdef0123456789abcdef","event":"complained"}'

# blacklisted event
curl 'https://api.personaclick.com/subscriptions/callback' \
  -X 'POST' \
  -H 'content-type: application/json' \
  -d '{"email":"john.doe@examplemail.com","shop_id":"0d42fd8b713d0752776ca589cc0056","shop_secret":"0123456789abcdef0123456789abcdef","event":"blacklisted"}'

# unsubscribed event
curl 'https://api.personaclick.com/subscriptions/callback' \
  -X 'POST' \
  -H 'content-type: application/json' \
  -d '{"email":"john.doe@examplemail.com","shop_id":"0d42fd8b713d0752776ca589cc0056","shop_secret":"0123456789abcdef0123456789abcdef","event":"unsubscribed"}'


Subscription Statuses

Method Objective

The method allows checking the user's current subscription status by email or phone number.

Request

EndpointRequest Type
https://api.personaclick.com/subscriptions/checkGET

Parameters

Name

TypeRequirement

Description

shop_idstringrequiredUnique Store Key in PersonaClick. Located there: Account > Settings > Store Settings
shop_secretstringrequired if "did" isn't usedStore Secret Key in PersonaClick. Located there: Account > Settings > Store Settings
didstringrequired if "shop_secret" isn't usedUnique Device ID. See "Initialization (REST API)" for information about getting and using Device ID.

email

stringrequired if "shop_secret" is used

Email address for checking.

phonestringrequired if "shop_secret" is used

Phone number in international format for checking.

A phone number in full international format may begin with a plus sign (+) followed by the country code, city (area) code, and phone number.

API Response Code

HTTP status code

Description
200 OK

The request was successful.

400 Bad RequestThere are no email or phone parameters.
403 ForbiddenThe request was unsuccessful.

API Response Data

The response is JSON type with the following properties:

NameTypeDescription
statusstring

Available only in case of an error. Contains the "error" value in this case.

messagestring

Available only in case of an error. Contains a description of the error.

existsbooleanShows whether a profile with the requested property exists or not.
email_confirmedbooleanShows whether the email is confirmed or not.
email_bulkbooleanEmail subscription status for bulk campaigns.
email_chainbooleanEmail subscription status for chain/trigger campaigns.
email_transactionalbooleanEmail subscription status for transactional campaigns.
email_bouncedbooleanThe email is hard bounced or not.
email_suppressedbooleanThe email is suppressed or not.
email_blacklistedbooleanThe email is blacklisted or not.
email_invalidbooleanThe email is invalid or not.
sms_bulkbooleanPhone subscription status for SMS bulk campaigns.
sms_chainbooleanPhone subscription status for SMS chain/trigger campaigns.
sms_transactionalbooleanPhone subscription status for SMS transactional campaigns.
web_pushbooleanWhether or not the user with the email/phone has a subscription to web push.
web_push_bulkbooleanWeb-push subscription status for bulk campaigns.
web_push_chainbooleanWeb-push subscription status for chain/trigger campaigns.
web_push_transactionalbooleanWeb-push subscription status for transactional campaigns.
mobile_pushbooleanWhether or not the user with the email/phone has a subscription to mobile app push.
mobile_push_bulkbooleanMobile app push subscription status for bulk campaigns.
mobile_push_chainbooleanMobile app push subscription status for chain/trigger campaigns.
mobile_push_transactionalbooleanMobile app push subscription status for transactional campaigns.
telegram_bulkbooleanTelegram subscription status for bulk campaigns.
telegram_chainbooleanTelegram subscription status for chain/trigger campaigns.
telegram_transactionalbooleanTelegram subscription status for transactional campaigns.

Request Example

curl https://api.personaclick.com/subscriptions/check?email=john.doe%40examplemail.com&shop_id=0d42fd8b713d0752776ca589cc0056&shop_secret=0123456789abcdef0123456789abcdef


List of Subscription Changes

Method Objective

The method allows checking the user's current subscription status by email or phone number.

Request

EndpointRequest Type
https://api.personaclick.com/subscriptions/changesGET

Parameters

NameTypeRequirementDescription
shop_idstringrequiredUnique Store Key in PersonaClick. Located there: Account > Settings > Store Settings
shop_secretstringrequiredStore Secret Key in PersonaClick. Located there: Account > Settings > Store Settings


Name

Type

Description

email

string

Email address for checking.

phonestring

Phone number in international format for checking.

A phone number in full international format may begin with a plus sign (+) followed by the country code, city (area) code, and phone number.

eventstring

Filter by the event. Filter by event. Available values:

  • subscribe - subscription events only
  • unsubscribe - unsubscribe events only
  • hard_bounced - hard bounced events only
  • complained - complained events only
  • blacklisted - blacklisted events only
channelstring

Filter by the channel. Available values:

  • email_feedback_processing - if hard bounce is the reason for changing subscription statuses
  • api - if the change of subscription statuses was made by the "Manage Subscriptions" API method
  • api_callback - if API method "System Operations" was used to change the subscription statuses
  • popup - if the subscription statuses were changed with the popup tool
  • import - if the subscription statuses were set when the audience was imported
  • crm - if the subscription statuses were changed with the CRM tool
  • unsubscribe_page - if the subscription statuses were changed in the unsubscribe page
  • resubscribe_page - if the subscription statuses were changed in the resubscribe page

from

string

Start of the period. Format: YYYY-MM-DD. Defaults to 24 hours ago.

tostringEnd of period. Format: YYYY-MM-DD. The default is the current moment.
offsetnumberOffset relative to the first entry for the selected period. The default is 0.
limitnumberLimit of entries in the API response. The default is 20000. The maximum is 20000.

API Response Code

HTTP status code

Description
200 OK

The request was successful.

403 ForbiddenThe request was unsuccessful.

API Response Data

The API response is limited to 20000 records per request.

The response is JSON type with the following properties:

NameTypeDescription
campaign_typestring

Campaign type. Available values:

  • bulk
  • chain
  • transactional
  • everything
channelstring

Event Channel. Available values:

  • email_feedback_processing
  • api
  • api_callback
  • popup
  • import
  • crm
  • unsubscribe_page
  • resubscribe_page
contactstringThe value of contact.
contact_typestring

Type of contact. Available values:

  • email
  • sms
  • wpush
  • mpush
datetimestringDate of the event in the format YYYY-MM-DDThh:mm:ss.SSS
eventstring

Event Type. Available values:

  • subscribe
  • unsubscribe
  • hard_bounced
  • complained
  • blacklisted
ipstringThe email is suppressed or not.

Request Example

curl https://api.personaclick.com/subscriptions/changes?shop_id=0d42fd8b713d0752776ca589cc0056&shop_secret=0123456789abcdef0123456789abcdef&event=subscribe&channel=import&from=2021-05-04&to=2021-05-05&offset=100500&limit=146


Force call of the "Subscribed" event

Method Objective

The method allows force-calling the "Subscribed" event to send a double opt-in email.

Request

EndpointRequest TypeContent-Type
https://api.personaclick.com/subscriptions/confirm_emailPOSTapplication/json

Parameters

NameTypeRequirementDescription
shop_idstringrequiredUnique Store Key in PersonaClick. Located there: Account > Settings > Store Settings
shop_secretstringrequiredStore Secret Key in PersonaClick. Located there: Account > Settings > Store Settings

Name

Type

Description

email

string

Email address for which the "Subscribed" event should be triggered

API Response Code

HTTP status code

Description
200 OK

The request was successful

400 Bad RequestOne of the reasons:
  • The "Double Opt-In" chain is off
  • No email address was found
  • The email address is already confirmed
403 ForbiddenThe request was unsuccessful
404 Not FoundThere are no mandatory parameters in the request

API Response Data

The response is JSON type with the following properties:

NameTypeDescription
statusstring

Current status. Can have one of two values:

  • success - the request was successful
  • error - the request was unsuccessful
messagestring

The text of the error if it occurred

Request Examples

curl 'https://api.personaclick.com/subscriptions/confirm_email' \
  -X 'POST' \
  -H 'content-type: application/json' \
  -d '{"email":"john.doe@examplemail.com","shop_id":"0d42fd8b713d0752776ca589cc0056","shop_secret":"0123456789abcdef0123456789abcdef"}'

Copyright 2018-2024 PersonaClick