» Customer GET API Documentation

Getting all customers

Endpoints: GET /admin/customers

Purpose

This API retrieves a list of customers available for administrators. Administrators use the admin/customers endpoint to retrieve customer accounts, track user activity, and analyze customer data. The API allows businesses to securely access customer information for reporting, targeted marketing, and customer service purposes. This endpoint is read-only and does not support updating customer details. Additionally, it supports filtering, sorting, and pagination to efficiently navigate large product catalogs.

Path Parameters

No path parameters for this endpoint.

Query Parameters

Parameter Type Description
limit Integer Number of customers per request.
offset Integer Starting point for pagination. 
order_by String Field to sort results by.
direction String Sort order by ascending or descending.
email String Filter customers by email address.

Use Case

This API returns a list of customers along with details such as customer ID, name, email, account status, referral codes, store credit, and associated addresses. Each customer record includes basic information like ID, display ID, first and last name, email, and status. It also provides account details such as store credit, credit limit, referral codes, and tax codes. The response contains address information, including billing, shipping, and primary addresses with corresponding country, state, city, and postal code details. Additionally, it includes supplementary data such as profile picture, account creation date, and activity status. Pagination details are also included, specifying record limits, offsets, and links to the next page of results.

Request Body

No data is required for the request body.

Response

This API returns a list of products along with details such as pricing, stock availability, variations, metadata, and access restrictions. For regular customers, the response includes only products they are allowed to purchase, while administrators receive full product listings, including restricted and password-protected items. Each product contains information such as base price, sale price, stock levels, categories, variations, and SEO metadata to support e-commerce functionality. The response also supports pagination, ensuring efficient retrieval of product lists for large inventories.

GET
https://wcapi.mywebcommander.com/api/v4/admin/customers
Try It Out
{
    "customers": [
        {
            "id": CUSTOMER_ID,
            "display_id": CUSTOMER_DISPLAY_ID,
            "status": "CUSTOMER_STATUS",
            "first_name": "CUSTOMER_FIRST_NAME",
            "last_name": "CUSTOMER_LAST_NAME",
            "email": "CUSTOMER_EMAIL",
            "sex": null,
            "parent": null,
            "company": false,
            "company_name": "",
            "timezone": null,
            "abn": null,
            "abn_branch": null,
            "shipping_profile": null,
            "transaction_number": null,
            "referral_code": "CUSTOMER_REFERRAL_CODE",
            "used_referral_code": null,
            "count_referral_code_used": 0,
            "allow_credit_limit": false,
            "store_credit": 0.0,
            "credit_limit": 0.0,
            "how_do_you_know": null,
            "customer_password_expired": false,
            "hide_price": false,
            "default_tax_code": null,
            "source": null,
            "base_url": "/",
            "background_image": null,
            "profile_picture": "PROFILE_PICTURE_URL",
            "created_at": "CUSTOMER_CREATED_AT",
            "version": null,
            "addresses": [
                {
                    "id": ADDRESS_ID,
                    "type": "ADDRESS_TYPE",
                    "first_name": "CUSTOMER_FIRST_NAME",
                    "last_name": "CUSTOMER_LAST_NAME",
                    "email": "CUSTOMER_EMAIL",
                    "company_name": "",
                    "address_line_1": "ADDRESS_LINE_1",
                    "address_line_2": "",
                    "country": {
                        "id": COUNTRY_ID,
                        "name": "COUNTRY_NAME",
                        "code": "COUNTRY_CODE"
                    },
                    "state": {
                        "id": STATE_ID,
                        "name": "STATE_NAME",
                        "code": "STATE_CODE"
                    },
                    "city": "CITY_NAME",
                    "post_code": "POSTAL_CODE",
                    "mobile": "",
                    "phone": "",
                    "fax": ""
                }
            ],
            "active_billing_address": BILLING_ADDRESS_ID,
            "active_shipping_address": SHIPPING_ADDRESS_ID,
            "is_in_trash": false
        }
    ],
    "pagination": {
        "records": TOTAL_RECORDS,
        "limit": RECORDS_LIMIT,
        "offset": OFFSET_VALUE,
        "previous_page": null,
        "next_page": "NEXT_PAGE_URL"
    }
}

Getting Single Customer

Endpoint: GET /admin/customers/{customer_id}

Purpose

This API retrieves detailed information about a specific customer based on their unique ID. The /admin/customers/{id} endpoint allows administrators to fetch a single customer's complete profile, including personal details, account status, store credit, referral codes, and associated addresses. This endpoint is useful for customer support, account management, and data verification.

Path Parameters

ParameterTypeDescription
idIntegerUnique identifier of the customer

