Skip to main content

Get All Customers

Retrieve a list of all customers with optional filtering and pagination.
curl -X GET "https://cemac-api.vercel.app/customers?page=1&limit=100&search=&sortBy=firstName&sortOrder=asc" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json"
Authentication: Required (Bearer Token) Method: GET Endpoint: /customers

Query Parameters

page
number
default:"1"
Page number for pagination
limit
number
default:"100"
Number of customers per page
Search term to filter customers by name or email
sortBy
string
default:"firstName"
Field to sort by (e.g., firstName, lastName, email)
sortOrder
string
default:"asc"
Sort order: “asc” or “desc”

Response

success
boolean
Indicates if the request was successful
customers
array
Array of customer objects
total
number
Total number of customers
page
number
Current page number
limit
number
Number of items per page

Search Customers

Search for customers in real-time (autocomplete functionality).
curl -X GET "https://cemac-api.vercel.app/customers/search?q=john" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json"
Authentication: Required (Bearer Token) Method: GET Endpoint: /customers/search

Query Parameters

q
string
required
Search query string

Response

success
boolean
Indicates if the request was successful
customers
array
Array of matching customer objects

Get Customer by ID

Retrieve a specific customer with their purchase history.
curl -X GET https://cemac-api.vercel.app/customers/CUSTOMER_ID \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json"
Authentication: Required (Bearer Token) Method: GET Endpoint: /customers/{customerId}

Path Parameters

customerId
string
required
Unique identifier of the customer

Response

success
boolean
Indicates if the request was successful
customer
object
Customer object with purchase history

Create Customer

Create a new customer.
curl -X POST https://cemac-api.vercel.app/customers \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@example.com",
    "phone": "+1-555-0123",
    "address": "123 Main St, City, State 12345"
  }'
Authentication: Required (Bearer Token) Method: POST Endpoint: /customers

Request Body

firstName
string
required
Customer’s first name
lastName
string
required
Customer’s last name
email
string
required
Customer’s email address
phone
string
Customer’s phone number
address
string
Customer’s physical address

Response

success
boolean
Indicates if the customer was created successfully
customer
object
Created customer object
message
string
Success message

Update Customer

Update an existing customer’s information.
curl -X PUT https://cemac-api.vercel.app/customers/CUSTOMER_ID \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "John",
    "lastName": "Smith",
    "email": "john.smith@example.com",
    "phone": "+1-555-0456",
    "address": "456 Oak Ave, City, State 12345"
  }'
Authentication: Required (Bearer Token) Method: PUT Endpoint: /customers/{customerId}

Path Parameters

customerId
string
required
Unique identifier of the customer

Request Body

firstName
string
Updated first name
lastName
string
Updated last name
email
string
Updated email address
phone
string
Updated phone number
address
string
Updated address

Response

success
boolean
Indicates if the customer was updated successfully
customer
object
Updated customer object

Delete Customer

Delete a customer from the system.
curl -X DELETE https://cemac-api.vercel.app/customers/CUSTOMER_ID \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json"
Authentication: Required (Bearer Token) Method: DELETE Endpoint: /customers/{customerId}

Path Parameters

customerId
string
required
Unique identifier of the customer to delete

Response

success
boolean
Indicates if the customer was deleted successfully
message
string
Success message

Build docs developers (and LLMs) love