Skip to main content

Create or update

Use the Create or Update Customer API to create a new customer record or update an existing one.

Request parameters​

info

Either email or phoneNumber must be provided; both cannot be empty at the same time.

NameTypeRequired/OptionalDescription
partnerCustomerIdstringOptionalExternal customer ID
firstNamestringOptionalCustomer first name
lastNamestringOptionalCustomer last name
phoneNumberstringOptionalCustomer phone number
emailstringOptionalCustomer email address
secondaryEmailstringOptionalSecondary email address
secondaryPhoneNumberstringOptionalSecondary phone number
alternateEmailsstring[]OptionalAlternate email addresses for asset creation
alternatePhoneNumbersstring[]OptionalAlternate phone numbers for asset creation
secondaryEmailsstring[]OptionalAlternate email addresses for asset creation
secondaryPhoneNumbersstring[]OptionalAlternate phone numbers for asset creation
overWriteAssetsbooleanOptionalReplace existing assets with the provided values
tagsstring[]OptionalCustomer tags
addressesBikPlatformAddress[]OptionalCustomer addresses. See the BikPlatformAddress type here.
Note:

The secondaryEmails and secondaryPhoneNumbers fields are deprecated. 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
statusnumberHTTP status code
successbooleanIndicates whether the request succeeded
dataBikPlatformCustomerCustomer record

BikPlatformAddress Type​

NameTypeRequired/OptionalDescription
partnerAddressIdstringOptionalExternal address ID
addressIdstringOptionalBIK address ID
address1stringRequiredPrimary address line
address2stringOptionalSecondary address line
citystringRequiredCity
countrystringRequiredCountry
countryCodestringRequiredCountry code
statestringRequiredState or province
stateCodestringOptionalState or province code
zipstringRequiredPostal / ZIP code
latitudenumberOptionalAddress latitude
longitudenumberOptionalAddress longitude
timezonestringOptionalAddress timezone
firstNamestringOptionalFirst name
lastNamestringOptionalLast name
phoneNumberstringOptionalPhone number
emailstringOptionalEmail address
isDefaultbooleanOptionalWhether this is the default address

BikPlatformCustomer Type​

NameTypeDescription
partnerCustomerIdstringExternal customer ID
firstNamestringCustomer first name
lastNamestringCustomer last name
phoneNumberstringCustomer phone number
emailstringCustomer email address
addressesBikPlatformAddress[]Customer addresses
assetsBikPlatformCustomerAssets[]Customer assets

BikPlatformAddress Type​

NameTypeDescription
partnerAddressIdstringExternal address ID
addressIdstringBIK address ID
address1stringPrimary address line
address2stringSecondary address line
citystringCity
countrystringCountry
countryCodestringCountry code
statestringState or province
stateCodestringState or province code
zipstringPostal / ZIP code
latitudenumberAddress latitude
longitudenumberAddress longitude
timezonestringAddress timezone
firstNamestringFirst name
lastNamestringLast name
phoneNumberstringPhone number
emailstringEmail address
isDefaultbooleanWhether this is the default address

BikPlatformCustomerAssets Type​

Note:

These represent the customer's secondary email addresses and phone numbers.

NameTypeDescription
idstringAsset ID
createdAtstringAsset creation timestamp
assetNamestringAsset type (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"
}
]
}