Query Parameters

No query parameters for this endpoint.

Use Case

Administrators use the /admin/customers/{id} endpoint to retrieve specific customer details for account management, identity verification, and customer support. It provides a comprehensive view of a customer's profile, including their addresses, account history, and credit status. This information helps in resolving user issues, analyzing customer data, and personalizing services.

Request Body

No data is required for the request body.

Response

The API returns detailed customer information, including the customer ID, name, email, status, referral codes, store credit, and account activity. It also provides address details such as billing, shipping, and primary addresses, including country, state, city, and postal code information. Additionally, the response includes metadata like profile pictures, account creation date, and active address identifiers.

GET
https://wcapi.mywebcommander.com/api/v4/admin/customers/1
Try It Out
{
    "customer": {
        "id": CUSTOMER_ID,
        "display_id": CUSTOMER_DISPLAY_ID,
        "status": "CUSTOMER_STATUS",
        "first_name": "CUSTOMER_FIRST_NAME",
        "last_name": "CUSTOMER_LAST_NAME",
        "email": "CUSTOMER_EMAIL",
        "sex": "CUSTOMER_SEX",
        "parent": null,
        "company": false,
        "company_name": "",
        "timezone": "CUSTOMER_TIMEZONE",
        "abn": null,
        "abn_branch": null,
        "shipping_profile": null,
        "transaction_number": null,
        "referral_code": "CUSTOMER_REFERRAL_CODE",
        "used_referral_code": null,
        "count_referral_code_used": 0,
        "allow_credit_limit": false,
        "store_credit": 0.0,
        "credit_limit": 0.0,
        "how_do_you_know": null,
        "customer_password_expired": false,
        "hide_price": false,
        "default_tax_code": null,
        "source": null,
        "base_url": "/",
        "background_image": null,
        "profile_picture": "PROFILE_PICTURE_URL",
        "created_at": "CUSTOMER_CREATED_AT",
        "version": null,
        "addresses": [
            {
                "id": ADDRESS_ID_1,
                "type": "ADDRESS_TYPE_1",
                "first_name": "CUSTOMER_FIRST_NAME",
                "last_name": "CUSTOMER_LAST_NAME",
                "email": "CUSTOMER_EMAIL",
                "company_name": "",
                "address_line_1": "ADDRESS_LINE_1",
                "address_line_2": null,
                "country": {
                    "id": COUNTRY_ID_1,
                    "name": "COUNTRY_NAME_1",
                    "code": "COUNTRY_CODE_1"
                },
                "state": {
                    "id": STATE_ID_1,
                    "name": "STATE_NAME_1",
                    "code": "STATE_CODE_1"
                },
                "city": "CITY_NAME_1",
                "post_code": "POST_CODE_1",
                "mobile": "",
                "phone": "",
                "fax": null
            },
            {
                "id": ADDRESS_ID_2,
                "type": "ADDRESS_TYPE_2",
                "first_name": "CUSTOMER_FIRST_NAME",
                "last_name": "CUSTOMER_LAST_NAME",
                "email": "CUSTOMER_EMAIL",
                "company_name": "",
                "address_line_1": "ADDRESS_LINE_2",
                "address_line_2": null,
                "country": {
                    "id": COUNTRY_ID_2,
                    "name": "COUNTRY_NAME_2",
                    "code": "COUNTRY_CODE_2"
                },
                "state": {
                    "id": STATE_ID_2,
                    "name": "STATE_NAME_2",
                    "code": "STATE_CODE_2"
                },
                "city": "CITY_NAME_2",
                "post_code": "POST_CODE_2",
                "mobile": "",
                "phone": "",
                "fax": null
            },
            {
                "id": ADDRESS_ID_3,
                "type": "ADDRESS_TYPE_3",
                "first_name": "CUSTOMER_FIRST_NAME",
                "last_name": "CUSTOMER_LAST_NAME",
                "email": "CUSTOMER_EMAIL",
                "company_name": "",
                "address_line_1": "ADDRESS_LINE_3",
                "address_line_2": null,
                "country": {
                    "id": COUNTRY_ID_3,
                    "name": "COUNTRY_NAME_3",
                    "code": "COUNTRY_CODE_3"
                },
                "state": {
                    "id": STATE_ID_3,
                    "name": "STATE_NAME_3",
                    "code": "STATE_CODE_3"
                },
                "city": "CITY_NAME_3",
                "post_code": "POST_CODE_3",
                "mobile": "",
                "phone": "",
                "fax": null
            }
        ],
        "active_billing_address": ACTIVE_BILLING_ADDRESS_ID,
        "active_shipping_address": ACTIVE_SHIPPING_ADDRESS_ID,
        "is_in_trash": false
    }
}

