Customers & promotions

Customer

9 endpoints · https://pos.pages.fm/api/v1

View Markdown

Customer list

GET/shops/{SHOP_ID}/customers

Get list of customers

Path parameters

SHOP_IDintegerrequired

Shop ID

Example: 4

Query parameters

page_sizeinteger

Page size

Default: 30 · Example: 30
page_numberinteger

Page number

Default: 1 · Example: 1
searchstring

Search keyword

Example: "0999999999"
start_time_inserted_atinteger

Start time inserted

Example: 0
end_time_inserted_atinteger

End time inserted

Example: 0
start_time_updated_atinteger

Start time updated

Example: 0
end_time_updated_atinteger

End time updated

Example: 0
customer_idsstring

Customer IDs (comma-separated)

Example: "96a8e283-3fba-492e-a35a-970f72a30a02,4c74b7cf-f87b-484e-8549-6872d964f78f"
selectedLevel[]array<string>

Customer level IDs

Responses

object
dataarray<Customer>

List of customers

page_numberinteger

Page number

page_sizeinteger

Page size

successboolean

Success status

total_entriesinteger

Total entries

total_pagesinteger

Total pages

Request
curl "https://pos.pages.fm/api/v1/shops/{SHOP_ID}/customers?api_key=API_KEY"
Response 200
{
  "success": true,
  "data": [
    {
      "id": "b0110315-b102-436b-8b3b-ed8d16740327",
      "name": "Trần Văn Hoàng",
      "gender": "male",
      "emails": [
        "thudo@gmail.com"
      ],
      "phone_numbers": [
        "0999999999"
      ],
      "date_of_birth": "1999-09-01",
      "reward_point": 10,
      "is_discount_by_level": true,
      "tags": [],
      "is_block": false,
      "assigned_user_id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
      "level_id": null,
      "notes": [],
      "shop_customer_address": [
        {
          "id": "0fefd213-7d0c-4d5b-bdbf-35694da80857",
          "country_code": null,
          "province_id": "101",
          "district_id": "10101",
          "commune_id": null,
          "address": "lê văn lương",
          "full_address": "lê văn lương, Quận Ba Đình, Hà Nội",
          "full_name": "test",
          "phone_number": "0999999999"
        }
      ],
      "order_count": 108,
      "purchased_amount": 0,
      "succeed_order_count": 8,
      "last_order_at": "2020-04-01T10:18:41Z",
      "conversation_link": "https://pancake.vn/2284322048329488?customer_id=fc0dda4f-8d2a-4e70-a34a-7a6a434c6475",
      "referral_code": "1nw4geGA",
      "fb_id": null,
      "customer_id": "96a8e283-3fba-492e-a35a-970f72a30a02",
      "pages_customers": [
        {
          "id": 256469571170000,
          "name": "Clonners",
          "platform": "facebook"
        }
      ]
    }
  ]
}

Create customer

POST/shops/{SHOP_ID}/customers

Path parameters

SHOP_IDintegerrequired

Shop ID

Example: 4

Request body

Request body containing customer information to create

object
namestringrequired

Customer name

phoneNumberstringrequired

Phone number

createTypestring

Create type

dateOfBirthstring · date

Date of birth

last_order_atinteger

Last order timestamp

shop_customer_addressarray<object>

Customer addresses

Responses

object
dataCustomer

Customer information

successboolean

Success status

