» Customer POST API Documentation

Creating Customers

Endpoint: POST/customerPOST/admin/customer

Purpose

This API allows administrators to create new customer accounts. The /admin/customers endpoint enables businesses to register customers by providing necessary personal and account-related details. It supports setting up customer credentials, addresses, and preferences such as newsletter subscriptions.

Path Parameters

No path parameters for this endpoint.

Query Parameters

No query parameters for this endpoint.

Use Case

Administrators use this endpoint to create new customer accounts efficiently. It is useful for businesses that need to manage customer registrations, assign shipping profiles, set up billing details, and configure additional customer settings such as newsletter subscriptions. This API simplifies customer onboarding by handling all relevant details in a single request

POST
https://wcapi.mywebcommander.com/api/v4/admin/customers
Try It Out

Request Body

{
    "customer": {
        "first_name": "FIRST_NAME",
        "last_name": "LAST_NAME",
        "shipping_profile": SHIPPING_PROFILE_ID,
        "gender": "GENDER",
        "email": "EMAIL_ADDRESS",
        "company_name": "COMPANY_NAME",
        "address_line": "ADDRESS_LINE",
        "country": COUNTRY_ID,
        "state": STATE_ID,
        "post_code": "POST_CODE",
        "city": "CITY_NAME",
        "mobile": "MOBILE_NUMBER",
        "phone": "PHONE_NUMBER",
        "abn": "ABN_NUMBER",
        "abn_branch": "ABN_BRANCH",
        "newsletter": {
            "subscribed": NEWSLETTER_SUBSCRIBED
        },
        "password": "PASSWORD",
        "hide_price": HIDE_PRICE,
        "transaction_number": "TRANSACTION_NUMBER",
        "parent": PARENT_ID,
        "is_company": IS_COMPANY
    }
}

Response

{
    "customer": {
        "id": CUSTOMER_ID,
        "display_id": DISPLAY_ID,
        "status": "STATUS",
        "first_name": "FIRST_NAME",
        "last_name": "LAST_NAME",
        "email": "EMAIL_ADDRESS",
        "sex": "GENDER",
        "parent": {
            "id": PARENT_ID,
            "name": "PARENT_NAME"
        },
        "company": IS_COMPANY,
        "company_name": "COMPANY_NAME",
        "timezone": "TIMEZONE",
        "abn": "ABN_NUMBER",
        "abn_branch": "ABN_BRANCH",
        "shipping_profile": {
            "shippingRules": [
                {
                    "zoneList": [ZONE_ID],
                    "name": "SHIPPING_RULE_NAME",
                    "description": "DESCRIPTION",
                    "id": SHIPPING_RULE_ID,
                    "shippingClass": "SHIPPING_CLASS",
                    "shippingPolicy": SHIPPING_POLICY_ID
                }
            ],
            "created": "CREATED_TIMESTAMP",
            "name": "SHIPPING_PROFILE_NAME",
            "description": "DESCRIPTION",
            "id": SHIPPING_PROFILE_ID,
            "updated": "UPDATED_TIMESTAMP",
            "version": VERSION_NUMBER,
            "rulePrecedence": "RULE_PRECEDENCE"
        },
        "transaction_number": "TRANSACTION_NUMBER",
        "referral_code": "REFERRAL_CODE",
        "used_referral_code": "USED_REFERRAL_CODE",
        "count_referral_code_used": COUNT_REFERRAL_CODE_USED,
        "allow_credit_limit": ALLOW_CREDIT_LIMIT,
        "store_credit": STORE_CREDIT_AMOUNT,
        "credit_limit": CREDIT_LIMIT_AMOUNT,
        "how_do_you_know": "HOW_DID_YOU_HEAR",
        "customer_password_expired": PASSWORD_EXPIRED,
        "hide_price": HIDE_PRICE,
        "default_tax_code": "DEFAULT_TAX_CODE",
        "source": "SOURCE",
        "base_url": "BASE_URL",
        "background_image": "BACKGROUND_IMAGE_URL",
        "profile_picture": "PROFILE_PICTURE_URL",
        "created_at": "CREATED_AT_TIMESTAMP",
        "version": VERSION_NUMBER,
        "addresses": [
            {
                "id": ADDRESS_ID_PRIMARY,
                "type": "PRIMARY",
                "first_name": "FIRST_NAME",
                "last_name": "LAST_NAME",
                "email": "EMAIL_ADDRESS",
                "company_name": "COMPANY_NAME",
                "address_line_1": "ADDRESS_LINE_1",
                "address_line_2": "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": "POST_CODE",
                "mobile": "MOBILE_NUMBER",
                "phone": "PHONE_NUMBER",
                "fax": "FAX_NUMBER"
            },
            {
                "id": ADDRESS_ID_SHIPPING,
                "type": "SHIPPING",
                "first_name": "FIRST_NAME",
                "last_name": "LAST_NAME",
                "email": "EMAIL_ADDRESS",
                "company_name": "COMPANY_NAME",
                "address_line_1": "ADDRESS_LINE_1",
                "address_line_2": "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": "POST_CODE",
                "mobile": "MOBILE_NUMBER",
                "phone": "PHONE_NUMBER",
                "fax": "FAX_NUMBER"
            },
            {
                "id": ADDRESS_ID_BILLING,
                "type": "BILLING",
                "first_name": "FIRST_NAME",
                "last_name": "LAST_NAME",
                "email": "EMAIL_ADDRESS",
                "company_name": "COMPANY_NAME",
                "address_line_1": "ADDRESS_LINE_1",
                "address_line_2": "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": "POST_CODE",
                "mobile": "MOBILE_NUMBER",
                "phone": "PHONE_NUMBER",
                "fax": "FAX_NUMBER"
            }
        ],
        "active_billing_address": ACTIVE_BILLING_ADDRESS_ID,
        "active_shipping_address": ACTIVE_SHIPPING_ADDRESS_ID,
        "is_in_trash": IS_IN_TRASH
    }
}