Getting Customer Fields

Endpoint: GET/admin/create-customer-fields

Purpose

This API retrieves the configuration settings for customer fields used during customer creation. The admin/create -customer - field endpoint allows administrators to view the list of fields required for customer registration, including their labels, activation status, and whether they are mandatory. This helps businesses customize and manage the customer sign-up process efficiently.

Path Parameters

No path parameters for this endpoint.

Query Parameters

No query parameters for this endpoint.

Use Case

Administrators use the /create-customer-fields endpoint to fetch the configuration of customer fields. This information can be used to ensure that the registration form aligns with business requirements. The retrieved data includes details about which fields are active, required, and their display order. This endpoint is read-only and does not modify field configurations.

Request Body

No data is required for the request body.

Response

The API returns a JSON object containing a list of customer fields along with their configurations. Each field includes attributes such as order, key, label, active status, and whether it is required. This ensures a structured approach to managing the customer registration process.

GET
https://wcapi.mywebcommander.com/api/v4/admin/create-customer-fields
Try It Out
{
    "fields": [
        "first_name",
        "last_name",
        "address_line_1",
        "post_code",
        "city",
        "phone",
        "mobile",
        "email",
        "password",
        "retype_password",
        "country",
        "customer_type",
        "sex",
        "company_name"
    ],
    "fieldsConfigs": {
        "first_name_order": "1",
        "first_name_key": "first_name",
        "first_name_label": "FIRST NAME",
        "first_name_active": true,
        "first_name_required": true,
        
        "last_name_order": "2",
        "last_name_key": "last_name",
        "last_name_label": "LAST NAME",
        "last_name_active": true,
        "last_name_required": false,
        
        "address_line_1_order": "3",
        "address_line_1_key": "address_line_1",
        "address_line_1_label": "ADDRESS LINE 1",
        "address_line_1_active": true,
        "address_line_1_required": true,
        
        "address_line_2_order": "4",
        "address_line_2_key": "address_line_2",
        "address_line_2_label": "ADDRESS LINE 2",
        "address_line_2_active": false,
        "address_line_2_required": false,
        
        "post_code_order": "5",
        "post_code_key": "post_code",
        "post_code_label": "POST CODE",
        "post_code_active": true,
        "post_code_required": true,
        
        "city_order": "6",
        "city_key": "city",
        "city_label": "SUBURB/CITY",
        "city_active": true,
        "city_required": true,
        
        "phone_order": "7",
        "phone_key": "phone",
        "phone_label": "PHONE",
        "phone_active": true,
        "phone_required": false,
        
        "mobile_order": "8",
        "mobile_key": "mobile",
        "mobile_label": "MOBILE",
        "mobile_active": true,
        "mobile_required": false,
        
        "fax_order": "9",
        "fax_key": "fax",
        "fax_label": "FAX",
        "fax_active": false,
        "fax_required": false,
        
        "email_order": "10",
        "email_key": "email",
        "email_label": "EMAIL",
        "email_active": true,
        "email_required": true,
        
        "confirm_email_order": "11",
        "confirm_email_key": "confirm_email",
        "confirm_email_label": "CONFIRM EMAIL",
        "confirm_email_active": false,
        "confirm_email_required": false,
        
        "password_order": "12",
        "password_key": "password",
        "password_label": "PASSWORD",
        "password_active": true,
        "password_required": true,
        
        "retype_password_order": "13",
        "retype_password_key": "retype_password",
        "retype_password_label": "RETYPE PASSWORD",
        "retype_password_active": true,
        "retype_password_required": true,
        
        "country_order": "14",
        "country_key": "country",
        "country_label": "COUNTRY",
        "country_active": true,
        "country_required": true,
        
        "customer_type_order": "15",
        "customer_type_key": "customer_type",
        "customer_type_label": "CUSTOMER TYPE",
        "customer_type_active": true,
        "customer_type_required": false,
        
        "sex_order": "16",
        "sex_key": "sex",
        "sex_label": "GENDER",
        "sex_active": true,
        "sex_required": false,
        
        "abn_order": "17",
        "abn_key": "abn",
        "abn_label": "ABN",
        "abn_active": false,
        "abn_required": false,
        
        "abn_branch_order": "18",
        "abn_branch_key": "abn_branch",
        "abn_branch_label": "ABN BRANCH",
        "abn_branch_active": false,
        "abn_branch_required": false,
        
        "company_name_order": "19",
        "company_name_key": "company_name",
        "company_name_label": "COMPANY NAME",
        "company_name_active": true,
        "company_name_required": false
    }
}