Add Customer

This endpoint allows you to add a new customer to the system. You can store customer details like name, email, phone, address, and other relevant information.

Endpoint

POST https://app.xtrakit.com/api/v1/customers/add

Headers

Authorization: Bearer API_KEY

Body Parameters

Parameters
Type
Description

customer_group_id

int

Optional

The ID of the group to which this customer belongs.

customer_name

string

Required

The full name of the customer, used for identification and personalization within the system.

customer_email

string

Optional

The email address of the customer, used for communications like receipts, notifications, or offers.

customer_phone

string

Required

The primary phone number for contacting the customer. It is useful for both communication and verification purposes.

customer_whatsapp

string

Optional

The customer's WhatsApp number. This is used for instant messaging or sending transactional notifications.

customer_country

string

Required

The country in which the customer resides. This is necessary for shipping, billing, or other region-specific activities.

customer_city

string

Required

The city where the customer is located. It helps in localizing deliveries, services, and communication.

customer_state

string

Required

The state or region where the customer is based. This is useful for regional identification within a country.

customer_zip

string

Optional

The postal code for the customer's location. It is generally used for mailing, shipping, and regional classification.

(eg: 00233)

address1

string

Required

The primary address of the customer, typically used for billing or shipping purposes. It can contain house numbers, street names, etc.

address2

string

Optional

The secondary address, such as apartment numbers or additional details not covered in address1. This is helpful when the customer's address is complex.

customer_profile

string

Optional

A URL or path to the customer's profile image, typically used for identification or personalization within the user interface.

created_by

string

Required

The identifier or username of the person who created this customer entry in the system. This helps in tracking changes and updates.

Sample Requests

<?php

$data = [
  'customer_group_id' => 1, 
  'customer_name' => "John Doe", 
  'customer_email' => "[email protected]", 
  'customer_phone' => "+233244567877", 
  'customer_whatsapp' => "+233244567877", 
  'customer_country' => "Ghana", 
  'customer_city' => "Kumasi", 
  'customer_state' => "Kumasi", 
  'customer_zip' => "00233", 
  'address1' => "Adum Main Street", 
  'address2' => "Apt 4B, Melcom Street", 
  'customer_profile' => "https://example.com/profiles/customer125.jpg",
  "created_by" => "Edward"
];

$url = 'https://app.xtrakit.com/api/v1/customers/add';

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => $url,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => $data,
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer API_KEY',  // Replace 'API_KEY' with your actual API key
    'Content-Type: application/json'  
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

?>

Sample Response

{
    "status": 200,
    "message": "Customer added successfully",
    "data": {
        "customer": {
            "id": 2,
            "user_id": "f93c5a51-ffa4-4aef-a45b-4cdec1c8cc10",
            "business_code": "15848484",
            "customer_group_id": 1,
            "customer_name": "John Doe",
            "customer_email": "[email protected]",
            "customer_phone": "+233244567877",
            "customer_whatsapp": "+233244567877",
            "customer_country": "Ghana",
            "customer_city": "Kumasi",
            "customer_state": "Kumasi",
            "customer_zip": "00233",
            "address1": "Adum Main Street",
            "address2": "Apt 4B, Melcom Street",
            "customer_profile": "https://example.com/profiles/customer125.jpg",
            "created_by": "Edward",
            "created_at": "2024-08-04 08:23:45",
            "updated_at": "2024-08-04 02:00:43"        
        }
    }
}

Last updated