---
title: "customerEmailMarketingConsentUpdate"
description: "更新客户的电子邮件营销信息"
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/customers/mutations/customer-email-marketing-consent-update'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/customers/mutations/customer-email-marketing-consent-update.md'
---
# customerEmailMarketingConsentUpdate

更新客户的电子邮件营销信息

- **Required Scopes:** `write_customers`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Mutation

## Required Permissions

* `write_customers`

接口访问需要令牌，具体如何获取令牌参考：[身份认证](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md)。

## Arguments

* `input`

  [CustomerEmailMarketingConsentUpdateInput!](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/customers/inputs/customer-email-marketing-consent-update-input.md)

  更新客户电子邮件营销信息的输入字段

## Returns

* `customer`

  [Customer](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/customers/objects/customer.md)

  更新的客户信息

* `userErrors`

  [[CustomerEmailMarketingConsentUpdateUserError]](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/customers/objects/customer-email-marketing-consent-update-user-error.md)

  错误信息

## Examples

### 更新邮件订阅

更新客户邮件营销订阅信息

**Request:**

```json
{
  "input": {
    "customerId": "gid://shopline/Customer/4600419096",
    "emailMarketingConsent": {
      "consentUpdatedAt": "2023-12-27T03:31:06.960Z",
      "marketingState": "SUBSCRIBED"
    }
  }
}

```

**Response:**

```json
{
  "data": {
    "data": {
      "customerEmailMarketingConsentUpdate": {
        "customer": {
          "tags": [
            "test1"
          ],
          "taxExempt": true,
          "updatedAt": "2024-01-13T08:03:51.321Z",
          "taxExemptions": [
            {
              "countryCode": "US",
              "provinceGCodeList": [
                "AK"
              ]
            }
          ],
          "addresses": [
            {
              "address2": "Apartment 2",
              "city": "Louisville",
              "company": "C*****",
              "country": "United States",
              "countryCodeV2": "US",
              "lastName": "T*****",
              "phone": "0086****1234",
              "address1": "Chestnut Street 92",
              "firstName": "S*****",
              "id": "gid://shopline/MailingAddress/SL201UA6288183152684310781",
              "province": "Kentucky",
              "provinceCode": null,
              "zip": "40202"
            }
          ],
          "createdAt": "2024-01-11T06:06:22.500Z",
          "defaultAddress": {
            "company": "C*****",
            "country": "United States",
            "countryCodeV2": "US",
            "firstName": "S*****",
            "id": "gid://shopline/MailingAddress/SL201UA6288183152684310781",
            "lastName": "T****",
            "zip": "40202",
            "address1": "Chestnut Street 92",
            "address2": "Apartment 2",
            "city": "Louisville",
            "phone": "0086185****1234",
            "province": "Kentucky",
            "provinceCode": null
          },
          "email": "******@example.com",
          "firstName": "S*****",
          "id": "gid://shopline/Customer/4600507018",
          "lastName": "T*****",
          "note": "Placed an order that had a fraud warning",
          "smsMarketingConsent": {
            "consentUpdatedAt": "2024-01-13T08:03:52.337Z",
            "marketingState": "SUBSCRIBED"
          },
          "verifiedEmail": false,
          "phone": "0086185****1234",
          "emailMarketingConsent": {
            "consentUpdatedAt": "2024-01-13T08:06:36.819Z",
            "marketingState": "SUBSCRIBED"
          }
        },
        "userErrors": null
      }
    }
  }
}
```

## Error Handling

关于更多通用错误码说明，参考：[状态码和错误码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes)。

