from metrifox_sdk import MetrifoxClient
client = MetrifoxClient(api_key="your_api_key")
# Simple usage
customer_data = {
"customer_key": "your_customer_unique_id",
"primary_email": "customer_email@example.com",
"customer_type": "BUSINESS",
"legal_name": "Your Company LLC",
"display_name": "Your Company",
"billing_email": "billing@yourcompany.com"
# ...other_fields
}
# Create a customer
response = client.customers.create(customer_data)
import { init } from "metrifox-js";
const metrifoxClient = init({
apiKey: process.env.METRIFOX_API_KEY
});
// Create a customer
const customerData = {
// customer data - refer to request schema for all available fields
};
const response = await metrifoxClient.customers.create(customerData);
require 'metrifox-sdk'
# Initialize with configuration
METRIFOX_SDK = MetrifoxSDK.init({ api_key: "your-api-key" })
# Create a customer
customer_data = {
# customer data - refer to request schema for all available fields
}
response = METRIFOX_SDK.customers.create(customer_data)
curl --request POST \
--url https://{defaultHost}/api/v1/customers \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"customer_type": "BUSINESS",
"customer_key": "acme-corp-001",
"primary_email": "contact@acme.com",
"primary_phone": "+1234567890",
"legal_name": "Acme Corporation",
"display_name": "Acme Corp",
"billing_email": "billing@acme.com",
"timezone": "America/New_York",
"language": "en",
"currency": "USD",
"tax_status": "TAXABLE",
"address_line1": "123 Business St",
"city": "New York",
"state": "NY",
"country": "United States",
"zip_code": "10001",
"contact_people": [
{
"first_name": "John",
"last_name": "Doe",
"email_address": "john.doe@acme.com",
"designation": "CEO",
"is_primary": true
}
],
"email_addresses": [
{
"email": "contact@acme.com",
"is_primary": true
},
{
"email": "billing@acme.com",
"is_primary": false
}
],
"phone_numbers": [
{
"phone_number": "+1234567890",
"country_code": "+1",
"is_primary": true
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/api/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_type' => 'BUSINESS',
'customer_key' => 'acme-corp-001',
'primary_email' => 'contact@acme.com',
'primary_phone' => '+1234567890',
'legal_name' => 'Acme Corporation',
'display_name' => 'Acme Corp',
'billing_email' => 'billing@acme.com',
'timezone' => 'America/New_York',
'language' => 'en',
'currency' => 'USD',
'tax_status' => 'TAXABLE',
'address_line1' => '123 Business St',
'city' => 'New York',
'state' => 'NY',
'country' => 'United States',
'zip_code' => '10001',
'contact_people' => [
[
'first_name' => 'John',
'last_name' => 'Doe',
'email_address' => 'john.doe@acme.com',
'designation' => 'CEO',
'is_primary' => true
]
],
'email_addresses' => [
[
'email' => 'contact@acme.com',
'is_primary' => true
],
[
'email' => 'billing@acme.com',
'is_primary' => false
]
],
'phone_numbers' => [
[
'phone_number' => '+1234567890',
'country_code' => '+1',
'is_primary' => true
]
]
]),
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"
payload := strings.NewReader("{\n \"customer_type\": \"BUSINESS\",\n \"customer_key\": \"acme-corp-001\",\n \"primary_email\": \"contact@acme.com\",\n \"primary_phone\": \"+1234567890\",\n \"legal_name\": \"Acme Corporation\",\n \"display_name\": \"Acme Corp\",\n \"billing_email\": \"billing@acme.com\",\n \"timezone\": \"America/New_York\",\n \"language\": \"en\",\n \"currency\": \"USD\",\n \"tax_status\": \"TAXABLE\",\n \"address_line1\": \"123 Business St\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"country\": \"United States\",\n \"zip_code\": \"10001\",\n \"contact_people\": [\n {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email_address\": \"john.doe@acme.com\",\n \"designation\": \"CEO\",\n \"is_primary\": true\n }\n ],\n \"email_addresses\": [\n {\n \"email\": \"contact@acme.com\",\n \"is_primary\": true\n },\n {\n \"email\": \"billing@acme.com\",\n \"is_primary\": false\n }\n ],\n \"phone_numbers\": [\n {\n \"phone_number\": \"+1234567890\",\n \"country_code\": \"+1\",\n \"is_primary\": true\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")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customer_type\": \"BUSINESS\",\n \"customer_key\": \"acme-corp-001\",\n \"primary_email\": \"contact@acme.com\",\n \"primary_phone\": \"+1234567890\",\n \"legal_name\": \"Acme Corporation\",\n \"display_name\": \"Acme Corp\",\n \"billing_email\": \"billing@acme.com\",\n \"timezone\": \"America/New_York\",\n \"language\": \"en\",\n \"currency\": \"USD\",\n \"tax_status\": \"TAXABLE\",\n \"address_line1\": \"123 Business St\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"country\": \"United States\",\n \"zip_code\": \"10001\",\n \"contact_people\": [\n {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email_address\": \"john.doe@acme.com\",\n \"designation\": \"CEO\",\n \"is_primary\": true\n }\n ],\n \"email_addresses\": [\n {\n \"email\": \"contact@acme.com\",\n \"is_primary\": true\n },\n {\n \"email\": \"billing@acme.com\",\n \"is_primary\": false\n }\n ],\n \"phone_numbers\": [\n {\n \"phone_number\": \"+1234567890\",\n \"country_code\": \"+1\",\n \"is_primary\": true\n }\n ]\n}")
.asString();{
"message": "Customer Created",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"primary_email": "contact@acme.com",
"primary_phone": "+1234567890",
"legal_name": "Acme Corporation",
"display_name": "Acme Corp",
"legal_number": null,
"tax_identification_number": null,
"logo_url": null,
"website_url": null,
"account_manager": null,
"first_name": null,
"middle_name": null,
"last_name": null,
"full_name": "Acme Corporation",
"billing_email": "billing@acme.com",
"timezone": "America/New_York",
"language": "en",
"currency": "USD",
"tax_status": "TAXABLE",
"address_line1": "123 Business St",
"address_line2": null,
"city": "New York",
"state": "NY",
"country": "United States",
"zip_code": "10001",
"shipping_address_line1": null,
"shipping_address_line2": null,
"shipping_city": null,
"shipping_state": null,
"shipping_country": null,
"shipping_zip_code": null,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z",
"customer_type": "BUSINESS",
"customer_key": "acme-corp-001",
"phone_numbers": [],
"email_addresses": [
{
"email": "contact@acme.com",
"is_primary": true
}
],
"billing_configuration": {},
"tax_identifications": [],
"contact_people": [],
"payment_terms": [],
"metadata": {},
"date_of_birth": null,
"documents": {}
},
"status": "created"
}{
"message": "Validation failed",
"errors": {
"customer_type": [
"must be either BUSINESS or INDIVIDUAL"
],
"customer_key": [
"is required"
],
"primary_email": [
"is required"
]
}
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>",
"errors": {}
}Create Customer
Create a new customer for your company
from metrifox_sdk import MetrifoxClient
client = MetrifoxClient(api_key="your_api_key")
# Simple usage
customer_data = {
"customer_key": "your_customer_unique_id",
"primary_email": "customer_email@example.com",
"customer_type": "BUSINESS",
"legal_name": "Your Company LLC",
"display_name": "Your Company",
"billing_email": "billing@yourcompany.com"
# ...other_fields
}
# Create a customer
response = client.customers.create(customer_data)
import { init } from "metrifox-js";
const metrifoxClient = init({
apiKey: process.env.METRIFOX_API_KEY
});
// Create a customer
const customerData = {
// customer data - refer to request schema for all available fields
};
const response = await metrifoxClient.customers.create(customerData);
require 'metrifox-sdk'
# Initialize with configuration
METRIFOX_SDK = MetrifoxSDK.init({ api_key: "your-api-key" })
# Create a customer
customer_data = {
# customer data - refer to request schema for all available fields
}
response = METRIFOX_SDK.customers.create(customer_data)
curl --request POST \
--url https://{defaultHost}/api/v1/customers \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"customer_type": "BUSINESS",
"customer_key": "acme-corp-001",
"primary_email": "contact@acme.com",
"primary_phone": "+1234567890",
"legal_name": "Acme Corporation",
"display_name": "Acme Corp",
"billing_email": "billing@acme.com",
"timezone": "America/New_York",
"language": "en",
"currency": "USD",
"tax_status": "TAXABLE",
"address_line1": "123 Business St",
"city": "New York",
"state": "NY",
"country": "United States",
"zip_code": "10001",
"contact_people": [
{
"first_name": "John",
"last_name": "Doe",
"email_address": "john.doe@acme.com",
"designation": "CEO",
"is_primary": true
}
],
"email_addresses": [
{
"email": "contact@acme.com",
"is_primary": true
},
{
"email": "billing@acme.com",
"is_primary": false
}
],
"phone_numbers": [
{
"phone_number": "+1234567890",
"country_code": "+1",
"is_primary": true
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/api/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_type' => 'BUSINESS',
'customer_key' => 'acme-corp-001',
'primary_email' => 'contact@acme.com',
'primary_phone' => '+1234567890',
'legal_name' => 'Acme Corporation',
'display_name' => 'Acme Corp',
'billing_email' => 'billing@acme.com',
'timezone' => 'America/New_York',
'language' => 'en',
'currency' => 'USD',
'tax_status' => 'TAXABLE',
'address_line1' => '123 Business St',
'city' => 'New York',
'state' => 'NY',
'country' => 'United States',
'zip_code' => '10001',
'contact_people' => [
[
'first_name' => 'John',
'last_name' => 'Doe',
'email_address' => 'john.doe@acme.com',
'designation' => 'CEO',
'is_primary' => true
]
],
'email_addresses' => [
[
'email' => 'contact@acme.com',
'is_primary' => true
],
[
'email' => 'billing@acme.com',
'is_primary' => false
]
],
'phone_numbers' => [
[
'phone_number' => '+1234567890',
'country_code' => '+1',
'is_primary' => true
]
]
]),
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"
payload := strings.NewReader("{\n \"customer_type\": \"BUSINESS\",\n \"customer_key\": \"acme-corp-001\",\n \"primary_email\": \"contact@acme.com\",\n \"primary_phone\": \"+1234567890\",\n \"legal_name\": \"Acme Corporation\",\n \"display_name\": \"Acme Corp\",\n \"billing_email\": \"billing@acme.com\",\n \"timezone\": \"America/New_York\",\n \"language\": \"en\",\n \"currency\": \"USD\",\n \"tax_status\": \"TAXABLE\",\n \"address_line1\": \"123 Business St\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"country\": \"United States\",\n \"zip_code\": \"10001\",\n \"contact_people\": [\n {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email_address\": \"john.doe@acme.com\",\n \"designation\": \"CEO\",\n \"is_primary\": true\n }\n ],\n \"email_addresses\": [\n {\n \"email\": \"contact@acme.com\",\n \"is_primary\": true\n },\n {\n \"email\": \"billing@acme.com\",\n \"is_primary\": false\n }\n ],\n \"phone_numbers\": [\n {\n \"phone_number\": \"+1234567890\",\n \"country_code\": \"+1\",\n \"is_primary\": true\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")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customer_type\": \"BUSINESS\",\n \"customer_key\": \"acme-corp-001\",\n \"primary_email\": \"contact@acme.com\",\n \"primary_phone\": \"+1234567890\",\n \"legal_name\": \"Acme Corporation\",\n \"display_name\": \"Acme Corp\",\n \"billing_email\": \"billing@acme.com\",\n \"timezone\": \"America/New_York\",\n \"language\": \"en\",\n \"currency\": \"USD\",\n \"tax_status\": \"TAXABLE\",\n \"address_line1\": \"123 Business St\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"country\": \"United States\",\n \"zip_code\": \"10001\",\n \"contact_people\": [\n {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email_address\": \"john.doe@acme.com\",\n \"designation\": \"CEO\",\n \"is_primary\": true\n }\n ],\n \"email_addresses\": [\n {\n \"email\": \"contact@acme.com\",\n \"is_primary\": true\n },\n {\n \"email\": \"billing@acme.com\",\n \"is_primary\": false\n }\n ],\n \"phone_numbers\": [\n {\n \"phone_number\": \"+1234567890\",\n \"country_code\": \"+1\",\n \"is_primary\": true\n }\n ]\n}")
.asString();{
"message": "Customer Created",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"primary_email": "contact@acme.com",
"primary_phone": "+1234567890",
"legal_name": "Acme Corporation",
"display_name": "Acme Corp",
"legal_number": null,
"tax_identification_number": null,
"logo_url": null,
"website_url": null,
"account_manager": null,
"first_name": null,
"middle_name": null,
"last_name": null,
"full_name": "Acme Corporation",
"billing_email": "billing@acme.com",
"timezone": "America/New_York",
"language": "en",
"currency": "USD",
"tax_status": "TAXABLE",
"address_line1": "123 Business St",
"address_line2": null,
"city": "New York",
"state": "NY",
"country": "United States",
"zip_code": "10001",
"shipping_address_line1": null,
"shipping_address_line2": null,
"shipping_city": null,
"shipping_state": null,
"shipping_country": null,
"shipping_zip_code": null,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z",
"customer_type": "BUSINESS",
"customer_key": "acme-corp-001",
"phone_numbers": [],
"email_addresses": [
{
"email": "contact@acme.com",
"is_primary": true
}
],
"billing_configuration": {},
"tax_identifications": [],
"contact_people": [],
"payment_terms": [],
"metadata": {},
"date_of_birth": null,
"documents": {}
},
"status": "created"
}{
"message": "Validation failed",
"errors": {
"customer_type": [
"must be either BUSINESS or INDIVIDUAL"
],
"customer_key": [
"is required"
],
"primary_email": [
"is required"
]
}
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>",
"errors": {}
}Authorizations
Body
Type of customer
BUSINESS, INDIVIDUAL Unique identifier of the customer in your application
Primary email address for the customer
Primary phone number for the customer
Legal business name
Display name for the business
Legal registration number
Tax identification number
URL to company logo
Company website URL
Assigned account manager
First name
Middle name
Last name
Date of birth (for individuals)
Email address for billing communications
Preferred timezone
Preferred language for communications
Preferred currency for billing
Tax status of the customer
TAXABLE, TAX_EXEMPT, REVERSE_CHARGE First line of address
Second line of address
City name
State or province
Country name
ZIP or postal code
First line of shipping address
Second line of shipping address
Shipping city name
Shipping state or province
Shipping country name
Shipping ZIP or postal code
Show child attributes
Show child attributes
Array of tax identification numbers
Show child attributes
Show child attributes
List of contact persons for the business
Show child attributes
Show child attributes
Payment terms configuration
Show child attributes
Show child attributes
Custom metadata
List of additional email addresses
Show child attributes
Show child attributes
List of additional phone numbers
Show child attributes
Show child attributes
Optional documents to attach to the customer

