Creating a customer
How to create a customer and how to add their details to the system.
Overview
The first thing your customer will need to do is submit their details like their name and address in your onboarding flow. After your customer enters this information, you'll see that a Customer resource has been created. This Customer resource gives you a way to reference and call customer accounts, and to facilitate account management.
Creating a customer
To create an instance of a customer object, use the POST /customers/
operation and provide the parameters as shown in the table below.
Parameter | Type | Description |
---|---|---|
dob required | date | Birthday in YYYY-MM-DD format, for example 1994-03-20 . |
first_name required | string | First name, between 2 and 50 characters. Must start with a letter and can only be letters, spaces, and apostrophes. |
middle_name | string | Middle name, between 2 and 50 characters. Must start with a letter and can only be letters, spaces, and apostrophes. |
last_name | string | Last name, between 2 and 50 characters. Must start with a letter and can only be letters, spaces, and apostrophes. |
ssn | string | Unique Social Security Number associated with the customer |
phone | string | User's phone number. Must be only numbers or dash-separated. |
phone_country_code | string | Country dialing code. Between one and three digits. |
email | string | User's valid email address, for example [email protected] |
addresses At least one primary address required | array | Array of object(s) detailing the physical or mailing addresses (see address Object table below). |
The addresses
array within the Customer object has the following structure.
address Object | Type | Description |
---|---|---|
address_type required | string | Either MAILING or PHYSICAL . |
street required | string | Freeform name between 1 and 40 characters. May contain only alphanumeric and these special characters . , _ - # |
street2 | string | Freeform name maximum 40 characters. |
city required | string | City name, freeform between 2 and 40 characters. |
state required | string | Two-character US state code. Non-US state code maximum 20 characters. |
zip_code required | string | Five-digit US zip code, (for example 12345) or nine-digit US zip code, (for example 12345-1234). Non-US state code between 2 and 20 characters. |
country required | string | ISO 3166-1 alpha-2 country code, maximum two characters. |
is_primary required | boolean | Is this the primary address; either true or false . |
An example of a request to create a customer is shown below.
curl --request POST \
--url https://sandbox.bond.tech/api/v0.1/customers/ \
--header 'Accept: application/json' \
--header 'Authorization: YOUR-AUTHENTICATION' \
--header 'Content-Type: application/json' \
--header 'Identity: YOUR-IDENTITY' \
--data '
{
"addresses": [
{
"address_type": "MAILING",
"street": "345 California Ave.",
"street2": "Suite 600",
"city": "San Francisco",
"state": "CA",
"zip_code": "12345-1234",
"country": "US",
"is_primary": true
}
],
"email": "[email protected]",
"dob": "1997-12-25",
"first_name": "James",
"last_name": "Bond",
"ssn": "XXX-XX-9999",
"phone": "555-111-2222",
"phone_country_code": "1"
}
'
import requests
url = "https://sandbox.bond.tech/api/v0.1/customers/"
payload = {
"addresses": [
{
"address_type": "MAILING",
"street": "345 California Ave.",
"street2": "Suite 600",
"city": "San Francisco",
"state": "CA",
"zip_code": "12345-1234",
"country": "US",
"is_primary": True
}
],
"email": "[email protected]",
"dob": "1997-12-25",
"first_name": "James",
"last_name": "Bond",
"ssn": "XXX-XX-9999",
"phone": "555-111-2222",
"phone_country_code": "1"
}
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Identity": "YOUR-IDENTITY",
"Authorization": "YOUR-AUTHENTICATION"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://sandbox.bond.tech/api/v0.1/customers/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/json'
request["Content-Type"] = 'application/json'
request["Identity"] = 'YOUR-IDENTITY'
request["Authorization"] = 'YOUR-AUTHENTICATION'
request.body = "{\"addresses\":[{\"address_type\":\"MAILING\",\"street\":\"345 California Ave.\",\"street2\":\"Suite 600\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip_code\":\"12345-1234\",\"country\":\"US\",\"is_primary\":true}],\"email\":\"[email protected]\",\"dob\":\"1997-12-25\",\"first_name\":\"James\",\"last_name\":\"Bond\",\"ssn\":\"XXX-XX-9999\",\"phone\":\"555-111-2222\",\"phone_country_code\":\"1\"}"
response = http.request(request)
puts response.read_body
const options = {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Identity: 'YOUR-IDENTITY',
Authorization: 'YOUR-AUTHENTICATION'
},
body: JSON.stringify({
addresses: [
{
address_type: 'MAILING',
street: '345 California Ave.',
street2: 'Suite 600',
city: 'San Francisco',
state: 'CA',
zip_code: '12345-1234',
country: 'US',
is_primary: true
}
],
email: '[email protected]',
dob: '1997-12-25',
first_name: 'James',
last_name: 'Bond',
ssn: 'XXX-XX-9999',
phone: '555-111-2222',
phone_country_code: '1'
})
};
fetch('https://sandbox.bond.tech/api/v0.1/customers/', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
var client = new RestClient("https://sandbox.bond.tech/api/v0.1/customers/");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Identity", "YOUR-IDENTITY");
request.AddHeader("Authorization", "YOUR-AUTHENTICATION");
request.AddParameter("application/json", "{\"addresses\":[{\"address_type\":\"MAILING\",\"street\":\"345 California Ave.\",\"street2\":\"Suite 600\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip_code\":\"12345-1234\",\"country\":\"US\",\"is_primary\":true}],\"email\":\"[email protected]\",\"dob\":\"1997-12-25\",\"first_name\":\"James\",\"last_name\":\"Bond\",\"ssn\":\"XXX-XX-9999\",\"phone\":\"555-111-2222\",\"phone_country_code\":\"1\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"addresses\":[{\"address_type\":\"MAILING\",\"street\":\"345 California Ave.\",\"street2\":\"Suite 600\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip_code\":\"12345-1234\",\"country\":\"US\",\"is_primary\":true}],\"email\":\"[email protected]\",\"dob\":\"1997-12-25\",\"first_name\":\"James\",\"last_name\":\"Bond\",\"ssn\":\"XXX-XX-9999\",\"phone\":\"555-111-2222\",\"phone_country_code\":\"1\"}");
Request request = new Request.Builder()
.url("https://sandbox.bond.tech/api/v0.1/customers/")
.post(body)
.addHeader("Accept", "application/json")
.addHeader("Content-Type", "application/json")
.addHeader("Identity", "YOUR-IDENTITY")
.addHeader("Authorization", "YOUR-AUTHENTICATION")
.build();
Response response = client.newCall(request).execute();
The JSON response contains all the information related to the newly created customer. It includes the customer_id
which is a unique Bond platform identifier for your customer. The customer_id
is used in subsequent API calls to retrieve and update the customer resource, and to issue cards. An example of a response to a successful request to create a customer is shown below.
{
"customer_id": "b3f7f6c9-503e-4457-b0ca-31f65131cfff",
"brand_person_id": "ac6ee2d3-5a03-4043-a4aa-dda51836b9fd",
"bond_brand_id": "8c7e08c8-0320-444c-b834-007cd9e18c0e",
"business_id": "null",
"dob": "1997-12-25",
"first_name": "James",
"middle_name": "Herbert",
"last_name": "Bond",
"ssn": "XXX-XX-9999",
"phone": "555-111-2222",
"phone_country_code": "1",
"email": "[email protected]",
"addresses": [
{
"address_id": "5ff2a5f8-2d96-4c89-9edc-ec762ac3844c",
"address_type": "MAILING",
"street": "345 California Ave.",
"street2": "Suite 600",
"city": "San Francisco",
"state": "CA",
"zip_code": "12345-1234",
"country": "US",
"is_primary": true,
"date_created": "2021-10-11T17:54:26.784367+00:00",
"deliverability": "deliverable"
}
],
"date_created": "2021-06-02T13:38:27.965404+00:00"
}
For a complete specification and interactive examples, see Creating a customer in the Bond API Reference.
Trying to create a customer with a missing field
If you try to create a customer with a missing field, you receive a JSON error message similar to the one shown below.
400
{
'Message': {'last_name': ['Missing data for required field.']},
'Status': 400,
'Code': 'create_customer_schema',0
'Type': 'Request Error'
}
Updated over 2 years ago