Request
curl -X POST "https://pos.pages.fm/api/v1/shops/{SHOP_ID}/customers?api_key=API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Hoang",
  "phoneNumber": "0909090909",
  "createType": "force",
  "dateOfBirth": "1995-02-01",
  "last_order_at": 1715878800,
  "shop_customer_address": [
    {
      "full_address": "190, phường dịch vọng, cầu giấy, hà nội",
      "full_name": "hoang",
      "phone_number": "0972868874"
    },
    {
      "full_address": "190, Mỹ đình 2, Nam từ liêm, hà nội",
      "full_name": "hoang",
      "phone_number": "0972868875"
    }
  ]
}'
Response 200
{
  "success": true,
  "data": {
    "id": "9e749e68-142f-4587-a3b1-70279c30b5c2",
    "name": "Nguyen Van Hoang",
    "gender": null,
    "emails": [],
    "phone_numbers": [
      "0903924956"
    ],
    "date_of_birth": "1995-02-01",
    "reward_point": 0,
    "is_discount_by_level": true,
    "tags": [],
    "is_block": false,
    "assigned_user_id": "e4cec6de-96fa-4c16-9523-07910ddfee8e",
    "level_id": null,
    "notes": [],
    "shop_customer_address": [
      {
        "id": "deeb419a-e7b6-42fd-9684-52ec6a72a41a",
        "country_code": 84,
        "province_id": null,
        "district_id": null,
        "commune_id": null,
        "address": null,
        "full_address": null,
        "full_name": null,
        "phone_number": "0903924956"
      }
    ],
    "order_count": 0,
    "purchased_amount": 0,
    "succeed_order_count": 0,
    "last_order_at": "2024-05-16T17:00:00Z",
    "conversation_link": null,
    "referral_code": "gqo7ulKf",
    "fb_id": null,
    "customer_id": "5b717afb-1856-48c9-9b6e-b8ac9db7d520"
  }
}

Customer detail

GET/shops/{SHOP_ID}/customers/{CUSTOMER_ID}

Get detail information of a customer

Path parameters

SHOP_IDintegerrequired

Shop ID

Example: 4
CUSTOMER_IDstringrequired

Customer ID

Example: "3f6e0e3c-7450-4af6-9a9f-50a6516e42e1"

Responses

object
dataCustomer

Customer information

successboolean

Success status

Request
curl "https://pos.pages.fm/api/v1/shops/{SHOP_ID}/customers/{CUSTOMER_ID}?api_key=API_KEY"
Response 200
{
  "success": true,
  "data": [
    {
      "id": "b0110315-b102-436b-8b3b-ed8d16740327",
      "name": "Trần Văn Hoàng",
      "gender": "male",
      "emails": [
        "thudo@gmail.com"
      ],
      "phone_numbers": [
        "0999999999"
      ],
      "date_of_birth": "1999-09-01",
      "reward_point": 10,
      "is_discount_by_level": true,
      "tags": [],
      "is_block": false,
      "assigned_user_id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
      "level_id": null,
      "notes": [],
      "shop_customer_address": [
        {
          "id": "0fefd213-7d0c-4d5b-bdbf-35694da80857",
          "country_code": null,
          "province_id": "101",
          "district_id": "10101",
          "commune_id": null,
          "address": "lê văn lương",
          "full_address": "lê văn lương, Quận Ba Đình, Hà Nội",
          "full_name": "test",
          "phone_number": "0999999999"
        }
      ],
      "order_count": 108,
      "purchased_amount": 0,
      "succeed_order_count": 8,
      "last_order_at": "2020-04-01T10:18:41Z",
      "conversation_link": "https://pancake.vn/2284322048329488?customer_id=fc0dda4f-8d2a-4e70-a34a-7a6a434c6475",
      "referral_code": "1nw4geGA",
      "fb_id": null,
      "customer_id": "96a8e283-3fba-492e-a35a-970f72a30a02",
      "pages_customers": [
        {
          "id": 256469571170000,
          "name": "Clonners",
          "platform": "facebook"
        }
      ]
    }
  ]
}

Update customer

PUT/shops/{SHOP_ID}/customers/{CUSTOMER_ID}

Path parameters

SHOP_IDintegerrequired

Shop ID

Example: 4
CUSTOMER_IDstringrequired

Customer ID

Example: "96a8e283-3fba-492e-a35a-970f72a30a02"

Request body

Request body containing customer information to update

object
customerCustomerrequired