Changing Password of a Customer

Endpoint: POST/admin/customers/{$customer_id}/change-password

Purpose

This API endpoint allows administrators to change a customer's password. The /admin/customers/{customer_id}/change-password endpoint requires the customer's email, old password, and a new password to successfully update the credentials.

Path Parameters

ParameterTypeDescription
customer_idIntegerUnique identifier of the customer

Query Parameters

No query parameters for this endpoint.

Use Case

This API is used when an administrator needs to reset a customer's password. The administrator must provide the customer's email, current password, and the new password to ensure security. This is useful in scenarios where a customer has forgotten their password or needs to update it due to security concerns.

POST
https://wcapi.mywebcommander.com/api/v4/admin/customers/1/change-password
Try It Out

Request Body

{
    "customer": {
        "email": "CUSTOMER_EMAIL",
        "old_password": "CUSTOMER_OLD_PASSWORD",
        "password": "CUSTOMER_NEW_PASSWORD"
    }
}

Response

{
    "status": "STATUS",
    "message": "MESSAGE"
}

Resetting Password of a Customer

Endpoint: POST/admin/customers/{customer_id}/reset-password

Purpose

This API allows administrators to reset a customer's password. The admin/customers/{customer_id}/reset-password endpoint enables businesses to securely change a customer's password by providing a new password.

Path Parameters

ParameterTypeDescription
customer_idIntegerUnique identifier of the customer

Query Parameters

No query parameters for this endpoint.

Use Case

This API is used when an administrator needs to reset a customer's password without requiring the old password. This is useful in scenarios where a customer has forgotten their password and needs a new one assigned by an administrator.

POST
https://wcapi.mywebcommander.com/api/v4/admin/customers/1/reset-password
Try It Out

Request Body

{
    "password": "PASSWORD"
}

Response

{
    "status": "STATUS",
    "message": "MESSAGE"
}

