Create or update
You can use the create or update customer API to create/update customer inside your system.
Request parameters
info
Either email or phoneNumber must be provided; both cannot be empty at the same time.
Name | Type | Required/Optional | Description |
---|---|---|---|
partnerCustomerId | string | Optional | Customer id of the customer |
firstName | string | Optional | First name of the customer |
lastName | string | Optional | Last name of the customer |
phoneNumber | string | Optional | Phone number of the customer |
email | string | Optional | Email of the customer |
secondaryEmail | string | Optional | Secondary email of the customer |
secondaryPhoneNumber | string | Optional | Secondary phone number of the customer |
alternateEmails | string[] | Optional | Alternate emails for asset creation |
alternatePhoneNumbers | string[] | Optional | Alternate phones number for asset creation |
secondaryEmails | string[] | Optional | Alternate emails for asset creation |
secondaryPhoneNumbers | string[] | Optional | Alternate phone numbers for asset creation |
overWriteAssets | boolean | Optional | Override the existing assets with new one |
tags | string[] | Optional | Customer tags |
addresses | BikPlatformAddress[] | Optional | Address of the customer. Check the BikPlatformAddress type here. |
Note:
The secondaryEmails
and secondaryPhoneNumbers
fields are now deprecated. Please use alternateEmails
and alternatePhoneNumbers
instead.
Request Information
Category | Value |
---|---|
Http request | POST |
URL | https://bikapi.bikayi.app/integrations/bikPlatformFunctions-customers/createOrUpdate |
Sample request
curl --location 'https://bikapi.bikayi.app/integrations/bikPlatformFunctions-customers/createOrUpdate' \
--header 'Authorization: Basic AUTH_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"partnerCustomerId": "abcd-122345",
"firstName": "First",
"lastName": "Last",
"phoneNumber": "+919090909090",
"email": "test.2@bik.ai",
"secondaryEmail": "test3@bik.ai",
"secondaryPhoneNumber": "+918908898123",
"alternateEmails": ["test898900@bik.ai", "test898911@bik.ai"],
"alternatePhoneNumbers": ["+918989890011", "+918989890022"],
"tags": ["test", "test2"],
"addresses": [
{
"address1": "hsr layout",
"city": "bangalore",
"country": "India",
"countryCode": "IN",
"state": "karnataka",
"zip": "560102"
}
]
}'
JSON response example:
{
"status": 200,
"success": true,
"data": {
"customer": {
"id": 5482636,
"partnerCustomerId": "abcd-122345",
"firstName": "Test",
"lastName": "Last",
"phoneNumber": "+919090909090",
"email": "test.2@bik.ai",
"countryCode": "IND",
"createdAt": "2024-08-09T09:32:55.568Z",
"updatedAt": "2024-08-09T09:33:15.939Z",
"assets": [
{
"id": 4516077,
"createdAt": "2024-08-09T09:32:55.583Z",
"assetName": "EMAIL",
"assetValue": "test.2@bik.ai",
"countryCode": null
},
{
"id": 4516079,
"createdAt": "2024-08-09T09:33:16.284Z",
"assetName": "PHONE_NUMBER",
"assetValue": "+919090909090",
"countryCode": "IND"
}
]
}
}
}
Response parameters
Name | Type | Description |
---|---|---|
status | number | Response status |
success | boolean | Is successful response or not |
data | BikPlatformCustomer | Customer details |
BikPlatformAddress Type
Name | Type | Required/Optional | Description |
---|---|---|---|
partnerAddressId | string | Optional | Partner address id of the customer |
addressId | string | Optional | Address id of the customer |
address1 | string | Required | Address1 of the customer |
address2 | string | Optional | Address2 number of the customer |
city | string | Required | City of the customer |
country | string | Required | Country of the customer |
countryCode | string | Required | Country code of the customer |
state | string | Required | State of the customer |
stateCode | string | Optional | State code of the customer |
zip | string | Required | Pincode of the customer |
latitude | number | Optional | Latitude of the address mention |
longitude | number | Optional | Longitude of the address mention |
timezone | string | Optional | Timezone of the address |
firstName | string | Optional | First name of the customer |
lastName | string | Optional | Last name of the customer |
phoneNumber | string | Optional | Phone number of the customer |
email | string | Optional | Email of the customer |
isDefault | boolean | Optional | Is default address of the customer |
BikPlatformCustomer Type
Name | Type | Description |
---|---|---|
partnerCustomerId | string | Customer id of the customer |
firstName | string | First name of the customer |
lastName | string | Last name of the customer |
phoneNumber | string | Phone number of the customer |
email | string | Email of the customer |
addresses | BikPlatformAddress[] | Addresses of the customer |
assets | BikPlatformCustomerAssets[] | Assets of the customer |
BikPlatformAddress Type
Name | Type | Description |
---|---|---|
partnerAddressId | string | Partner address id of the customer |
addressId | string | Address id of the customer |
address1 | string | Address1 of the customer |
address2 | string | Address2 number of the customer |
city | string | City of the customer |
country | string | Country of the customer |
countryCode | string | Country code of the customer |
state | string | State of the customer |
stateCode | string | State code of the customer |
zip | string | Pincode of the customer |
latitude | number | Latitude of the address mention |
longitude | number | Longitude of the address mention |
timezone | string | Timezone of the address |
firstName | string | First name of the customer |
lastName | string | Last name of the customer |
phoneNumber | string | Phone number of the customer |
email | string | Email of the customer |
isDefault | boolean | Is default address of the customer |
BikPlatformCustomerAssets Type
Note:
These are secondary emails and secondary phone numbers of the customer.
Name | Type | Description |
---|---|---|
id | string | ID of the asset |
createdAt | string | Asset creation date |
assetName | string | Asset name (PHONE_NUMBER or EMAIL ) |
assetValue | string | Asset value (a valid phone number or email) |
countryCode | string | Country code |
Errors
Error Code | Meaning |
---|---|
400 | Invalid payload -- Your request is invalid. |
401 | Unauthorized -- User is not authenticated. |
404 | Not Found -- The specified API could not be found. |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
Error response example:
{
"status": 400,
"errors": [
{
"message": "'email' is required. 'phoneNumber' is required"
}
]
}