Create
curl --request POST \
--url https://{defaultHost}/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer": {
"name": "Test Customer",
"email": "testcustomer@example.com"
}
}
'import requests
url = "https://{defaultHost}/v1/customers"
payload = { "customer": {
"name": "Test Customer",
"email": "testcustomer@example.com"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({customer: {name: 'Test Customer', email: 'testcustomer@example.com'}})
};
fetch('https://{defaultHost}/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/v1/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer' => [
'name' => 'Test Customer',
'email' => 'testcustomer@example.com'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{defaultHost}/v1/customers"
payload := strings.NewReader("{\n \"customer\": {\n \"name\": \"Test Customer\",\n \"email\": \"testcustomer@example.com\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{defaultHost}/v1/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": {\n \"name\": \"Test Customer\",\n \"email\": \"testcustomer@example.com\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer\": {\n \"name\": \"Test Customer\",\n \"email\": \"testcustomer@example.com\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "22aba908-a893-45f8-9a2b-3d462ee83f20",
"object": "customer",
"affiliation_expires_at": null,
"billing_matches_shipping": true,
"email": "testcustomer@example.com",
"first_name": "Test",
"indexed": true,
"last_name": "Customer",
"live_mode": true,
"name": "Test Customer",
"phone": null,
"unsubscribed": false,
"tax_enabled": true,
"portal_url": "http://app.example.com/portal_redirect/customers/22aba908-a893-45f8-9a2b-3d462ee83f20",
"affiliation": null,
"billing_address": null,
"default_payment_method": null,
"default_saved_list": "8469914a-0063-4f9c-a80f-75a4f8d4bbd8",
"shipping_address": null,
"tax_identifier": null,
"created_at": 1796063926,
"updated_at": 1796063926
}Customers
Create
Creates a new customer.
POST
/
v1
/
customers
Create
curl --request POST \
--url https://{defaultHost}/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer": {
"name": "Test Customer",
"email": "testcustomer@example.com"
}
}
'import requests
url = "https://{defaultHost}/v1/customers"
payload = { "customer": {
"name": "Test Customer",
"email": "testcustomer@example.com"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({customer: {name: 'Test Customer', email: 'testcustomer@example.com'}})
};
fetch('https://{defaultHost}/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/v1/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer' => [
'name' => 'Test Customer',
'email' => 'testcustomer@example.com'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{defaultHost}/v1/customers"
payload := strings.NewReader("{\n \"customer\": {\n \"name\": \"Test Customer\",\n \"email\": \"testcustomer@example.com\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{defaultHost}/v1/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": {\n \"name\": \"Test Customer\",\n \"email\": \"testcustomer@example.com\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer\": {\n \"name\": \"Test Customer\",\n \"email\": \"testcustomer@example.com\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "22aba908-a893-45f8-9a2b-3d462ee83f20",
"object": "customer",
"affiliation_expires_at": null,
"billing_matches_shipping": true,
"email": "testcustomer@example.com",
"first_name": "Test",
"indexed": true,
"last_name": "Customer",
"live_mode": true,
"name": "Test Customer",
"phone": null,
"unsubscribed": false,
"tax_enabled": true,
"portal_url": "http://app.example.com/portal_redirect/customers/22aba908-a893-45f8-9a2b-3d462ee83f20",
"affiliation": null,
"billing_address": null,
"default_payment_method": null,
"default_saved_list": "8469914a-0063-4f9c-a80f-75a4f8d4bbd8",
"shipping_address": null,
"tax_identifier": null,
"created_at": 1796063926,
"updated_at": 1796063926
}Authorizations
Response
200 - application/json
Success
Expandable – The associated affiliation ID.
Expandable – Property not returned unless expanded.
Expandable – The associated address ID.
Expandable – The associated payment method ID.
Expandable – The associated saved list ID.
Expandable – Property not returned unless expanded.
Expandable – Property not returned unless expanded.
Expandable – Property not returned unless expanded.
Expandable – The associated address ID.
Expandable – The associated tax identifier ID.
Expandable – Property not returned unless expanded.
Was this page helpful?