Skip to main content
POST
/
api
/
v1
/
customers
JavaScript SDK
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);
{
  "message": "Customer Created",
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "primary_email": "[email protected]",
    "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": "[email protected]",
    "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": "[email protected]",
        "is_primary": true
      }
    ],
    "billing_configuration": {},
    "tax_identifications": [],
    "contact_people": [],
    "payment_terms": [],
    "metadata": {},
    "date_of_birth": null,
    "documents": {}
  },
  "status": "created"
}
Important: Customer keys are immutable once created and cannot be changed through updates. Choose your customer key carefully during creation and ideally, should align with the unique id of the customer on your platform.

Authorizations

x-api-key
string
header
required

Body

application/json
customer_type
enum<string>
required

Type of customer

Available options:
BUSINESS,
INDIVIDUAL
customer_key
string
required

Unique identifier of the customer in your application

primary_email
string<email>
required

Primary email address for the customer

primary_phone
string

Primary phone number for the customer

Legal business name

display_name
string

Display name for the business

Legal registration number

tax_identification_number
string

Tax identification number

logo_url
string<uri>

URL to company logo

website_url
string<uri>

Company website URL

account_manager
string

Assigned account manager

first_name
string

First name

middle_name
string

Middle name

last_name
string

Last name

date_of_birth
string<date>

Date of birth (for individuals)

billing_email
string<email>

Email address for billing communications

timezone
string

Preferred timezone

language
string

Preferred language for communications

currency
string

Preferred currency for billing

tax_status
enum<string>

Tax status of the customer

Available options:
TAXABLE,
TAX_EXEMPT,
REVERSE_CHARGE
address_line1
string

First line of address

address_line2
string

Second line of address

city
string

City name

state
string

State or province

country
string

Country name

zip_code
string

ZIP or postal code

shipping_address_line1
string

First line of shipping address

shipping_address_line2
string

Second line of shipping address

shipping_city
string

Shipping city name

shipping_state
string

Shipping state or province

shipping_country
string

Shipping country name

shipping_zip_code
string

Shipping ZIP or postal code

billing_configuration
object
tax_identifications
object[]

Array of tax identification numbers

contact_people
object[]

List of contact persons for the business

payment_terms
object[]

Payment terms configuration

metadata
object

Custom metadata

email_addresses
object[]

List of additional email addresses

phone_numbers
object[]

List of additional phone numbers

documents
object

Optional documents to attach to the customer

Response

Customer created successfully

message
string
Example:

"Customer Created"

data
object
status
string
Example:

"created"