3. Creating a customer

This page describes how you create a new customer.

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

The first thing your customer will need to do is submit their details like 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/customers/ \
  --header 'Identity: YOUR-IDENTITY' \
  --header 'Authorization: YOUR-AUTHORIZATION' \
  --header 'Content-Type: application/json' \
  --data '{
    "brand_person_id": "YOUR-USER-ID",
    "dob":"1999-12-25",
    "last_name":"Smith",
    "first_name":"Christine",
    "addresses":[
      {
        "address_type":"PHYSICAL",
        "street":"345 California Ave.",
        "street2": "Suit 600",
        "city": "San Francisco",
        "state": "CA",
        "zip_code": "12345-1234",
        "country": "US",
        "is_primary": true
      },
      {
        "address_type":"MAILING",
        "street":"101 Lake Tahoe Rd.",
        "street2": "Suit 01",
        "city": "San Francisco",
        "state": "CA",
        "zip_code": "12345",
        "country": "US",
        "is_primary": false
      }
    ]
  }'
import requests

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

payload = {
  "brand_person_id": YOUR-USER-ID,
  "dob": "1999-12-25",
  "first_name": "Christine",
  "last_name": "Smith",
  "addresses": [
    {
      "address_type": "PHYSICAL",
      "street": "345 California Ave.",
      "street2": "Suit 600",
      "city": "San Francisco",
      "state": "CA",
      "zip_code": "12345-1234",
      "country": "US",
      "is_primary": True
    },
    {
      "address_type": "MAILING",
      "street": "101 Lake Tahoe Rd.",
      "street2": "Suit 01",
      "city": "San Francisco",
      "state": "CA",
      "zip_code": "12345",
      "country": "US",
      "is_primary": False
    }
  ]
}
headers = {
  "Content-Type": "application/json",
  "Identity": YOUR-IDENTITY,
  "Authorization": YOUR-AUTHORIZATION
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://sandbox.bond.tech/api/v0/customers/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["Identity"] = YOUR-IDENTITY
request["Authorization"] = YOUR-AUTHORIZATION
request.body = "{\"addresses\":[{\"address_type\":\"PHYSICAL\",\"street\":\"345 California Ave.\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip_code\":\"12345-1234\",\"country\":\"US\",\"is_primary\":true,\"street2\":\"Suit 600\"},{\"address_type\":\"MAILING\",\"street\":\"101 Lake Tahoe Rd.\",\"street2\":\"Suit 01\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip_code\":\"12345\",\"country\":\"US\",\"is_primary\":false}],\"brand_person_id\":YOUR_USER_ID,\"dob\":\"1999-12-25\",\"first_name\":\"Christine\",\"last_name\":\"Smith\"}"

response = http.request(request)
puts response.read_body
const data = JSON.stringify({
  "brand_person_id": YOUR-USER-ID,
  "dob": "1999-12-25",
  "first_name": "Christine",
  "last_name": "Smith",
  "addresses": [
    {
      "address_type": "PHYSICAL",
      "street": "345 California Ave.",
      "street2": "Suit 600",
      "city": "San Francisco",
      "state": "CA",
      "zip_code": "12345-1234",
      "country": "US",
      "is_primary": true
    },
    {
      "address_type": "MAILING",
      "street": "101 Lake Tahoe Rd.",
      "street2": "Suit 01",
      "city": "San Francisco",
      "state": "CA",
      "zip_code": "12345",
      "country": "US",
      "is_primary": false
    }
  ]
});

const xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://sandbox.bond.tech/api/v0/customers/");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Identity", YOUR-IDENTITY);
xhr.setRequestHeader("Authorization", YOUR-AUTHORIZATION);

xhr.send(data);
var client = new RestClient("https://sandbox.bond.tech/api/v0/customers/");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Identity", YOUR-IDENTITY);
request.AddHeader("Authorization", YOUR-AUTHORIZATION);
request.AddParameter("application/json", "{\"addresses\":[{\"address_type\":\"PHYSICAL\",\"street\":\"345 California Ave.\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip_code\":\"12345-1234\",\"country\":\"US\",\"is_primary\":true,\"street2\":\"Suit 600\"},{\"address_type\":\"MAILING\",\"street\":\"101 Lake Tahoe Rd.\",\"street2\":\"Suit 01\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip_code\":\"12345\",\"country\":\"US\",\"is_primary\":false}],\"brand_person_id\":YOUR_USER_ID,\"dob\":\"1999-12-25\",\"first_name\":\"Christine\",\"last_name\":\"Smith\"}", 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.\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip_code\":\"12345-1234\",\"country\":\"US\",\"is_primary\":true,\"street2\":\"Suit 600\"},{\"address_type\":\"MAILING\",\"street\":\"101 Lake Tahoe Rd.\",\"street2\":\"Suit 01\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip_code\":\"12345\",\"country\":\"US\",\"is_primary\":false}],\"brand_person_id\":YOUR_USER_ID,\"dob\":\"1999-12-25\",\"first_name\":\"Christine\",\"last_name\":\"Smith\"}");
Request request = new Request.Builder()
  .url("https://sandbox.bond.tech/api/v0/customers/")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Identity", YOUR-IDENTITY)
  .addHeader("Authorization", YOUR-AUTHORIZATION)
  .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 Studio 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": "f637cca2-c070-453d-b2eb-8c74f8640c7b",
    "brand_person_id": "8dd4e2de-33be-4bb3-9a19-25069033a5e0",
    "bond_brand_id": "fa538529-9396-4f47-b442-4092227b7477",
    "date_created": "2020-10-23T22:18:09.327165",
    "dob": "1999-12-25",
    "first_name": "Christine",
    "middle_name": "",
    "last_name": "Smith",
    "addresses": [
        {
            "address_id": "091c79fe-d197-4720-9f8b-5eb6757b971b",
            "address_type": "PHYSICAL",
            "street": "345 California St.",
            "street2": "STE 600",
            "city": "San Francisco",
            "state": "CA",
            "zip_code": "94104-2657",
            "country": "US",
            "is_primary": true,
            "deliverability": "deliverable",
            "date_created": "2020-10-23T22:18:09.340601"
        },
        {
          "address_id": "ba5572e6-bb16-46a5-a95f-fb8aba019aff",
          "address_type": "MAILING",
          "street": "101 Lake Tahoe Rd.",
          "street2": "Suit 01",
          "city": "San Francisco",
          "state": "CA",
          "zip_code": "12345",
          "country": "US",
          "is_primary": false,
          "deliverability": "undeliverable",
          "date_created": "2020-10-23T22:18:09.340601"
        } 
    ]
}

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 Customers in the Bond API Reference.


Did this page help you?