| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Use this API to add or remove identifiers associated with a customer's profile. This includes standard identifiers such as mobile number, email, and external ID, as well as card-specific operations such as linking or delinking a loyalty card.
Supported identifier types
| Type | Value |
|---|---|
email | Email address |
mobile | Mobile number |
externalId | External ID |
cardnumber | Card number |
cardExternalId | Card external ID |
wechat | WeChat ID |
unionId | Union ID (WeChat) |
cuid | CUID |
Supported operations
| Operation | Description |
|---|---|
| Add identifier | Associate a new identifier with an existing customer profile. |
| Remove identifier | Disassociate an existing identifier from a customer profile. |
| Link card | Add a cardnumber identifier with an ACTIVE status to link a loyalty card to the profile. |
| Delink card | Remove a cardnumber identifier with a NOT_ISSUED status to delink a loyalty card from the profile. |
What you cannot do with this API
Profile attributes
Only identifiers can be updated using this API. Other profile attributes cannot be modified.
Identifier uniqueness rules
Identifiers must be unique within the scope of their source type:
- For single-account sources, identifiers must be unique within the source.
- For multi-account sources, identifiers must be unique within the account.
If an identifier you add already exists under a different source or account, the two accounts are automatically merged. The new account becomes the victim account and the existing account becomes the survivor account.
Identifier reuse from campaign and victim users
By default, if an identifier (mobile, email, or external ID) is already held by a campaign user (a non-registered user created by a campaign) or a victim user (the merged-away account in a previous merge), the API blocks the update.
You can change this behavior by enabling the org-level configuration CONF_ALLOW_CAMPAIGN_AND_VICTIM_USER_IDENTIFIER_REUSE. When this configuration is enabled:
- The conflicting identifier is automatically cleared from the campaign or victim user.
- The requesting customer's profile takes the identifier.
- Applies to
mobile,email, andexternalIdidentifier types only. - Supported only for requests with
source=INSTORE.
If the identifier cannot be freed — for example, the conflicting user does not exist in the same INSTORE scope — the API returns an error.
Note
Contact Capillary Support to enable
CONF_ALLOW_CAMPAIGN_AND_VICTIM_USER_IDENTIFIER_REUSEfor your organisation.
Updating multiple identifiers in a single request
When updating multiple identifiers (for example, both mobile and cuid) in a single request with source=INSTORE, the following limitations apply.
Simultaneous updates may not work
The API does not reliably support updating certain combinations of identifiers at the same time. If you include both mobile and cuid in the same request, the update may process only one of them or fail entirely.
Some identifiers may be silently skipped
In some cases, the API may skip certain identifiers such as cuid without returning an explicit error. This can cause the update to appear successful while leaving one or more identifiers unchanged, and may lead to data inconsistencies across systems.
Behavior may differ across platforms
If your integration runs on multiple platforms (such as Android and iOS), differences in how each platform structures the request payload can produce inconsistent results. An update that works on one platform may not behave the same way on another.
Partial failures can create incomplete profiles
If the CONF_RESTRICT_ORPHAN_V2_PROFILE configuration parameter is enabled, failed or partial updates may create orphan profiles (profiles without a primary identifier). This can affect downstream processes and data integrity.
Mobile number update and identifier sync
If CONF_IDENTIFIERS_SYNC_ENABLED is enabled, updating a mobile number triggers a sync to the external system. If the new mobile number already exists in another profile, the update fails with error code 11000 (duplicate identifier value). When this occurs, the sync does not take place and the mobile number is not updated. This behavior prevents duplicate identifiers across profiles.
Recommendations
To avoid the issues above:
- Update only one identifier at a time per request, especially for critical identifiers like
mobileandcuid. - Review your integration to ensure payload consistency across platforms, and handle error responses appropriately.
- Understand how
CONF_RESTRICT_ORPHAN_V2_PROFILEandCONF_IDENTIFIERS_SYNC_ENABLEDaffect profile creation, identifier updates, and synchronization before configuring your environment.
Prerequisites
- A valid customer ID for the profile you want to update.
- Valid identifier value(s) to add or remove.
- For card issuance:
- External or manually generated cards — Add the card first using the
/v2/cardAPI before issuing it to a customer. - Auto-generated cards — Generate the card first using the
card/generateAPI before issuing it to a customer.
- External or manually generated cards — Add the card first using the
Note
The identifier you want to add must be unique across the source (for single-account sources) or unique across the account (for multi-account sources).
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
| userId | Integer | Yes | Unique ID of the customer whose identifiers you want to change. |
Query parameters
| Field | Type | Required | Description |
|---|---|---|---|
| source | Enum | Yes | Source from which the identifier change is made. Supported values: INSTORE, FACEBOOK, WEB_ENGAGE, WECHAT, MARTJACK, TMALL, TAOBAO, JD, ECOMMERCE, WEBSITE, LINE, MOBILE_APP. |
| accountId | String | Optional | For sources with multiple accounts, pass the ID of the source account. |
Example request
curl --location 'https://eu.api.capillarytech.com/v2/customers/564767826/changeIdentifier?source=INSTORE' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'Authorization: Basic cnV0dWphXMGI0NzZjNg==' \
--header 'Cookie: _cfuvid=pQPy_F.YRXJFSzvmPJmB4FH7K2rncxP7s12ArteCH1E-1744806036086-0.0.1.1-604800000' \
--data '{
"add": [
{
"type": "cardnumber",
"value": "Test09000000000004end",
"seriesCode": "Test",
"statusLabel": "ACTIVE"
}
]
}'curl --location 'https://eu.api.capillarytech.com/v2/customers/564767826/changeIdentifier?source=INSTORE&format=json' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'Authorization: Basic cnV0dWphX20NzZjNg==' \
--header 'Cookie: _cfuvid=pQPy_F.YRXJFSzvmPJmB4FH7K2rncxP7s12ArteCH1E-1744806036086-0.0.1.1-604800000' \
--data '{
"remove": [
{
"type": "cardnumber",
"value": "Test09000000000004end",
"seriesCode": "Test",
"statusLabel": "NOT_ISSUED"
}
]
}'curl --location 'https://eu.api.capillarytech.com/v2/customers/564845545/changeIdentifier?source=INSTORE' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'Authorization: Basic =' \
--header 'Cookie: _cfuvid=a0NmZQvi.30LKK7NvCQJgMpK8Ig15sul9um2ZFRucDk-1757422794990-0.0.1.1-604800000' \
--data '{
"add": [
{
"type": "cardnumber",
"value": "mtest00000000057003",
"seriesCode": "Test",
"statusLabel": "ACTIVE"
}
]
}'Body parameters
| Field | Type | Required | Description |
|---|---|---|---|
| add | Array | Conditional | Array of identifiers to add to the customer profile. At least one of add or remove is required. |
| .type | Enum | Yes | Type of identifier to add. Supported values: cardnumber, email, mobile, wechat, externalId, cuid, unionId, cardExternalId. |
| .value | String | Yes | Value of the identifier. For cardnumber, enter a valid card number (5-150 characters). For email, provide a valid email address. |
| .seriesId | Integer | Optional | Card series ID to which the card belongs. Applicable when type is cardnumber. |
| .seriesCode | String | Optional | Card series code. Applicable when type is cardnumber. |
| .statusLabel | String | Conditional | Status label for the card. Required when type is cardnumber. Use ACTIVE to link, NOT_ISSUED to unlink. |
| remove | Array | Conditional | Array of identifiers to remove from the customer profile. At least one of add or remove is required. |
| .type | Enum | Yes | Type of identifier to remove. Supported values: cardnumber, email, mobile, wechat, externalId, cuid, unionId, cardExternalId. |
| .value | String | Yes | Value of the identifier to remove. |
| .seriesId | Integer | Optional | Card series ID. Applicable when type is cardnumber. |
| .seriesCode | String | Optional | Card series code. Applicable when type is cardnumber. |
| .statusLabel | String | Conditional | Status label for the card. Required when type is cardnumber. Use NOT_ISSUED to delink. |
NoteWhen using
externalId, the value must match the prefix and length configured in Org Settings > Registration. For example, if the prefix isLM*and the length is 10 digits, only values starting withLMand exactly 10 digits long are accepted.
For more info on adding cards, refer to Adding cards.
Example response
{
"createdId": 564854782,
"warnings": []
}Error and warning codes
| Code | Description |
|---|---|
| 8015 | Customer not found for the given identifiers. No customer exists with the specified user ID. |
| 8055 | Invalid email address. The email format is not valid. |
| 8056 | Invalid mobile number. The mobile number format is not valid. |
| 8070 | No valid change detected. The request must contain at least one identifier in add or remove. |
| 8071 | Mobile already attached. The mobile number is already associated with this customer profile. |
| 8072 | Email already attached. The email address is already associated with this customer profile. |
| 8073 | External ID already attached. The external ID is already associated with this customer profile. |
| 8074 | Identifier found in multiple sources. The identifier exists in multiple sources and cannot be uniquely resolved. |
| 8075 | Primary identifier mismatch. The primary identifier does not match with other identifiers in the profile. |
| 11000 | Duplicate identifier value. The new identifier already exists in another profile. The update fails, and the identifier is not synced. |
| 11001 | Invalid external ID format. The external ID does not match the required prefix or length as configured in Org Settings > Registration. |
| 521 | Global customer lock. Multiple actions are running for the same customer. Retry after a short delay. |