Customer information

Responses

object
successboolean

Success status

Request
curl -X PUT "https://pos.pages.fm/api/v1/shops/{SHOP_ID}/customers/{CUSTOMER_ID}?api_key=API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "customer": {
    "name": "Nguyễn Thị Hằng",
    "gender": "female",
    "emails": [
      "pancake@gmail.com",
      "hoang@gmail.com"
    ],
    "phone_numbers": [
      "0983925966"
    ],
    "date_of_birth": "1995-03-04",
    "reward_point": 20,
    "is_discount_by_level": false,
    "tags": [
      "Hay hoàn"
    ],
    "is_block": false,
    "assigned_user_id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
    "level_id": "f8dced06-965d-4070-a765-dd8268373f1e",
    "notes": [
      {
        "id": "8a6f5380-4674-44e9-aaf2-40d898d460f5",
        "message": "Khách hàng thân thiết",
        "images": [
          {
            "url": "https://content.pancake.vn/user-content-dev2.pancake.vn/2023/9/6/655ae9172118ba9ffde16fa129a7001a392d1fff.png"
          }
        ]
      }
    ],
    "shop_customer_address": [
      {
        "id": "df631f21-3841-4d1c-8204-b85a7ecfce0c",
        "country_code": 84,
        "province_id": "101",
        "district_id": "10113",
        "commune_id": "1011309",
        "address": "190 Cầu Giấy",
        "full_name": "sơn",
        "phone_number": "0972868874"
      }
    ],
    "order_count": 7,
    "purchased_amount": 1000000
  }
}'
Response 200
{
  "success": true
}

Customer reward point history

GET/shops/{SHOP_ID}/customers/point_logs

Get reward point history for a customer

Path parameters

SHOP_IDintegerrequired

Shop ID

Example: 4

Query parameters

shop_customer_idstringrequired

Customer ID

Example: "96a8e283-3fba-492e-a35a-970f72a30a02"
page_sizeinteger

Page size

Default: 30 · Example: 30
page_numberinteger

Page number

Default: 1 · Example: 1

Responses

object
dataarray<object>

List of point logs

page_numberinteger

Page number

page_sizeinteger

Page size

successboolean

Success status

total_entriesinteger

Total entries

total_pagesinteger

Total pages

Request
curl "https://pos.pages.fm/api/v1/shops/{SHOP_ID}/customers/point_logs?api_key=API_KEY&shop_customer_id=96a8e283-3fba-492e-a35a-970f72a30a02"
Response 200
{
  "success": true,
  "data": [
    {
      "amount": 10,
      "creator": {
        "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
        "name": "Hoang Anh",
        "fb_id": "2042723249341651",
        "avatar_url": null
      },
      "current_point": 100,
      "inserted_at": "2024-01-01T00:00:00Z",
      "note": "Tích điểm từ đơn hàng"
    }
  ]
}

Create promotions by customer

POST/shops/{SHOP_ID}/promotion_advance/create_multi

Create promotions for specific customers

Path parameters

SHOP_IDintegerrequired

Shop ID

Example: 4

Request body

Request body containing promotion information to create for customers

object
promotion_advanceobjectrequired

Responses

object
successboolean

Success status

Request
curl -X POST "https://pos.pages.fm/api/v1/shops/{SHOP_ID}/promotion_advance/create_multi?api_key=API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "promotion_advance": {
    "promotion": {
      "start_time": "2024-09-30T04:58:30.020Z",
      "end_time": "2024-10-30T04:58:30.020Z",
      "warehouse_ids": [],
      "customer_tags": [],
      "type": "discount_by_coupon_id",
      "is_activated": true,
      "promo_code_info": {
        "discount": 5,
        "is_percent": true,
        "max_discount_by_percent": 100000,
        "disable": false,
        "order_price_min": 2000000,
        "order_price_max": 3000000,
        "no_applied_products_in_other_promotions": true,
        "discount_after_other_discount": true
      }
    },
    "shop_customer_ids": [
      "a8c1113d-55c2-4f7e-b33a-d4ecd76668fd"
    ]
  }
}'
Response 200
{
  "success": true
}

