---
title: "customerEmailMarketingConsentUpdate"
description: "Update customers’ email marketing messages"
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-graph-ql-api/customers/mutations/customer-email-marketing-consent-update'
  md: 'https://developer.shopline.com/docs/admin-graph-ql-api/customers/mutations/customer-email-marketing-consent-update.md'
---
# customerEmailMarketingConsentUpdate

Update customers’ email marketing messages

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

## Required Permissions

* `write_customers`

An access token is required to call this API. Refer to [Authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md) for more information about how to obtain the token.

## Arguments

* `input`

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

  Update input fields for customer email marketing information

## Returns

* `customer`

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

  The updated customer.

* `userErrors`

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

  error message

## Examples

### Update email subscription information

Update customer email marketing subscription information

**Request:**

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

```

**Response:**

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

## Error Handling

For detailed information about common codes, see [Status and error codes](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes).

