Skip to main content

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.

NameTypeRequired/OptionalDescription
partnerCustomerIdstringOptionalCustomer id of the customer
firstNamestringOptionalFirst name of the customer
lastNamestringOptionalLast name of the customer
phoneNumberstringOptionalPhone number of the customer
emailstringOptionalEmail of the customer
secondaryEmailstringOptionalSecondary email of the customer
secondaryPhoneNumberstringOptionalSecondary phone number of the customer
alternateEmailsstring[]OptionalAlternate emails for asset creation
alternatePhoneNumbersstring[]OptionalAlternate phones number for asset creation
secondaryEmailsstring[]OptionalAlternate emails for asset creation
secondaryPhoneNumbersstring[]OptionalAlternate phone numbers for asset creation
overWriteAssetsbooleanOptionalOverride the existing assets with new one
tagsstring[]OptionalCustomer tags
addressesBikPlatformAddress[]OptionalAddress 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

CategoryValue
Http requestPOST
URLhttps://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

NameTypeDescription
statusnumberResponse status
successbooleanIs successful response or not
dataBikPlatformCustomerCustomer details

BikPlatformAddress Type

NameTypeRequired/OptionalDescription
partnerAddressIdstringOptionalPartner address id of the customer
addressIdstringOptionalAddress id of the customer
address1stringRequiredAddress1 of the customer
address2stringOptionalAddress2 number of the customer
citystringRequiredCity of the customer
countrystringRequiredCountry of the customer
countryCodestringRequiredCountry code of the customer
statestringRequiredState of the customer
stateCodestringOptionalState code of the customer
zipstringRequiredPincode of the customer
latitudenumberOptionalLatitude of the address mention
longitudenumberOptionalLongitude of the address mention
timezonestringOptionalTimezone of the address
firstNamestringOptionalFirst name of the customer
lastNamestringOptionalLast name of the customer
phoneNumberstringOptionalPhone number of the customer
emailstringOptionalEmail of the customer
isDefaultbooleanOptionalIs default address of the customer

BikPlatformCustomer Type

NameTypeDescription
partnerCustomerIdstringCustomer id of the customer
firstNamestringFirst name of the customer
lastNamestringLast name of the customer
phoneNumberstringPhone number of the customer
emailstringEmail of the customer
addressesBikPlatformAddress[]Addresses of the customer
assetsBikPlatformCustomerAssets[]Assets of the customer

BikPlatformAddress Type

NameTypeDescription
partnerAddressIdstringPartner address id of the customer
addressIdstringAddress id of the customer
address1stringAddress1 of the customer
address2stringAddress2 number of the customer
citystringCity of the customer
countrystringCountry of the customer
countryCodestringCountry code of the customer
statestringState of the customer
stateCodestringState code of the customer
zipstringPincode of the customer
latitudenumberLatitude of the address mention
longitudenumberLongitude of the address mention
timezonestringTimezone of the address
firstNamestringFirst name of the customer
lastNamestringLast name of the customer
phoneNumberstringPhone number of the customer
emailstringEmail of the customer
isDefaultbooleanIs default address of the customer

BikPlatformCustomerAssets Type

Note:

These are secondary emails and secondary phone numbers of the customer.

NameTypeDescription
idstringID of the asset
createdAtstringAsset creation date
assetNamestringAsset name (PHONE_NUMBER or EMAIL)
assetValuestringAsset value (a valid phone number or email)
countryCodestringCountry code

Errors

Error CodeMeaning
400Invalid payload -- Your request is invalid.
401Unauthorized -- User is not authenticated.
404Not Found -- The specified API could not be found.
500Internal 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"
}
]
}