» Customer POST API Documentation

Creating a Customer

Endpoint: POST/customersPOST/admin/customers

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

Request Body

Field
Type
Description
first_name
String
Customer's first name
last_name
String
Customer's last name
email
String
Customer's email address
address_line
String
Customer's street address
password
String
Password for customer account login
{
    "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

This API response returns essential customer details including ID, name, email, status, and parent group. It confirms the customer’s company status, credit limits, and preferences like price visibility and newsletter subscription. The response also includes the assigned shipping profile and full address records (Primary, Shipping, and Billing), each with location and contact details. It ensures the customer is fully set up for transactions, shipping, and account control within the system.

POST
https://{your_site_domain}/api/v4/admin/customers
Try It Out
{
    "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.

Request Body

KeyType
Description
email
String
Email address of the customer
old_password
String
Current (old) password of the customer
password
String
New password to be set for the customer
{
    "customer": {
        "email": "CUSTOMER_EMAIL",
        "old_password": "CUSTOMER_OLD_PASSWORD",
        "password": "CUSTOMER_NEW_PASSWORD"
    }
}

Response

The response confirms that the customer's password has been updated successfully. It returns a status of "success" along with a message stating "Password has been changed successfully", indicating the change was completed without any errors. This ensures the customer's account security has been updated as requested.

POST
https://{your_site_domain}/api/v4/admin/customers/{customer_id}/change-password
Try It Out
{
    "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.

Request Body

Key Type Description
password String New password to reset the account
{
  "customer": {
    "password": "PASSWORD"
  }
}

Response

The response confirms the outcome of the password reset action for the specified customer. It includes a status indicating success or failure and a message providing further context about the result. This ensures clear communication that the customer's password has been successfully reset or an appropriate error occurred.

POST
https://{your_site_domain}/api/v4/admin/customers/{customer_id}/reset-password
Try It Out
{
    "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.

Request Body

Key Type Description
address_line_1 String Primary line of the street address
address_line_2 String Secondary address info 
country String Country name
state String State or province name
city String City name
post_code String Postal or ZIP code
{
    "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

The response confirms that the customer's address information has been successfully updated. It returns the complete customer profile, including the customer's ID, name, email, status, and company details. Most importantly, it provides a list of associated addresses Primary, Shipping, and Billing each with detailed fields like address lines, country, state, city, postcode, and contact numbers. The response also indicates which addresses are currently set as the active billing and shipping addresses using their respective IDs. This response ensures that the address addition or update operation was completed successfully and reflects the current state of the customer's address records.

POST
https://{your_site_domain}/api/v4/admin/customers/{customer_id}/addresses
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": {
            "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"
    }
}