Skip to main content
Altcraft Docs LogoAltcraft Docs Logo
User guideDeveloper guideAdmin guide
Company siteHelp center
English
  • Русский
  • English
v74
  • v74
  • v73
  • v72
Login
  • User API documentation
  • API interaction
  • Matching
  • Profiles
    • Import profile
    • Update profile
    • Import multiple profiles
    • Update multiple profiles
    • Add multiple profiles
    • Add profile to database
    • Quick profile import
    • Import profile to RabbitMQ
    • Get profile data
    • Uploading profiles to a file
    • Suspend all database profiles
    • Unsuspend all profiles in a database
    • Delete profile
    • Subscription fields functional update
    • Database fields functional update
    • Merging multiple profiles
    • Unsubscribe profile from resource
    • Profile splitting
    • Subscriptions
      • Add or edit subscription
      • Get all profile subscriptions
      • Get all subscriptions from multiple profiles
      • Get profile subscription
      • Delete profile subscription
      • Restore deleted subscription
      • Suspend all subscriptions
      • Unsuspend all suspended subscriptions
    • Action history
    • Profile relations
    • Get data for multiple profiles
  • Databases
  • Resources
  • Segments
  • Suppression lists
  • Templates and fragments
  • Campaigns
  • Mailings
  • Automation scenarios
  • Loyalty Programs
  • Promo codes
  • Goals
  • Application push notifications
  • Market
  • Analytic reports
  • SendersDev
  • External datatables queries
  • Objects
  • Miscellaneous
  • Importing the API collection in Postman
  • List of API endpoints
  • SDK
  • Profiles
  • Subscriptions
  • Add or edit subscription
Documentation for version v74

Add or edit subscription

Description​

Adds or edits profile subscriptions. Changes subscription status.

Request URL​

Method: POST

https://example.com/api/v1.1/subscriptions/set

Request parameters​

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPI token
formatstring"json"NoResponse data format.
By default – json.
db_idint1YesDatabase ID
profile_idstring"abcdefghijklmnqrstuvwxyz"YesProfile ID
resource_idint1YesResource ID
statusstring"subscribed"NoSubscription status.

We recommend that you pass the parameter only when you need to update the subscription status.
priorityintNoSubscription priority
custom_fieldsobject
{
   "_browser_name": "Chrome",
   "_device_type": "web"
}
NoSystem and custom subscription fields.

You can get information about available subscription fields in a resource using the /v1.1/resources/fields_get method
catsarray
[
   "category_1",
   "category_2"
]
NoResource categories to which you need to subscribe a profile
datestring2018-08-22T00:00:00.000ZNoRegistration date in RFC 3339 format
ipstring10.250.13.5NoRegistration IP
urlstringhttps://example.com/NoRegistration URL
skip_triggersbooltrueNoSkip trigger events.
By default – false.

Additionally for the Email channel:

ParametersTypeExampleDescription
channelstring"email"Channel type
emailstring"john@example.com"Email address

Additionally for the Push channel:

ParametersTypeExampleDescription
channelstring"push"Channel type
providerstring"Firefox"Push provider
subscription_idstring"abcdefghijklmnqrstuvwxyz"Subscription ID

Additionally for the SMS channel:

ParametersTypeExampleDescription
channelstring"sms"Channel type
phonestring"+79000000000"Phone number

Additionally for the Telegram channel:

ParametersTypeExampleDescription
channelstring"telegram_bot"Channel type
cc_dataobject
{
"id": 1
}
Chat ID between Telegram bot and user

Additionally for the WhatsApp* channel:

ParametersTypeExampleDescription
channelstring"whatsapp"Channel type
cc_dataobject
{
"phone": "+79000000000"
}
WhatsApp* user's phone number

Request example​

  • JSON
  • XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"db_id": 1,
"resource_id": 1,
"channel": "email",
"email": "example@example.com",
"priority": 10,
"profile_id": "abcdefghijklmnqrstuvwxyz",
"status": "suspended"
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<db_id>1</db_id>
<resource_id>29</resource_id>
<channel>email</channel>
<email>example@example.com</email>
<priority>10</priority>
<profile_id>abcdefghijklmnqrstuvwxyz</profile_id>
<status>suspended</status>
</xml>

Response example​

  • JSON
  • XML
{
"data": {
"action": "subscribed",
"is_new_channel": false,
"is_new_contact": false,
"is_new_subscription": true,
"is_restored": false,
"is_safe": true
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<action>subscribed</action>
<is_new_channel>false</is_new_channel>
<is_new_contact>false</is_new_contact>
<is_new_subscription>true</is_new_subscription>
<is_restored>false</is_restored>
<is_safe>true</is_safe>
</data>
<error>0</error>
<error_text>Successful operation</error_text>
</xml>
caution

Please note that the "Increase priority for new subscriptions" option in the resource works only if a priority is not explicitly specified when adding a new subscription. If the priority for the new subscription is passed in the API request, then the priorities of existing subscriptions for the profile will not change.

Response parameters​

ParameterTypeDescription
errorintError code
error_textstringError text
actionstringSubscription update result
is_safeboolSafe and successful operation (no hard bounces etc)
is_new_subscriptionboolNew for this resource
is_new_channelboolNew for this channel of an existing resource
is_new_contactboolNew subscription for an existing channel
is_restoredboolA previously deleted subscription restored

*The Meta organization, which owns Instagram, Facebook and WhatsApp products, has been declared as extremist and banned in Russia.

Last updated on Apr 26, 2024
Previous
Subscriptions
Next
Get all profile subscriptions
  • Description
  • Request URL
  • Request parameters
  • Request example
  • Response example
  • Response parameters
© 2015 - 2025 Altcraft, LLC. All rights reserved.