Skip to main content
Altcraft Docs LogoAltcraft Docs Logo
User guideDeveloper guideAdmin guide
Company siteHelp center
English
  • Русский
  • English
v72
  • v74
  • v73
  • v72
Login
  • User API documentation
  • API interaction
  • Matching
  • Profiles
  • Databases
  • Resources
  • Segments
  • Static segments
  • Suppression lists
  • Templates and fragments
  • Campaigns
  • Automation scenarios
  • Promo codes
    • Import promo codes
    • Get promo code information
    • Activate promo code
    • Update promo code
    • Attach promo code
    • Detach promo code
    • Get all promo codes
  • Goals
  • Application push notifications
  • Market
  • Analytic reports
  • SendersDevv71
  • External datatables queries
  • Objects
  • Miscellaneous
  • Importing the API collection in Postman
  • List of API endpoints
  • SDK
This is documentation for Altcraft Platform v72. This documentation is no longer maintained.
The information for up-to-date platform version at this page is available (v74).
  • Promo codes
  • Attach promo code
Documentation for version v72

Attach promo code

Description​

Attaches a promotion code to a profile.

If a "code" parameter is specified, it will be used for promo code matching.

  • If the code is already attached and its multiple usage is restricted, an error will occur.
  • If a code is found unattached — it will be attached.
  • If a code is not found — it will be imported and attached.

With no "code" parameter loyalty program ID will be used for matching.

  • If there are promo codes available in a loyalty program — one will be attached.

Request URL​

Method: POST

https://example.com/api/v1.1/promocodes/attach

Request parameters​

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPI token
codestring"CODE-12345"NoPromo code
db_idint1YesDatabase ID
emailstring"john@example.com"NoEmail address
formatstring"json"NoResponse data format.
By default – json
field_namestring
NoCustom database field for profile matching
field_valuestring
NoCustom field value
matchingstring"profile_id"
"email"
"phone"
"custom"
NoProfiles matching mode
loyalty_idint1YesLoyalty program ID
phonestring"+79000000000"NoPhone number
profile_idstring"abcdefghijklmnqrstuvwxyz"NoProfile ID

Request example​

  • JSON
  • XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"db_id": 1,
"matching": "profile_id",
"profile_id": "abcdefghijklmnqrstuvwxyz",
"loyalty_id": 5,
"code": "CODE-1"
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<db_id>1</db_id>
<matching>profile_id</matching>
<profile_id>abcdefghijklmnqrstuvwxyz</profile_id>
<loyalty_id>5</loyalty_id>
<code>CODE-1</code>
</xml>

Response example​

  • JSON
  • XML
{
"data": null,
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data></data>
<error>0</error>
<error_text>Successful operation</error_text>
</xml>

Response parameters​

ParameterTypeDescription
errorintError code
error_textstringError text
Last updated on Feb 28, 2024
Previous
Update promo code
Next
Detach promo code
  • Description
  • Request URL
  • Request parameters
  • Request example
  • Response example
  • Response parameters
© 2015 - 2025 Altcraft, LLC. All rights reserved.