List of notes

GET/shops/{SHOP_ID}/customers/{CUSTOMER_ID}/load_customer_notes

Get list of customer notes

Path parameters

SHOP_IDintegerrequired

Shop ID

Example: 4
CUSTOMER_IDstringrequired

Customer ID

Example: "96a8e283-3fba-492e-a35a-970f72a30a02"

Responses

object
customer_notesarray<object>

List of customer notes

Request
curl "https://pos.pages.fm/api/v1/shops/{SHOP_ID}/customers/{CUSTOMER_ID}/load_customer_notes?api_key=API_KEY"
Response 200
{
  "customer_notes": [
    {
      "notes": [
        {
          "id": "8a6f5380-4674-44e9-aaf2-40d898d460f5",
          "message": "Khách hàng thân thiết",
          "images": [
            {
              "url": "https://content.pancake.vn/user-content-dev2.pancake.vn/2023/9/6/655ae9172118ba9ffde16fa129a7001a392d1fff.png"
            }
          ],
          "created_at": 1693987200,
          "updated_at": 1693987200,
          "order_id": "116947",
          "created_by": {
            "uid": "cee3c05e-5f85-43c4-b27e-889b99c50097",
            "fb_id": "377936050731194",
            "fb_name": "Vũ Sơn"
          },
          "edit_history": []
        }
      ]
    }
  ]
}

Add note

POST/shops/{SHOP_ID}/customers/{CUSTOMER_ID}/create_note

Add a note to customer

Path parameters

SHOP_IDintegerrequired

Shop ID

Example: 4
CUSTOMER_IDstringrequired

Customer ID

Example: "96a8e283-3fba-492e-a35a-970f72a30a02"

Request body

Request body containing customer note information

object
conversation_idstring

Conversation ID

page_idstring

Page ID

messagestring

Note content

imagesarray<object>

Note image information

order_idinteger

Order ID

Responses

object
successboolean

Success status

Request
curl -X POST "https://pos.pages.fm/api/v1/shops/{SHOP_ID}/customers/{CUSTOMER_ID}/create_note?api_key=API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "conversation_id": "117967746266487_9306266852780716",
  "page_id": "117967746266487",
  "message": "khách hàng mua nhiều lần",
  "images": [
    {
      "image_data": {
        "height": 225,
        "width": 225
      },
      "name": "iship thai.jpeg",
      "preview_url": "https://content.pancake.vn/user-content-dev2.pancake.vn/2025/2/25/2488ecb12514520d9828390f695abc9db69a1452.jpg",
      "url": "https://content.pancake.vn/user-content-dev2.pancake.vn/2025/2/25/2488ecb12514520d9828390f695abc9db69a1452.jpg"
    }
  ],
  "order_id": 116947
}'
Response 200
{
  "success": true
}

Customer level list

GET/shops/{SHOP_ID}/customer_levels

Get list of customer levels

Path parameters

SHOP_IDintegerrequired

Shop ID

Example: 4

Query parameters

searchstring

Customer level name

Example: "Vip"

Responses

object
dataarray<object>

List of customer levels

successboolean

Success status

Request
curl "https://pos.pages.fm/api/v1/shops/{SHOP_ID}/customer_levels?api_key=API_KEY"
Response 200
{
  "success": true,
  "data": [
    {
      "id": "84fdef8b-8e4b-44e7-8d61-8553ee7f5833",
      "name": "cap 1",
      "color_customer_level": "#87d068",
      "discount": 5,
      "discount_type": 3,
      "shop_id": 20,
      "upgrade_by_order_count": 10,
      "upgrade_by_point": 100,
      "upgrade_by_total_purchase": 30000000
    }
  ]
}