This API is used to link the code of the cart promotion earned by the customer to the customer ID. You cannot link to multiple customers at a time.
Example request
curl --location 'https://{Host}/api_gateway/v1/promotions/code/link' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic Z2VvcmdlLmJ1a2w6NzYzNDGQ3YzI4ZjU4ZjY3MmNhZjY1ZmY=' \
--header 'Cookie: _cfuvidt2b9D_Wbvu39g2t0iT.W9RDJ0-1751522911573-0.0.1.1-604800000; _cfuvid=DWAI.W93CwD8HSqqIDN38lKP84bJoUrRqwVps-1761979737913-0.0.1.1-604800000' \
--data '{
"customerId": 566881933,
"code": "DQCV73",
"mode": "DISCOUNT"
}'Prerequisites
- Authentication: Basic or OAuth authentication.
- Default access group
Resource information
| Pagination | No |
| Batch support | No |
Rate limit
- Demo and Testing Clusters: 1,000 requests per minute per API key
- Other Organizations: The rate limit is brand-specific.
To modify the limit, create a ticket with the Capillary Product support team.
Body parameters
Field | Type | Required | Description |
|---|---|---|---|
customerId | Number | Yes | Specifies the unique identifier for the customer for whom you want to link the cart promotion code. |
code | String | Yes | Specifies the cart promotion code to be linked. This can be discount code or the gift voucher code. |
mode | Enum | Yes | Specifies the cart promotion mode. Supported values: DISCOUNT, PAYMENT_VOUCHER. |
Example response
{
"data": {
"id": "6912d23dd39e256f754a8411",
"orgId": 100737,
"promotionId": "6912d21e6629ee07040e1613",
"promotionName": "code_linked promotion",
"code": "888590",
"customerId": 566881933,
"active": true,
"createdOn": 1762841149535,
"createdOnISO": "2025-11-11T06:05:49Z",
"validTill": 1767205799999,
"validTillISO": "2025-12-31T18:29:59Z",
"mode": "DISCOUNT",
"redeemableFrom": 1762841149535,
"redeemableFromISO": "2025-11-11T06:05:49Z"
}
}Response parameters
Field | Type | Description |
|---|---|---|
data | Object | Defines the primary response object, containing the linked cart promotion code details. |
errors | Array | Defines a list of error objects. |
..id | String | Specifies the unique identifier for this specific cart promotion code record. |
..orgId | Number | Specifies the Organization ID to which the code belongs. |
..promotionId | String | Specifies the unique identifier for the cart promotion that this code activates. |
..promotionName | String | Specifies the name of the cart promotion the code is linked to. |
..code | String | Specifies the cart promotion code itself. |
..customerId | Number | Specifies the Customer identifier that this code is now linked to. |
..active | Boolean | Indicates whether the code is currently active and available for use. |
..createdOn | Number | Indicates the creation timestamp in epoch milliseconds. |
..createdOnISO | String | Specifies the creation timestamp in ISO 8601 format. |
..validTill | Number | Indicates the expiration timestamp in epoch milliseconds. |
..validTillISO | String | Specifies the expiration timestamp in ISO 8601 format. |
..mode | String | Specifies the cart promotion's operational mode. |
..redeemableFrom | Number | Indicates the timestamp in UTC from when the code can be first used. |
..redeemableFromISO | String | Specifies the timestamp in UTC from when the code is redeemable. Time format: ISO 8601 format |
Error codes
| Code | Description |
|---|---|
| 400 | Invalid request. Check required parameters. Ensure all required parameters, including a valid code, are provided and valid. |
| 1001 | Invalid code. Provide a valid code. |
| 1002 | Code has expired. Use a non-expired code. |
| 1004 | Code has been already redeemed. Use a code that has not already been redeemed. |
| 1005 | Code linked to another customer. Provide a code that is not already linked. |
| 1006 | Invalid customer identifier. Provide a valid customer identifier. |
| 1007 | Error while fetching customer identifier. Retry after checking the customer identifier details and service status. |
| 500 | Internal server error. Retry the request after a short delay, and contact support if the error persists. |
