Detach promo code
Description
Detaches a promotion code from a profile.
Use one of these parameters for profile matching:
- email
- field_name,- field_value
- phone
- profile_id
If no "code" parameter is specified or if a specified code is attached to multiple profiles — an error will be returned.
Request URL
method: POST
https://example.com/api/v1.1/promocodes/detach
Request parameters
| Parameter | Type | Example | Required | Description | 
|---|---|---|---|---|
| token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token | 
| code | string | "CODE-12345" | No | Promotion code | 
| db_id | int | 1 | Yes | Database ID | 
| string | "john@example.com" | No | Email address | |
| format | string | "json" | No | Response data format. By default – json | 
| field_name | string | No | Custom profile matching field | |
| field_value | string | No | Custom field value | |
| matching | string | "profile_id" "email" "phone" "custom" | No | Profiles matching mode | 
| loyalty_id | int | 1 | Yes | Loyalty program ID | 
Request example
- JSON
- XML
{
    "token": "abcdefghijklmnqrstuvwxyz",
    "code": "Code-1",
    "db_id": 1,
    "loyalty_id": 4,
    "matching": "profile_id",
    "profile_id": "abcdefghijklmnqrstuvwxyz"
}
<xml>
    <token>abcdefghijklmnqrstuvwxyz</token>
    <code>Code-1</code>
    <db_id>1</db_id>
    <loyalty_id>4</loyalty_id>
    <matching>profile_id</matching>
    <profile_id>abcdefghijklmnqrstuvwxyz</profile_id>
</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
| Parameter | Type | Description | 
|---|---|---|
| error | int | Error code | 
| error_text | string | Error text |