Requires write_customers access scope.
For more info, refer to:
PUT https://{handle}.myshopline.com/admin/openapi/v20260301/customers/:id.json
handle : The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is open001.myshopline.com , the store handle is open001 .
Update a customer in the store. You can use this interface to update the customer's subscription status, address, and other information.
Path Parameters
  • id string required
    The unique identifier for the customer.
    Maximum length: 64
    Example: 4211465524
Request Headers
  • Content-Type string required
    The field must be set to the fixed value application/json; charset=utf-8.
  • Authorization string required
    The access token for the API resource. Refer to App authorization to obtain the access token, and then pass the obtained token in the Bearer format.
    Example:
    Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw
Request Body
  • customerobject
    Customer information.
  • accepts_marketing boolean
    Whether the customer accepts to subscribe to marketing information via email.
    DEPRECATED: This parameter is deprecated from API version v20250601.
    Example: true
  • addressesobject[]
    A list of customer addresses.
    Maximum size: 50
  • address1 string
    The first line of the customer's address. This typically includes information such as the street address or a post office box number.
    Maximum length: 255
    Example: 7720 Cherokee Road
  • address2 string
    The second line of the customer's address. This typically includes information such as apartment, suite, or unit number.
    Maximum length: 255
    Example: Apartment 2
  • city string
    The city in the address.
    Maximum length: 64
    Example: Hagerman
  • company string
    The company name.
    Maximum length: 255
  • country string
    The country or region in the address.
    Maximum length: 64
    Example: United States
  • country_code string
    A two-letter country or region code that follows the ISO 3611-1 (alpha 2) standard, used to identify a specific country or region in the address.
    Example: US
  • country_name string
    Standardized country or region name in address.
    DEPRECATED: This parameter is deprecated from API version v20250601.
    Example: United States
  • customer_id string
    The unique identifier for the customer.
    Maximum length: 64
    Example: 4201825054
  • default boolean
    Whether the address is set as the default address. Valid values are:
    • true: The default address
    • false: Not the default address
    Default value: false
  • first_name string
    The first name of the customer.
    Maximum length: 128
    Example: Bob
  • id string
    The unique identifier for the address.
    Maximum length: 64
    Example: 207119551
  • last_name string
    The last name of the customer.
    Maximum length: 128
    Example: Norman
  • name string
    The customer's nickname.
    DEPRECATED: This parameter is deprecated from API version v20250601.
    Example: NormanBob
  • phone string
    The customer’s mobile phone number. The input format for the mobile number must be in the format of 00 + country calling code + mobile number.
    Maximum length: 20
    Example: 001123-***-7890
  • province string
    The province in the address.
    Maximum length: 64
    Example: Kentucky
  • province_code string
    The custom code for the province in the address.
    DEPRECATED: This parameter is deprecated from API version v20250601
    Example: KY
  • zip string
    The postal code information of the address.
    Maximum length: 64
    Example: 40202
  • birthday string
    The birthday of the customer. Format: yyyyMMdd.
    Example: 19970102
  • email string
    The email of the customer.
    Maximum length: 50
    Example: *********@example.com
  • email_marketing_consentobject
    Email marketing subscription information.
  • consent_collected_from string
    Subscription information source.
    Maximum length: 50
    Example: pop
  • consent_updated_at string
    The date and time when the subscription was updated. Format: ISO 8601.
    Example: 2022-05-31T15:32:46+08:00
  • opt_in_level integer
    Subscription method. Valid values are:
    • 0 : unknown
    • 1 : single opt-in
    • 2 : confirmed opt-in
    The default value varies depending on whether the option is enabled under SHOPLINE Admin > Settings > Customer Account > Marketing options.
    • Enabled: Default value is 2.
    • Disabled: Default value is 1.
    Example: 2
  • state integer
    Email subscription status. Valid values are:
    • 0 : Unsubscribed
    • 1 : Subscribed
    • 2 : Not subscribed
    • 3 : Awaiting confirmation
    This field must be passed when any other subfields under email_marketing_consent have values.
    Example: 2
  • first_name string
    The first name of the customer.
    Maximum length: 128
    Example: Bob
  • gender integer
    The gender of the customer. Valid values are:
    • 0 : unknown
    • 1 : male
    • 2 : female
    • 3 : secret
    Default value: 0
    Example: 1
  • last_name string
    The last name of the customer.
    Maximum length: 128
    Example: Norman
  • multipass_identifier string
    A unique identifier for the customer that logs in with Multipass login.
    Maximum length: 100
    Example: multipassIdentifier
  • note string
    Merchant's notes on the customer.
    Maximum length: 1000
    Example: Placed an order that had a fraud warning
  • password string
    Customer's password. If it is passed in, the customer state changes from not invited to registered. The customer state is represented by the customer.state in the response.
    Password length: 6-18 characters
    Allowed characters: uppercase letters, lowercase letters, numbers, and symbols
    DEPRECATED: This parameter is deprecated from API version v20250601.
    Example: 123456
  • password_confirmation string
    The customer's second password input for confirmation.
    Password length: 6-18 characters
    Allowed characters: uppercase letters, lowercase letters, numbers, and symbols
    DEPRECATED: This parameter is deprecated from API version v20250601.
    Example: 123456
  • phone string
    The phone number of the customer.
    Maximum length: 20
    Example: 001467326483
  • sms_marketing_consentobject
    SMS marketing subscription information.
  • consent_collected_from string
    Subscription information source.
    Maximum length: 50
    Example: pop
  • consent_updated_at string
    The date and time when the subscription was updated. Format: ISO 8601.
    Example: 2022-05-31T15:32:46+08:00
  • opt_in_level integer
    Subscription method. Valid values are:
    • 0 : unknown
    • 1 : single opt-in
    • 2 : confirmed opt-in
    Example: 1
  • state integer
    SMS subscription status. Valid values are:
    • 0 : Unsubscribed
    • 1 : Subscribed
    • 2 : Not subscribed
    This field must be passed when any other subfields under sms_marketing_consent have values.
    Example: 1
  • tags string
    Add tags for customers, and separate different tags with a comma. Maximum number of tags allowed: 100
    Maximum length per tag: 128
    Maximum length total: 1000
    Example: loyal
  • verified_email boolean
    Whether the email has been verified. Valid values are:
    • true : verified
    • false : unverified
    Default value: false
    Example: true
