3. Creating a customer

Creating your first customer.

The Customers object acts as a representation of your customer. This gives you a way to reference and perform operations on customer accounts, and to facilitate account management.

The first thing your customer will need to do is submit their details such as their name and address in your onboarding flow.

To create an instance of a customer object, use the POST /customers/ operation and provide your customer's parameters, such as name, date of birth, address and so on, in the body of the request, as shown in the example 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": "PHYSICAL",
               "street": "345 California Ave.",
               "street2": "Suite 600",
               "city": "San Francisco",
               "state": "CA",
               "zip_code": "12345-1234",
               "country": "US",
               "is_primary": true
          }
     ],
     "dob": "1997-12-25",
     "first_name": "James",
     "last_name": "Bond",
     "ssn": "333-52-7584",
     "phone": "555-111-2222",
     "phone_country_code": "1",
     "email": "[email protected]"
}
'
import requests

url = "https://sandbox.bond.tech/api/v0.1/customers/"

payload = {
    "addresses": [
        {
            "address_type": "PHYSICAL",
            "street": "345 California Ave.",
            "street2": "Suite 600",
            "city": "San Francisco",
            "state": "CA",
            "zip_code": "12345-1234",
            "country": "US",
            "is_primary": True
        }
    ],
    "dob": "1997-12-25",
    "first_name": "James",
    "last_name": "Bond",
    "ssn": "333-52-7584",
    "phone": "555-111-2222",
    "phone_country_code": "1",
    "email": "[email protected]"
}
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\":\"PHYSICAL\",\"street\":\"345 California Ave.\",\"street2\":\"Suite 600\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip_code\":\"12345-1234\",\"country\":\"US\",\"is_primary\":true}],\"dob\":\"1997-12-25\",\"first_name\":\"James\",\"last_name\":\"Bond\",\"ssn\":\"333-52-7584\",\"phone\":\"555-111-2222\",\"phone_country_code\":\"1\",\"email\":\"[email protected]\"}"

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: 'PHYSICAL',
        street: '345 California Ave.',
        street2: 'Suite 600',
        city: 'San Francisco',
        state: 'CA',
        zip_code: '12345-1234',
        country: 'US',
        is_primary: true
      }
    ],
    dob: '1997-12-25',
    first_name: 'James',
    last_name: 'Bond',
    ssn: '333-52-7584',
    phone: '555-111-2222',
    phone_country_code: '1',
    email: '[email protected]'
  })
};

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\":\"PHYSICAL\",\"street\":\"345 California Ave.\",\"street2\":\"Suite 600\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip_code\":\"12345-1234\",\"country\":\"US\",\"is_primary\":true}],\"dob\":\"1997-12-25\",\"first_name\":\"James\",\"last_name\":\"Bond\",\"ssn\":\"333-52-7584\",\"phone\":\"555-111-2222\",\"phone_country_code\":\"1\",\"email\":\"[email protected]\"}", 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\":\"PHYSICAL\",\"street\":\"345 California Ave.\",\"street2\":\"Suite 600\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip_code\":\"12345-1234\",\"country\":\"US\",\"is_primary\":true}],\"dob\":\"1997-12-25\",\"first_name\":\"James\",\"last_name\":\"Bond\",\"ssn\":\"333-52-7584\",\"phone\":\"555-111-2222\",\"phone_country_code\":\"1\",\"email\":\"[email protected]\"}");
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();

📘

How do I get my API key?

If you don't have an API key, see Getting your API key.

The JSON response contains all the information related to the newly created customer. It also includes customer_id, which is a unique Bond platform identifier for your customer. The customer_id identifier is used in subsequent API calls to retrieve and update the customer resource, initiate KYC, and 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"
}

Trying to add a customer with a missing field

If you try to add a customer using an existing brand_person_id or with a missing payload field, you receive a JSON error response similar to that shown below:

400
{
'Message': {'last_name': ['Missing data for required field.']},
 'Status': 400,
 'Code': 'create_customer_schema',
 'Type': 'Request Error'
}

For a complete specification and interactive examples, see Create a customer in the Bond API Reference.


Next Steps