Creating a customer resource

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.

▶ Run in Postman

customer object

ParameterTypeDescription
dob
required
dateCustomer's birthday in YYYY-MM-DD format.
first_name
required
stringCustomer's first name, between 2 and 50 characters. Must start with a letter and can only be letters, spaces, and apostrophes.
middle_namestringCustomer's middle name, between 2 and 50 characters. Must start with a letter and can only be letters, spaces, and apostrophes.
last_namestringCustomer's last name, between 2 and 50 characters. Must start with a letter and can only be letters, spaces, and apostrophes.
ssnstringCustomer's Social Security Number.
phonestringCustomer's phone number. Must be only numbers or hyphens.
phone_country_codestringCustomer's country dialing code. Between one and three digits.
emailstringCustomer's valid email address.
addresses
At least one primary address required
arrayArray of object(s) detailing the customer's physical or mailing address.

addresses array

The addresses array is within the customer object and has the following structure.

ParameterTypeDescription
address_type
required
stringEither MAILING or PHYSICAL.
street
required
stringFreeform name between 1 and 40 characters. May contain only alphanumeric and these special characters . , _ - #
street2stringFreeform name maximum 40 characters.
city
required
stringCustomer's city name, between 2 and 40 characters.
state
required
stringCustomer's two-character US state code. Non-US state code maximum is 20 characters.
zip_code
required
stringCustomer's five-digit or nine-digit US zip code.
Non-US state code can be between 2 and 20 characters.
country
required
stringISO 3166-1 alpha-2 country code, maximum two characters.
is_primary
required
booleanIs this the primary address; either true or false.

Example request

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();

Example response

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"
    }
  ],
  "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.

When missing a 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'
}