> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://mailchimp.com/developer/marketing/api/ecommerce/upsert-store-customer/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://mailchimp.com/_mcp/server. # Add or update customer PUT https://api.mailchimp.com/3.0/ecommerce/stores/{store_id}/customers/{customer_id} Content-Type: application/json Add or update a customer. Reference: https://mailchimp.com/developer/marketing/api/ecommerce/upsert-store-customer ## Authentication - `Authorization` header (bearer token, required) — Authorization using a Mailchimp API key (a.k.a. Bearer token) - `Authorization` header (bearer token, required) — Authorization using OAuth ## Request ### Path parameters - `store_id` (string, required) — The store id. - `customer_id` (string, required) — The id for the customer of a store. ### Body (application/json) This endpoint expects an object. - `address` (30EcommerceStoresStoreIdCustomersCustomerIdPutRequestBodyContentApplicationJsonSchemaAddress, optional) — The customer's address. - `company` (string, optional) — The customer's company. - `email_address` (string, optional) — The customer's email address. - `first_name` (string, optional) — The customer's first name. - `id` (string, optional) — A unique identifier for the customer. Limited to 50 characters. - `last_name` (string, optional) — The customer's last name. - `opt_in_status` (boolean, optional) — The customer's opt-in status. This value will never overwrite the opt-in status of a pre-existing Mailchimp list member, but will apply to list members that are added through the e-commerce API endpoints. Customers who don't opt in to your Mailchimp list [will be added as `Transactional` members](https://mailchimp.com/developer/marketing/docs/e-commerce/#customers). - `sms_phone_number` (string, optional) — A US phone number for SMS contact. - `total_spent` (30EcommerceStoresStoreIdCustomersCustomerIdPutRequestBodyContentApplicationJsonSchemaTotalSpent, optional) ## Response ### 200 - `_links` (list of ECommerceCustomerLinksItems, optional) — A list of link types and descriptions for the API schema documents. - `address` (ECommerceCustomerAddress, optional) — The customer's address. - `company` (string, optional) — The customer's company. - `created_at` (datetime, optional) — The date and time the customer was created in ISO 8601 format. - `email_address` (string, optional) — The customer's email address. - `first_name` (string, optional) — The customer's first name. - `id` (string, optional) — A unique identifier for the customer. - `last_name` (string, optional) — The customer's last name. - `opt_in_status` (boolean, optional) — The customer's opt-in status. This value will never overwrite the opt-in status of a pre-existing Mailchimp list member, but will apply to list members that are added through the e-commerce API endpoints. Customers who don't opt in to your Mailchimp list [will be added as `Transactional` members](https://mailchimp.com/developer/marketing/docs/e-commerce/#customers). - `orders_count` (integer, optional) — The customer's total order count. - `sms_phone_number` (string, optional) — A US phone number for SMS contact. - `total_spent` (ECommerceCustomerTotalSpent, optional) - `updated_at` (datetime, optional) — The date and time the customer was last updated in ISO 8601 format. ## Types ### 30EcommerceStoresStoreIdCustomersCustomerIdPutRequestBodyContentApplicationJsonSchemaAddress The customer's address. - `address1` (string, optional) — The mailing address of the customer. - `address2` (string, optional) — An additional field for the customer's mailing address. - `city` (string, optional) — The city the customer is located in. - `country` (string, optional) — The customer's country. - `country_code` (string, optional) — The two-letter code for the customer's country. - `postal_code` (string, optional) — The customer's postal or zip code. - `province` (string, optional) — The customer's state name or normalized province. - `province_code` (string, optional) — The two-letter code for the customer's province or state. ### 30EcommerceStoresStoreIdCustomersCustomerIdPutRequestBodyContentApplicationJsonSchemaTotalSpent ### ECommerceCustomerLinksItems This object represents a link from the resource where it is found to another resource or action that may be performed. - `href` (string, optional) — This property contains a fully-qualified URL that can be called to retrieve the linked resource or perform the linked action. - `method` (enum, optional) — The HTTP method that should be used when accessing the URL defined in 'href'. - Allowed values: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`, `HEAD` - `rel` (string, optional) — As with an HTML 'rel' attribute, this describes the type of link. - `schema` (string, optional) — For HTTP methods that can receive bodies (POST and PUT), this is a URL representing the schema that the body should conform to. - `targetSchema` (string, optional) — For GETs, this is a URL representing the schema that the response should conform to. ### ECommerceCustomerAddress The customer's address. - `address1` (string, optional) — The mailing address of the customer. - `address2` (string, optional) — An additional field for the customer's mailing address. - `city` (string, optional) — The city the customer is located in. - `country` (string, optional) — The customer's country. - `country_code` (string, optional) — The two-letter code for the customer's country. - `postal_code` (string, optional) — The customer's postal or zip code. - `province` (string, optional) — The customer's state name or normalized province. - `province_code` (string, optional) — The two-letter code for the customer's province or state. ### ECommerceCustomerTotalSpent ## Examples **Request** ```json {} ``` **Response** ```json { "_links": [ { "href": "string", "method": "GET", "rel": "string", "schema": "string", "targetSchema": "string" } ], "address": { "address1": "675 Ponce de Leon Ave NE", "address2": "Suite 5000", "city": "Atlanta", "country": "United States", "country_code": "US", "postal_code": "30308", "province": "Georgia", "province_code": "GA" }, "company": "string", "created_at": "2015-07-15T19:28:00+00:00", "email_address": "string", "first_name": "string", "id": "string", "last_name": "string", "opt_in_status": true, "orders_count": 4, "sms_phone_number": "string", "total_spent": 1.1, "updated_at": "2015-07-15T19:28:00+00:00" } ``` **SDK Code** ```python import requests url = "https://api.mailchimp.com/3.0/ecommerce/stores/store_id/customers/customer_id" payload = {} headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.put(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.mailchimp.com/3.0/ecommerce/stores/store_id/customers/customer_id'; const options = { method: 'PUT', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.mailchimp.com/3.0/ecommerce/stores/store_id/customers/customer_id" payload := strings.NewReader("{}") req, _ := http.NewRequest("PUT", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.mailchimp.com/3.0/ecommerce/stores/store_id/customers/customer_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Put.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.put("https://api.mailchimp.com/3.0/ecommerce/stores/store_id/customers/customer_id") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('PUT', 'https://api.mailchimp.com/3.0/ecommerce/stores/store_id/customers/customer_id', [ 'body' => '{}', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.mailchimp.com/3.0/ecommerce/stores/store_id/customers/customer_id"); var request = new RestRequest(Method.PUT); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.mailchimp.com/3.0/ecommerce/stores/store_id/customers/customer_id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PUT" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` > Find all the Mailchimp API documentation and tools developers need to send marketing and transactional emails.