cURL
curl -X POST https://api.metrifox.com/api/v1/customers/bulk-create \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"customers": [
{
"customer_type": "BUSINESS",
"customer_key": "acme_corp_001",
"primary_email": "contact@acmecorp.com",
"legal_name": "Acme Corporation",
"display_name": "Acme Corp"
},
{
"customer_type": "INDIVIDUAL",
"customer_key": "jane_doe_001",
"primary_email": "jane@example.com",
"first_name": "Jane",
"last_name": "Doe"
}
]
}'from metrifox_sdk import MetrifoxClient
client = MetrifoxClient(api_key="your_api_key")
result = client.customers.bulk_create([
{
"customer_type": "BUSINESS",
"customer_key": "acme_corp_001",
"primary_email": "contact@acmecorp.com",
"legal_name": "Acme Corporation",
"display_name": "Acme Corp"
},
{
"customer_type": "INDIVIDUAL",
"customer_key": "jane_doe_001",
"primary_email": "jane@example.com",
"first_name": "Jane",
"last_name": "Doe"
}
])
import { init } from "metrifox-js";
const metrifoxClient = init({
apiKey: process.env.METRIFOX_API_KEY
});
const result = await metrifoxClient.customers.bulkCreate({
customers: [
{
customer_type: "BUSINESS",
customer_key: "acme_corp_001",
primary_email: "contact@acmecorp.com",
legal_name: "Acme Corporation",
display_name: "Acme Corp"
},
{
customer_type: "INDIVIDUAL",
customer_key: "jane_doe_001",
primary_email: "jane@example.com",
first_name: "Jane",
last_name: "Doe"
}
]
});
require 'metrifox-sdk'
METRIFOX_SDK = MetrifoxSDK.init({ api_key: "your-api-key" })
result = METRIFOX_SDK.customers.bulk_create({
customers: [
{
customer_type: "BUSINESS",
customer_key: "acme_corp_001",
primary_email: "contact@acmecorp.com",
legal_name: "Acme Corporation",
display_name: "Acme Corp"
},
{
customer_type: "INDIVIDUAL",
customer_key: "jane_doe_001",
primary_email: "jane@example.com",
first_name: "Jane",
last_name: "Doe"
}
]
})
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/api/v1/customers/bulk-create",
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([
'customers' => [
[
'customer_type' => 'BUSINESS',
'customer_key' => 'acme_corp_001',
'primary_email' => 'contact@acmecorp.com',
'legal_name' => 'Acme Corporation',
'display_name' => 'Acme Corp',
'currency' => 'USD',
'timezone' => 'America/New_York',
'address_line1' => '123 Business Ave',
'city' => 'New York',
'state' => 'NY',
'country' => 'United States',
'zip_code' => '10001'
],
[
'customer_type' => 'INDIVIDUAL',
'customer_key' => 'jane_doe_001',
'primary_email' => 'jane@example.com',
'first_name' => 'Jane',
'last_name' => 'Doe',
'currency' => 'USD',
'timezone' => 'America/Los_Angeles'
],
[
'customer_type' => 'BUSINESS',
'customer_key' => 'globex_001',
'primary_email' => 'info@globex.com',
'legal_name' => 'Globex Corporation',
'display_name' => 'Globex',
'currency' => 'EUR'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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}/api/v1/customers/bulk-create"
payload := strings.NewReader("{\n \"customers\": [\n {\n \"customer_type\": \"BUSINESS\",\n \"customer_key\": \"acme_corp_001\",\n \"primary_email\": \"contact@acmecorp.com\",\n \"legal_name\": \"Acme Corporation\",\n \"display_name\": \"Acme Corp\",\n \"currency\": \"USD\",\n \"timezone\": \"America/New_York\",\n \"address_line1\": \"123 Business Ave\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"country\": \"United States\",\n \"zip_code\": \"10001\"\n },\n {\n \"customer_type\": \"INDIVIDUAL\",\n \"customer_key\": \"jane_doe_001\",\n \"primary_email\": \"jane@example.com\",\n \"first_name\": \"Jane\",\n \"last_name\": \"Doe\",\n \"currency\": \"USD\",\n \"timezone\": \"America/Los_Angeles\"\n },\n {\n \"customer_type\": \"BUSINESS\",\n \"customer_key\": \"globex_001\",\n \"primary_email\": \"info@globex.com\",\n \"legal_name\": \"Globex Corporation\",\n \"display_name\": \"Globex\",\n \"currency\": \"EUR\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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}/api/v1/customers/bulk-create")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customers\": [\n {\n \"customer_type\": \"BUSINESS\",\n \"customer_key\": \"acme_corp_001\",\n \"primary_email\": \"contact@acmecorp.com\",\n \"legal_name\": \"Acme Corporation\",\n \"display_name\": \"Acme Corp\",\n \"currency\": \"USD\",\n \"timezone\": \"America/New_York\",\n \"address_line1\": \"123 Business Ave\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"country\": \"United States\",\n \"zip_code\": \"10001\"\n },\n {\n \"customer_type\": \"INDIVIDUAL\",\n \"customer_key\": \"jane_doe_001\",\n \"primary_email\": \"jane@example.com\",\n \"first_name\": \"Jane\",\n \"last_name\": \"Doe\",\n \"currency\": \"USD\",\n \"timezone\": \"America/Los_Angeles\"\n },\n {\n \"customer_type\": \"BUSINESS\",\n \"customer_key\": \"globex_001\",\n \"primary_email\": \"info@globex.com\",\n \"legal_name\": \"Globex Corporation\",\n \"display_name\": \"Globex\",\n \"currency\": \"EUR\"\n }\n ]\n}")
.asString();{
"statusCode": 200,
"message": "Bulk Customer Creation Completed",
"meta": {},
"data": {
"total": 3,
"successful_count": 3,
"failed_count": 0,
"customers_created": [
{
"index": 0,
"customer_key": "acme_corp_001",
"data": {
"id": "764c80e3-ed59-44a5-ba07-7ee5ba547774",
"customer_type": "BUSINESS",
"primary_email": "contact@acmecorp.com",
"display_name": "Acme Corp"
}
},
{
"index": 1,
"customer_key": "jane_doe_001",
"data": {
"id": "864c80e3-ed59-44a5-ba07-7ee5ba547775",
"customer_type": "INDIVIDUAL",
"primary_email": "jane@example.com",
"display_name": "Jane Doe"
}
},
{
"index": 2,
"customer_key": "globex_001",
"data": {
"id": "964c80e3-ed59-44a5-ba07-7ee5ba547776",
"customer_type": "BUSINESS",
"primary_email": "info@globex.com",
"display_name": "Globex"
}
}
],
"customers_failed": []
},
"errors": {}
}Customers
Bulk Create Customers
Create multiple customers in a single request
POST
/
api
/
v1
/
customers
/
bulk-create
cURL
curl -X POST https://api.metrifox.com/api/v1/customers/bulk-create \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"customers": [
{
"customer_type": "BUSINESS",
"customer_key": "acme_corp_001",
"primary_email": "contact@acmecorp.com",
"legal_name": "Acme Corporation",
"display_name": "Acme Corp"
},
{
"customer_type": "INDIVIDUAL",
"customer_key": "jane_doe_001",
"primary_email": "jane@example.com",
"first_name": "Jane",
"last_name": "Doe"
}
]
}'from metrifox_sdk import MetrifoxClient
client = MetrifoxClient(api_key="your_api_key")
result = client.customers.bulk_create([
{
"customer_type": "BUSINESS",
"customer_key": "acme_corp_001",
"primary_email": "contact@acmecorp.com",
"legal_name": "Acme Corporation",
"display_name": "Acme Corp"
},
{
"customer_type": "INDIVIDUAL",
"customer_key": "jane_doe_001",
"primary_email": "jane@example.com",
"first_name": "Jane",
"last_name": "Doe"
}
])
import { init } from "metrifox-js";
const metrifoxClient = init({
apiKey: process.env.METRIFOX_API_KEY
});
const result = await metrifoxClient.customers.bulkCreate({
customers: [
{
customer_type: "BUSINESS",
customer_key: "acme_corp_001",
primary_email: "contact@acmecorp.com",
legal_name: "Acme Corporation",
display_name: "Acme Corp"
},
{
customer_type: "INDIVIDUAL",
customer_key: "jane_doe_001",
primary_email: "jane@example.com",
first_name: "Jane",
last_name: "Doe"
}
]
});
require 'metrifox-sdk'
METRIFOX_SDK = MetrifoxSDK.init({ api_key: "your-api-key" })
result = METRIFOX_SDK.customers.bulk_create({
customers: [
{
customer_type: "BUSINESS",
customer_key: "acme_corp_001",
primary_email: "contact@acmecorp.com",
legal_name: "Acme Corporation",
display_name: "Acme Corp"
},
{
customer_type: "INDIVIDUAL",
customer_key: "jane_doe_001",
primary_email: "jane@example.com",
first_name: "Jane",
last_name: "Doe"
}
]
})
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/api/v1/customers/bulk-create",
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([
'customers' => [
[
'customer_type' => 'BUSINESS',
'customer_key' => 'acme_corp_001',
'primary_email' => 'contact@acmecorp.com',
'legal_name' => 'Acme Corporation',
'display_name' => 'Acme Corp',
'currency' => 'USD',
'timezone' => 'America/New_York',
'address_line1' => '123 Business Ave',
'city' => 'New York',
'state' => 'NY',
'country' => 'United States',
'zip_code' => '10001'
],
[
'customer_type' => 'INDIVIDUAL',
'customer_key' => 'jane_doe_001',
'primary_email' => 'jane@example.com',
'first_name' => 'Jane',
'last_name' => 'Doe',
'currency' => 'USD',
'timezone' => 'America/Los_Angeles'
],
[
'customer_type' => 'BUSINESS',
'customer_key' => 'globex_001',
'primary_email' => 'info@globex.com',
'legal_name' => 'Globex Corporation',
'display_name' => 'Globex',
'currency' => 'EUR'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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}/api/v1/customers/bulk-create"
payload := strings.NewReader("{\n \"customers\": [\n {\n \"customer_type\": \"BUSINESS\",\n \"customer_key\": \"acme_corp_001\",\n \"primary_email\": \"contact@acmecorp.com\",\n \"legal_name\": \"Acme Corporation\",\n \"display_name\": \"Acme Corp\",\n \"currency\": \"USD\",\n \"timezone\": \"America/New_York\",\n \"address_line1\": \"123 Business Ave\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"country\": \"United States\",\n \"zip_code\": \"10001\"\n },\n {\n \"customer_type\": \"INDIVIDUAL\",\n \"customer_key\": \"jane_doe_001\",\n \"primary_email\": \"jane@example.com\",\n \"first_name\": \"Jane\",\n \"last_name\": \"Doe\",\n \"currency\": \"USD\",\n \"timezone\": \"America/Los_Angeles\"\n },\n {\n \"customer_type\": \"BUSINESS\",\n \"customer_key\": \"globex_001\",\n \"primary_email\": \"info@globex.com\",\n \"legal_name\": \"Globex Corporation\",\n \"display_name\": \"Globex\",\n \"currency\": \"EUR\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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}/api/v1/customers/bulk-create")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customers\": [\n {\n \"customer_type\": \"BUSINESS\",\n \"customer_key\": \"acme_corp_001\",\n \"primary_email\": \"contact@acmecorp.com\",\n \"legal_name\": \"Acme Corporation\",\n \"display_name\": \"Acme Corp\",\n \"currency\": \"USD\",\n \"timezone\": \"America/New_York\",\n \"address_line1\": \"123 Business Ave\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"country\": \"United States\",\n \"zip_code\": \"10001\"\n },\n {\n \"customer_type\": \"INDIVIDUAL\",\n \"customer_key\": \"jane_doe_001\",\n \"primary_email\": \"jane@example.com\",\n \"first_name\": \"Jane\",\n \"last_name\": \"Doe\",\n \"currency\": \"USD\",\n \"timezone\": \"America/Los_Angeles\"\n },\n {\n \"customer_type\": \"BUSINESS\",\n \"customer_key\": \"globex_001\",\n \"primary_email\": \"info@globex.com\",\n \"legal_name\": \"Globex Corporation\",\n \"display_name\": \"Globex\",\n \"currency\": \"EUR\"\n }\n ]\n}")
.asString();{
"statusCode": 200,
"message": "Bulk Customer Creation Completed",
"meta": {},
"data": {
"total": 3,
"successful_count": 3,
"failed_count": 0,
"customers_created": [
{
"index": 0,
"customer_key": "acme_corp_001",
"data": {
"id": "764c80e3-ed59-44a5-ba07-7ee5ba547774",
"customer_type": "BUSINESS",
"primary_email": "contact@acmecorp.com",
"display_name": "Acme Corp"
}
},
{
"index": 1,
"customer_key": "jane_doe_001",
"data": {
"id": "864c80e3-ed59-44a5-ba07-7ee5ba547775",
"customer_type": "INDIVIDUAL",
"primary_email": "jane@example.com",
"display_name": "Jane Doe"
}
},
{
"index": 2,
"customer_key": "globex_001",
"data": {
"id": "964c80e3-ed59-44a5-ba07-7ee5ba547776",
"customer_type": "BUSINESS",
"primary_email": "info@globex.com",
"display_name": "Globex"
}
}
],
"customers_failed": []
},
"errors": {}
}Each customer is processed independently. If some customers fail (e.g., duplicate email or customer key), the others will still be created. Check both
customers_created and customers_failed arrays in the response to handle partial failures.A maximum of 100 customers can be created per request. Each customer accepts the same fields as the single create endpoint.
Authorizations
Body
application/json
Array of customer objects to create (max 100)
Maximum array length:
100Show child attributes
Show child attributes
⌘I