Adding Address of a Customer

Endpoint: POST/admin/customers/{customer_id}/addresses

Purpose

This API allows administrators to add new addresses for customers. The /admin/customers/{customer_id}/addresses endpoint enables businesses to associate multiple addresses with a customer, including primary, shipping, and billing addresses

Path Parameters

ParameterTypeDescription
customer_idIntegerUnique identifier of the customer

Query Parameters

No query parameters for this endpoint.

Use Case

This API is used when an administrator needs to add new addresses for a customer. It supports multiple address types, such as primary, shipping, and billing addresses. Administrators can use this endpoint to store accurate and structured address data for customers, ensuring seamless order fulfillment, shipping, and billing processes. This functionality is especially useful for customers who have multiple delivery or billing locations, enabling businesses to manage their addresses efficiently.

POST
https://wcapi.mywebcommander.com/api/v4/admin/customers/1/addresses
Try It Out

Request Body

{
    "customer": {
        "addresses": [
            {
                "type": "PRIMARY",
                "first_name": "CUSTOMER_FIRST_NAME",
                "last_name": "CUSTOMER_LAST_NAME",
                "company_name": "CUSTOMER_COMPANY_NAME",
                "email": "CUSTOMER_EMAIL",
                "address_line_1": "ADDRESS_LINE_1",
                "address_line_2": "ADDRESS_LINE_2",
                "country": "COUNTRY_NAME",
                "state": "STATE_NAME",
                "city": "CITY_NAME",
                "post_code": "POSTAL_CODE",
                "mobile": "MOBILE_PHONE",
                "phone": "PHONE_NUMBER",
                "fax": "FAX_NUMBER"
            },
            {
                "type": "SHIPPING",
                "first_name": "CUSTOMER_FIRST_NAME",
                "last_name": "CUSTOMER_LAST_NAME",
                "company_name": "CUSTOMER_COMPANY_NAME",
                "email": "CUSTOMER_EMAIL",
                "address_line_1": "ADDRESS_LINE_1",
                "address_line_2": "ADDRESS_LINE_2",
                "country": "COUNTRY_NAME",
                "state": "STATE_NAME",
                "city": "CITY_NAME",
                "post_code": "POSTAL_CODE",
                "mobile": "MOBILE_PHONE",
                "phone": "PHONE_NUMBER",
                "fax": "FAX_NUMBER"
            },
            {
                "type": "BILLING",
                "first_name": "CUSTOMER_FIRST_NAME",
                "last_name": "CUSTOMER_LAST_NAME",
                "email": "CUSTOMER_EMAIL",
                "company_name": "CUSTOMER_COMPANY_NAME",
                "address_line_1": "ADDRESS_LINE_1",
                "address_line_2": "ADDRESS_LINE_2",
                "country": "COUNTRY_NAME",
                "state": "STATE_NAME",
                "city": "CITY_NAME",
                "post_code": "POSTAL_CODE",
                "mobile": "MOBILE_PHONE",
                "phone": "PHONE_NUMBER",
                "fax": "FAX_NUMBER"
            }
        ]
    }
}

Response

