Customers

Customers represent the people and businesses that owe you money. They are linked to invoices, credit memos, and payment records.

Create a Customer

bash
curl -X POST "https://api.ondayzero.com/api/v1/customers" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Corp",
    "email": "billing@acme.com",
    "phone": "+1-555-0100",
    "address": "123 Main St, San Francisco, CA 94105",
    "credit_limit_cents": 5000000
  }'

credit_limit_cents is in cents. 5000000 = $50,000.00 credit limit.

List Customers

bash
curl "https://api.ondayzero.com/api/v1/customers?search=acme&limit=25" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID"

Filter Parameters

Parameter Type Description
search string Fuzzy search by name (1-200 chars)
email string Filter by exact email
id UUID Get specific customer by ID

Get a Customer

bash
curl "https://api.ondayzero.com/api/v1/customers/{customer_id}" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID"

Update a Customer

bash
curl -X PUT "https://api.ondayzero.com/api/v1/customers/{customer_id}" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Corporation",
    "website": "https://acme.com"
  }'

Contacts

Each customer can have multiple contacts (billing, technical, etc.):

bash
curl -X POST "https://api.ondayzero.com/api/v1/customers/{customer_id}/contacts" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jane Smith",
    "email": "jane@acme.com",
    "role": "Accounts Payable",
    "is_primary": true
  }'

List contacts: GET /api/v1/customers/{customer_id}/contacts

Bulk Upload

Import customers from a CSV file:

bash
curl -X POST "https://api.ondayzero.com/api/v1/customers/bulk-upload" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID" \
  -F "file=@customers.csv"

CSV columns: name, email, phone, address, tax_id, website, notes, category, status, credit_limit (in dollars, not cents).

Duplicate emails are automatically skipped. The response includes counts and any row-level errors.

Duplicate Detection

Before creating a customer, check for potential duplicates:

bash
curl -X POST "https://api.ondayzero.com/api/v1/customers/check-duplicates?name=Acme%20Corp&email=billing@acme.com" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID"

Returns a list of similar existing customers with similarity scores and match types.

Delete a Customer

bash
curl -X DELETE "https://api.ondayzero.com/api/v1/customers/{customer_id}" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID"