You can use this API to add and remove users from the campaign. All receipts and voucher codes for a user must always be sent in full.
| Property | Description |
|---|---|
customer_phone |
(required) String must start with "+" and can only contain numbers and plus signs. |
receipts |
(optional) Array, All receipts belonging to the customer. |
gifts |
(optional) Array, All coupons/gifts belonging to the customer. |
- coupon_code |
A string representing the coupon code. |
- gift_description |
A string representing the gift description. |
- given_date |
A timestamp indicating the date when the gift was given to the customer. |
NOTE: To avoid synchronization problems, all receipts and coupons for the customer must be added each time. If these fields are not submitted, or are submitted empty, all receipts for that customer will be deleted. To delete a specific receipt or coupon for a customer, simply skip the data for that item.
[
{
"customer_phone": "+905555555555",
"receipts": [
{
"receipt_no": "1AnW",
"receipt_store_id": "NJ8GHxQZae",
"receipt_store_name": "3M Migros",
"receipt_amount": 10,
"receipt_date": 1680779303642
}
],
"gifts": [
{
"coupon_code": "Code",
"given_date": 1680537756951
}
]
}
]
{
"referenceId": "5ebde3f5-3022-4e0e-81d6-048b530415a0",
"source": "PROVIDER",
"status": 2,
"time": "2023-05-22T12:43:04.738Z"
}
Returns the last status information of the campaign participants in the queue and any errors.
| Property | Description |
|---|---|
referenceId |
(required) Reference info used to track the data in the queue. |
Status Codes
| Code | Description |
|---|---|
0 |
Error, data is not in proper format or incorrect. |
1 |
Successful. |
2 |
Added to the queue, waiting. |
/ext/third-party-campaign/5ebde3f5-3022-4e0e-81d6-048b530415a0/report
{
"_id": "646b63588b8b34dbe3f1a0b0",
"referenceId": "5ebde3f5-3022-4e0e-81d6-048b530415a0",
"source": "PROVIDER",
"status": 2,
"error": [],
"createdAt": "2023-05-22T12:43:04.738Z",
"updatedAt": "2023-05-22T12:43:04.738Z"
}
This endpoint is used for updating existing customers or creating new customers.
This endpoint requires a Bearer token issued for one of the wifi, Lucy or insider access cards.
Either customer_phone or customer_email must be provided. The customer is looked up by phone number first; if no phone number is sent, the lookup falls back to email.
| Property | Description |
|---|---|
customer_phone |
(required if no email) String, 10-16 characters. Must include the country code; the leading + is optional: 905395555555 and +905395555555 are accepted. Local formats without a country code (05395555555, 5395555555) are rejected. Numbers from all countries are supported. The number is normalized to E.164 (+90...) and must be a valid mobile number. |
customer_email |
(required if no phone) String, a valid email address. Stored lowercased. |
customer_name |
(required for new customers) String, 2-64 characters, customer's first name. |
customer_surname |
(required for new customers) String, 2-64 characters, customer's last name. |
customer_gender |
(required for new customers) String, one of male, female, unknown. |
customer_birthdate |
(required for new customers) String, in YYYY-MM-DD format. |
customer_country |
(optional) String, ISO 3166-1 alpha-2 country code (TR, DE, ...). |
customer_province |
(optional) String, province (İl). Validated against the known province list. |
customer_district |
(optional) String, district (İlçe). Must belong to the given province. |
customer_locality |
(optional) String, locality (Mahalle). |
customer_address |
(optional) String, street address. |
customer_accepts_kvkk |
(required for new customers) Boolean, must be true. KVKK (data protection) acceptance. |
customer_accepts_kvkk_at |
(required with customer_accepts_kvkk) Number, millisecond timestamp of KVKK acceptance. |
customer_allows_sms |
(optional) Boolean, opt-in status for SMS messages. |
customer_allows_sms_at |
(required with customer_allows_sms) Number, millisecond timestamp of the SMS consent. |
customer_allows_call |
(optional) Boolean, opt-in status for phone calls. |
customer_allows_call_at |
(required with customer_allows_call) Number, millisecond timestamp of the call consent. |
customer_allows_email |
(optional) Boolean, opt-in status for email. |
customer_allows_email_at |
(required with customer_allows_email) Number, millisecond timestamp of the email consent. |
customer_cks |
(optional) String. |
*_at timestamp is newer than the timestamp stored in CDP. Stale consents are silently ignored, so late-delivered batches cannot overwrite fresher data.400.400. New customers are created atomically by phone/email, so concurrent requests for the same person cannot create duplicate records.400.500 is returned; retry the request later.customer_allows_sms, customer_allows_call, customer_allows_email are not sent for a new customer, they default to false.NOTE: customer_phone in the response is always returned in E.164 format (+90...), regardless of the format it was sent in.
Business-rule violations return 400 with the following body shape:
| Status | Error message | When |
|---|---|---|
400 |
Phone number or email address is required. |
Neither customer_phone nor customer_email was sent. |
400 |
Phone number must be in the format [+][country code][area code][phone number] |
The phone number could not be parsed, is missing the country code, or is not a valid number. |
400 |
Must have mobile phone number |
The phone number is valid but not a mobile number. |
400 |
You must enter a valid email address |
The email address is malformed. |
400 |
Email address is already registered to another customer. |
The email belongs to a different customer record. |
400 |
Permissions must be within the last three business days: {consents} |
One or more consent timestamps are older than three business days. |
400 |
You cannot perform this action because the customer has been deleted. |
The customer was deleted and the request carries no newer consent. |
400 |
The following fields are required to create a user: {fields} |
A new customer is being created and required fields are missing. |
400 |
Invalid city name: {value} / Invalid town name: {value} / city-town relation errors |
customer_province / customer_district failed locality validation. |
403 |
Forbidden |
Missing, malformed or unauthorized Bearer token. |
422 |
Schema validation message | The request body does not match the schema (wrong types, length limits, missing *_at fields, etc.). |
500 |
An internal server error occurred |
Consents could not be delivered to the consent authority; nothing was saved. Retry later. |
403 and 422 responses use the standard error envelope:
BREAKING CHANGE:
POST /ext/customers/upserthas been removed. UsePOST /ext/customers/upsert-v2instead. The v2 endpoint validates and normalizes phone numbers, protects against duplicate customer records, and wraps the response in a{ "status": true, "customer": { ... } }envelope.
curl --location 'https://api.kns-cdp.com/ext/customers/upsert-v2' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
--data-raw '{
"customer_phone": "+905395555555",
"customer_email": "fatih.akdogan@kns.com.tr",
"customer_name": "Fatih",
"customer_surname": "Akdoğan",
"customer_gender": "male",
"customer_birthdate": "1997-06-11",
"customer_country": "TR",
"customer_province": "İstanbul",
"customer_district": "Sarıyer",
"customer_locality": "Reşitpaşa Mahallesi",
"customer_address": "Prof. B. Karafakıoğlu Cd No:116",
"customer_accepts_kvkk": true,
"customer_accepts_kvkk_at": 1782813645498,
"customer_allows_sms": true,
"customer_allows_sms_at": 1782813645498,
"customer_allows_call": true,
"customer_allows_call_at": 1782813645498,
"customer_allows_email": false,
"customer_allows_email_at": 1782813645498
}'
{
"customer_phone": "+905395555555",
"customer_email": "fatih.akdogan@kns.com.tr",
"customer_name": "Fatih",
"customer_surname": "Akdoğan",
"customer_gender": "male",
"customer_birthdate": "1997-06-11",
"customer_country": "TR",
"customer_province": "İstanbul",
"customer_district": "Sarıyer",
"customer_locality": "Reşitpaşa Mahallesi",
"customer_address": "Prof. B. Karafakıoğlu Cd No:116",
"customer_accepts_kvkk": true,
"customer_accepts_kvkk_at": 1782813645498,
"customer_allows_sms": true,
"customer_allows_sms_at": 1782813645498,
"customer_allows_call": true,
"customer_allows_call_at": 1782813645498,
"customer_allows_email": false,
"customer_allows_email_at": 1782813645498
}
{
"status": true,
"customer": {
"_id": "644231fe0ff5b6105966b383",
"customer_phone": "+905395555555",
"customer_name": "Fatih",
"customer_surname": "Akdoğan",
"customer_gender": "male",
"customer_email": "fatih.akdogan@kns.com.tr",
"customer_birthdate": "1997-06-11",
"customer_profile_photo": "",
"customer_province": "İstanbul",
"customer_district": "Sarıyer",
"customer_locality": "Reşitpaşa Mahallesi",
"customer_address": "Prof. B. Karafakıoğlu Cd No:116",
"customer_accepts_kvkk": true,
"customer_accepts_terms_conditions": false,
"customer_allows_sms": true,
"customer_allows_call": true,
"customer_allows_email": false,
"customer_is_parent": false,
"customer_is_developer": false,
"customer_cks": "",
"customer_vehicle_plate": ""
}
}
{
"status": false,
"errors": ["Email address is already registered to another customer."]
}
{
"statusCode": 403,
"error": "Forbidden",
"message": "Forbidden"
}
This endpoint has been removed and no longer accepts requests.
DEPRECATED:
POST /ext/customers/upserthas been removed. UsePOST /ext/customers/upsert-v2instead.
This endpoint is used to check a customer's KVKK acceptance and ETK (electronic communication) permissions by phone number. It returns the customer's name, surname, KVKK acceptance status, and ETK permissions.
This endpoint requires authentication with the insider access card bearer token.
| Property | Description |
|---|---|
customer_phone |
(required) String must start with "+" and can only contain numbers and plus signs. |
| Property | Description |
|---|---|
customer_name |
String, customer's first name |
customer_surname |
String, customer's last name |
customer_phone |
String, customer's phone number |
customer_accepts_kvkk |
Boolean, indicates if the customer has accepted KVKK (data protection) |
customer_allows_sms |
Boolean, indicates if the customer has opted in for SMS messages |
customer_allows_call |
Boolean, indicates if the customer has opted in for phone calls |
customer_allows_email |
Boolean, indicates if the customer has opted in for email |
400 Bad Request: If the phone number is invalid or the customer is not found401 Unauthorized: If the request is not authenticated with the proper bearer token{
"customer_phone": "+905395555555"
}
{
"customer_name": "Yusuf",
"customer_surname": "Karaaslan",
"customer_phone": "+905395555555",
"customer_accepts_kvkk": true,
"customer_allows_sms": true,
"customer_allows_call": true,
"customer_allows_email": false
}
Returns the stores belonging to the location.
[
{
"_id": "NJ8GHxQZae",
"store_name": "3M Migros"
},
{
"_id": "4ymyCScTl",
"store_name": "Allcar Yıkama"
},
{
"_id": "S1Z_g1zFs",
"store_name": "Anka Çiçekçilik"
},
{
"_id": "Vkxp4eQWTg",
"store_name": "Atasun Optik"
},
{
"_id": "NkxRNgX-ag",
"store_name": "Bay Döner"
},
{
"_id": "NkXRExmZax",
"store_name": "Burger King"
}
]