{
    "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": {
            "id": "PARENT_ID",
            "name": "PARENT_NAME"
        },
        "company": "IS_COMPANY",
        "company_name": "COMPANY_NAME",
        "timezone": "CUSTOMER_TIMEZONE",
        "abn": "CUSTOMER_ABN",
        "abn_branch": "CUSTOMER_ABN_BRANCH",
        "shipping_profile": {
            "shippingRules": [
                {
                    "zoneList": [
                        "ZONE_ID"
                    ],
                    "name": "SHIPPING_RULE_NAME",
                    "description": "SHIPPING_RULE_DESCRIPTION",
                    "id": "SHIPPING_RULE_ID",
                    "shippingClass": "SHIPPING_CLASS",
                    "shippingPolicy": "SHIPPING_POLICY"
                }
            ],
            "created": "SHIPPING_PROFILE_CREATED_AT",
            "name": "SHIPPING_PROFILE_NAME",
            "description": "SHIPPING_PROFILE_DESCRIPTION",
            "id": "SHIPPING_PROFILE_ID",
            "updated": "SHIPPING_PROFILE_UPDATED_AT",
            "version": "SHIPPING_PROFILE_VERSION",
            "rulePrecedence": "SHIPPING_RULE_PRECEDENCE"
        },
        "transaction_number": "TRANSACTION_NUMBER",
        "referral_code": "CUSTOMER_REFERRAL_CODE",
        "used_referral_code": "USED_REFERRAL_CODE",
        "count_referral_code_used": "COUNT_REFERRAL_CODE_USED",
        "allow_credit_limit": "ALLOW_CREDIT_LIMIT",
        "store_credit": "CUSTOMER_STORE_CREDIT",
        "credit_limit": "CUSTOMER_CREDIT_LIMIT",
        "how_do_you_know": "HOW_DO_YOU_KNOW",
        "customer_password_expired": "CUSTOMER_PASSWORD_EXPIRED",
        "hide_price": "HIDE_PRICE",
        "default_tax_code": "DEFAULT_TAX_CODE",
        "source": "SOURCE",
        "base_url": "BASE_URL",
        "background_image": "BACKGROUND_IMAGE_URL",
        "profile_picture": "PROFILE_PICTURE_URL",
        "created_at": "CUSTOMER_CREATED_AT",
        "version": "CUSTOMER_VERSION",
        "addresses": [
            {
                "id": "ADDRESS_ID",
                "type": "ADDRESS_TYPE",
                "first_name": "ADDRESS_FIRST_NAME",
                "last_name": "ADDRESS_LAST_NAME",
                "email": "ADDRESS_EMAIL",
                "company_name": "ADDRESS_COMPANY_NAME",
                "address_line_1": "ADDRESS_LINE_1",
                "address_line_2": "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": "MOBILE_PHONE",
                "phone": "PHONE_NUMBER",
                "fax": "FAX_NUMBER"
            },
            {
                "id": "ADDRESS_ID",
                "type": "ADDRESS_TYPE",
                "first_name": "ADDRESS_FIRST_NAME",
                "last_name": "ADDRESS_LAST_NAME",
                "email": "ADDRESS_EMAIL",
                "company_name": "ADDRESS_COMPANY_NAME",
                "address_line_1": "ADDRESS_LINE_1",
                "address_line_2": "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": "MOBILE_PHONE",
                "phone": "PHONE_NUMBER",
                "fax": "FAX_NUMBER"
            },
            {
                "id": "ADDRESS_ID",
                "type": "ADDRESS_TYPE",
                "first_name": "ADDRESS_FIRST_NAME",
                "last_name": "ADDRESS_LAST_NAME",
                "email": "ADDRESS_EMAIL",
                "company_name": "ADDRESS_COMPANY_NAME",
                "address_line_1": "ADDRESS_LINE_1",
                "address_line_2": "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": "MOBILE_PHONE",
                "phone": "PHONE_NUMBER",
                "fax": "FAX_NUMBER"
            },
            {
                "id": "ADDRESS_ID",
                "type": "ADDRESS_TYPE",
                "first_name": "ADDRESS_FIRST_NAME",
                "last_name": "ADDRESS_LAST_NAME",
                "email": "ADDRESS_EMAIL",
                "company_name": "ADDRESS_COMPANY_NAME",
                "address_line_1": "ADDRESS_LINE_1",
                "address_line_2": "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": "MOBILE_PHONE",
                "phone": "PHONE_NUMBER",
                "fax": "FAX_NUMBER"
            }
        ],
        "active_billing_address": "ACTIVE_BILLING_ADDRESS_ID",
        "active_shipping_address": "ACTIVE_SHIPPING_ADDRESS_ID",
        "is_in_trash": "IS_IN_TRASH"
    }
}