Customers & Contacts

Manage customer records and contact information through the API.

Overview

The Customers API lets you create, retrieve, and manage customer records. Use it to build CRM integrations, loyalty programs, or marketing automation.

List Customers

curl -X GET https://api.whatalo.com/v1/customers \
  -H "X-API-Key: wk_live_your_key_here"

Required scope: read:customers

Get a Single Customer

curl -X GET https://api.whatalo.com/v1/customers/cus_abc123 \
  -H "X-API-Key: wk_live_your_key_here"

Create a Customer

curl -X POST https://api.whatalo.com/v1/customers \
  -H "X-API-Key: wk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "María García",
    "email": "[email protected]",
    "phone": "+18095551234"
  }'

Required scope: write:customers

Only name is required. email, phone, and notes are optional.

Update a Customer

curl -X PATCH https://api.whatalo.com/v1/customers/cus_abc123 \
  -H "X-API-Key: wk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+18095559876"
  }'

Required scope: write:customers

Get Customer Count

curl -X GET https://api.whatalo.com/v1/customers/count \
  -H "X-API-Key: wk_live_your_key_here"

Common Patterns

CRM Sync

Sync customer data with an external CRM:

async function syncToCRM(customerId) {
  const res = await fetch(
    `https://api.whatalo.com/v1/customers/${customerId}`,
    { headers: { 'X-API-Key': API_KEY } }
  );

  if (!res.ok) {
    throw new Error(`Failed to fetch customer: ${res.status}`);
  }

  const { data } = await res.json();

  await crm.upsertContact({
    email: data.email,
    name: data.name,
    phone: data.phone,
    source: 'whatalo'
  });
}

Import Customers in Bulk

async function importCustomers(csvRows) {
  const results = { success: 0, failed: 0 };

  for (const row of csvRows) {
    const res = await fetch('https://api.whatalo.com/v1/customers', {
      method: 'POST',
      headers: {
        'X-API-Key': API_KEY,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        name: row.name,
        email: row.email,
        phone: row.phone
      })
    });

    if (res.ok) {
      results.success++;
    } else {
      results.failed++;
      console.error(`Failed to import ${row.email}:`, await res.json());
    }
  }

  return results;
}

For bulk imports, be mindful of the rate limit (1,000 requests/minute). Add a delay between requests for large datasets.

On this page