Status Codes
For the complete list of codes and messages, see Http status code.

Response Headers
  • traceId
    A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise.
Response Body
  • customerobject
    Customer information.
  • accepts_marketing boolean
    Whether the customer accepts to subscribe to marketing information via email.
    DEPRECATED: This parameter is deprecated from API version v20250601.
  • accepts_marketing_updated_at string
    The time when the customer updated their subscription to email marketing.
    DEPRECATED: This parameter is deprecated from API version v20250601.
  • accepts_mobile_marketing_updated_at string
    Whether the customer accepts to subscribe to marketing information via mobile phone number.
    DEPRECATED:This parameter is deprecated from API version v20250601.
  • accepts_phone_marketing boolean
    The time when the customer updated the subscription to mobile phone number marketing.
    This parameter is deprecated from API version v20250601.
  • addressesobject[]
    A list of customer addresses.
  • address1 string
    The first line of the customer's address. This typically includes information such as the street address or a post office box number.
  • address2 string
    The second line of the customer's address. This typically includes information such as apartment, suite, or unit number.
  • city string
    The city in the address.
  • company string
    The company name.
  • country string
    The country or region in the address.
  • country_code string
    A two-letter country or region code that follows the ISO 3611-1 (alpha 2) standard, used to identify a specific country or region in the address.
  • customer_id string
    The unique identifier for the customer.
  • default boolean
    Whether the address is set as the default address. Valid values are:
    • true: Default address.
    • false: No default address.
  • first_name string
    The first name of the customer.
  • id string
    The unique identifier for the address.
  • last_name string
    The last name of the customer.
  • phone string
    The phone number of the customer.
  • province string
    The province in the address.
  • province_code string
    The custom code for the province in the address.
    DEPRECATED: This parameter is deprecated from API version v20250601
  • province_code_v2 string
    The code for the province in the address, which is a two-digit ISO 3166-2 international code.
  • zip string
    The postal code information of the address.
  • asid string
    The unique identifier for the Facebook login.
  • created_at string
    The data and time when the customer was created.
  • currency string
    The currency used by the customer to place an order. The value of this parameter is a three-letter currency code that follows the ISO 4217 standard.
  • default_addressobject
    Default address.
  • address1 string
    The first line of the customer's address. This typically includes information such as the street address or a post office box number.
  • address2 string
    The second line of the customer's address. This typically includes information such as apartment, suite, or unit number.
  • city string
    The city in the address.
  • company string
    The company name.
  • country string
    The country or region in the address.
  • country_code string
    A two-letter country or region code that follows the ISO 3611-1 (alpha 2) standard, used to identify a specific country or region in the address.
  • customer_id string
    The unique identifier for the customer.
  • default boolean
    Always returns true, indicating that the address is set as the default address.
  • first_name string
    The first name of the customer.
  • id string
    The unique identifier for the address.
  • last_name string
    The last name of the customer.
  • phone string
    The phone number of the customer.
  • province string
    The province in the address.
  • province_code string
    The custom code for the province in the address.
    DEPRECATED: This parameter is deprecated from API version v20250601
  • province_code_v2 string
    The code for the province in the address, which is a two-digit ISO 3166-2 international code.
  • zip string
    The postal code information of the address.
  • email string
    The email of the customer.
  • email_marketing_consentobject
    Email marketing subscription information.
  • consent_collected_from string
    Subscription information source.
  • consent_updated_at string
    The date and time when the subscription was updated. Format: ISO 8601.
  • opt_in_level integer
    Subscription method. Valid values are:
    • 0 : unknown
    • 1 : single opt-in
    • 2 : confirmed opt-in
  • state integer
    Email subscription status. Valid values are:
    • 0 : Unsubscribed
    • 1 : Subscribed
    • 2 : Not subscribed
    • 3 : Awaiting confirmation
  • email_subscribe_flag integer
    The final subscription status of the customer's email. Returned based on the email_marketing_consent related input information. Valid values are:
    • 0 : Unsubscribed
    • 1 : Subscribed
    • 2 : Not subscribed
  • first_name string
    The first name of the customer.
  • id string
    The unique identifier for the customer.
  • last_name string
    The last name of the customer.
  • last_order_id string
    The unique identifier for the most recent order.
  • last_order_name string
    The custom number for the most recent order.
  • mobile_subscribe_flag integer
    The final subscription status of the customer's mobile phone number. Returned based on the sms_marketing_consent related input information. Valid values are:
    • 0: Unsubscribed
    • 1: Subscribed
    • 2: Not subscribed
  • multipass_identifier string
    A unique identifier for the customer that's used with Multipass login.
  • note string
    Merchant's notes on the customer.
  • orders_count long
    The number of orders placed by the customer.
  • phone string
    The phone number of the customer.
  • sms_marketing_consentobject
    SMS marketing subscription information.
  • consent_collected_from string
    Subscription information source.
  • consent_updated_at string
    The date and time when the subscription was updated. Format: ISO 8601.
  • opt_in_level integer
    Subscription method. Valid values are:
    • 0 : unknown
    • 1 : single opt-in
    • 2 : confirmed opt-in
  • state integer
    SMS subscription status. Valid values are:
    • 0 : Unsubscribed
    • 1 : Subscribed
    • 2 : Not subscribed
    • 3 : Awaiting confirmation
  • state integer
    The status of the customer. Valid values are:
    • 0: Blacklist
    • 1: Not invited
    • 2: Invited
    • 3: Registered
  • tags string
    The tags of the customer.
  • total_spent string
    Total amount spent by the customer, displayed in the store currency.
  • updated_at string
    The date and time when the customer was updated.Format: ISO 8601.
  • verified_email boolean
    Whether the email has been verified. Valid values are:
    • true : verified
    • false : unverified
