Skip to main content
POST
/
v1
/
customers
Create Customer
curl --request POST \
  --url https://api.example.com/v1/customers \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "firstName": "<string>",
  "lastName": "<string>",
  "email": "<string>",
  "phone": "<string>",
  "dateOfBirth": "<string>",
  "address": {
    "line1": "<string>",
    "line2": "<string>",
    "city": "<string>",
    "state": "<string>",
    "postalCode": "<string>",
    "country": "<string>"
  },
  "tags": [
    {}
  ],
  "notes": "<string>",
  "preferredLocationId": "<string>",
  "marketingConsent": true,
  "companyId": "<string>"
}
'

Create Customer

Create a new customer in your organization.

Endpoint

POST /v1/customers

Authentication

Authorization
string
required
Bearer token with customers:write scope

Request Body

firstName
string
required
Customer’s first name
lastName
string
required
Customer’s last name
email
string
required
Customer’s email address (must be unique)
phone
string
Customer’s phone number
dateOfBirth
string
Date of birth (YYYY-MM-DD format)
address
object
Customer’s address
tags
array
Array of tags to apply
notes
string
Internal notes about customer
preferredLocationId
string
Preferred location ID
Marketing email consent
companyId
string
Associated company ID for B2B

Request Example

curl -X POST "https://api.tiquo.co/v1/customers" \
  -H "Authorization: Bearer sk_live_xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
    "phone": "+1234567890",
    "dateOfBirth": "1990-05-15",
    "address": {
      "line1": "123 Main Street",
      "city": "New York",
      "state": "NY",
      "postalCode": "10001",
      "country": "US"
    },
    "tags": ["new", "referral"],
    "marketingConsent": true
  }'

Response

Returns the created customer object.

Response Example

{
  "success": true,
  "data": {
    "id": "cust_abc123",
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
    "phone": "+1234567890",
    "dateOfBirth": "1990-05-15",
    "address": {
      "line1": "123 Main Street",
      "city": "New York",
      "state": "NY",
      "postalCode": "10001",
      "country": "US"
    },
    "loyaltyPoints": 0,
    "totalSpent": 0,
    "visitCount": 0,
    "tags": ["new", "referral"],
    "marketingConsent": true,
    "createdAt": "2024-01-20T14:30:00Z",
    "updatedAt": "2024-01-20T14:30:00Z"
  }
}

Validation Rules

FieldRule
firstNameRequired, 1-100 characters
lastNameRequired, 1-100 characters
emailRequired, valid email, unique
phoneE.164 format recommended
dateOfBirthYYYY-MM-DD format

Errors

CodeDescription
400Validation error
401Invalid API key
403Missing customers:write scope
409Email already exists

400 Validation Error

{
  "success": false,
  "error": {
    "code": "validation_error",
    "message": "Email is required",
    "field": "email"
  }
}

409 Conflict

{
  "success": false,
  "error": {
    "code": "conflict",
    "message": "A customer with this email already exists",
    "existingId": "cust_xyz789"
  }
}

Code Examples

const response = await fetch('https://api.tiquo.co/v1/customers', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    firstName: 'John',
    lastName: 'Doe',
    email: '[email protected]',
    phone: '+1234567890',
    marketingConsent: true
  })
});

const { data: customer } = await response.json();
console.log('Created customer:', customer.id);