API Explorer
https://openapiceshidianpu.myshopline.com/admin/openapi/v20260301

ParamOptions

path required
header required

Body

required
{
  "customer": {
    "accepts_marketing": true,
    "addresses": [
      {
        "address1": "7720 Cherokee Road",
        "address2": "Apartment 2",
        "city": "Hagerman",
        "company": null,
        "country": "United States",
        "country_code": "US",
        "country_name": "United States",
        "customer_id": "4201825054",
        "default": false,
        "first_name": "Bob",
        "id": "207119551",
        "last_name": "Norman",
        "name": "NormanBob",
        "phone": "001123-***-7890",
        "province": "Kentucky",
        "province_code": "KY",
        "zip": "40202"
      }
    ],
    "birthday": "19970102",
    "email": "*********@example.com",
    "email_marketing_consent": {
      "consent_collected_from": "pop",
      "consent_updated_at": "2022-05-31T15:32:46+08:00",
      "opt_in_level": 2,
      "state": 2
    },
    "first_name": "Bob",
    "gender": 1,
    "last_name": "Norman",
    "multipass_identifier": "multipassIdentifier",
    "note": "Placed an order that had a fraud warning",
    "password": "123456",
    "password_confirmation": "123456",
    "phone": "001467326483",
    "sms_marketing_consent": {
      "consent_collected_from": "pop",
      "consent_updated_at": "2022-05-31T15:32:46+08:00",
      "opt_in_level": 1,
      "state": 1
    },
    "tags": "loyal",
    "verified_email": true
  }
}

Language

curl --request PUT \
--url https://openapiceshidianpu.myshopline.com/admin/openapi/v20260301/customers/id.json \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw' \
--header 'Content-Type: application/json; charset=utf-8' \
--header 'accept: application/json'
Examples
The email has already been registered
Request
{
"customer": {
"addresses": [
{
"address1": "Pas************-31A",
"address2": "",
"city": "Ma******ss",
"company": "Shopline",
"country": "Singapore",
"country_code": "SG",
"customer_id": "*******021",
"default": "true",
"first_name": "D****",
"last_name": "B****",
"phone": "008********5656",
"province": "",
"province_code": "",
"zip": "*****40"
}
],
"birthday": "20210831",
"email": "*********@example.com",
"email_marketing_consent": {
"consent_collected_from": "shopline",
"consent_updated_at": "2021-08-31T02:20:26+08:00",
"opt_in_level": 1,
"state": 1
},
"first_name": "D****",
"gender": "3",
"last_name": "B****",
"multipass_identifier": "",
"note": "shopline notes",
"phone": "008********5656",
"sms_marketing_consent": {
"consent_collected_from": "shopline",
"consent_updated_at": "2021-08-31T02:20:26+08:00",
"opt_in_level": 1,
"state": 1
},
"tags": "DemoTag1,DemoTag2",
"verified_email": true
}
}
Response
{
"errors": "This email has already been used for registration"
}
Was this article helpful to you?