--- title: customerEmailMarketingSubscribe - Storefront API description: Subscribes a customer to the newsletter with an email address. api_version: unstable api_name: storefront source_url: html: >- https://shopify.dev/docs/api/storefront/unstable/mutations/customerEmailMarketingSubscribe md: >- https://shopify.dev/docs/api/storefront/unstable/mutations/customerEmailMarketingSubscribe.md --- # customer​Email​Marketing​Subscribe mutation Requires `unauthenticated_write_customers` access scope. Subscribes a customer to the newsletter with an email address. ## Arguments * email [String!](https://shopify.dev/docs/api/storefront/unstable/scalars/String) required The customer's email address. *** ## Customer​Email​Marketing​Subscribe​Payload returns * customer [Customer​Marketing​Subscribe](https://shopify.dev/docs/api/storefront/unstable/objects/CustomerMarketingSubscribe) The created customer object. * customer​User​Errors [\[Customer​User​Error!\]!](https://shopify.dev/docs/api/storefront/unstable/objects/CustomerUserError) non-null The list of errors that occurred from executing the mutation. *** ## Examples * ### Subscribe a customer to your newsletter #### Description Subscribe a customer to your newsletter #### Query ```graphql mutation customerEmailMarketingSubscribe($email: String!) { customerEmailMarketingSubscribe(email: $email) { customer { email } customerUserErrors { field message code } } } ``` #### Variables ```json { "email": "johnsmith@shopify.com" } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/api/unstable/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \ -d '{ "query": "mutation customerEmailMarketingSubscribe($email: String!) { customerEmailMarketingSubscribe(email: $email) { customer { email } customerUserErrors { field message code } } }", "variables": { "email": "johnsmith@shopify.com" } }' ``` #### React Router ```javascript import { unauthenticated } from "../shopify.server"; export const loader = async () => { const { storefront } = await unauthenticated.storefront( 'your-development-store.myshopify.com' ); const response = await storefront.graphql( `#graphql mutation customerEmailMarketingSubscribe($email: String!) { customerEmailMarketingSubscribe(email: $email) { customer { email } customerUserErrors { field message code } } }`, { variables: { "email": "johnsmith@shopify.com" }, }, ); const json = await response.json(); return json.data; } ``` #### Node.js ```javascript const client = new shopify.clients.Storefront({ domain: 'your-development-store.myshopify.com', storefrontAccessToken, }); const data = await client.query({ data: { "query": `mutation customerEmailMarketingSubscribe($email: String!) { customerEmailMarketingSubscribe(email: $email) { customer { email } customerUserErrors { field message code } } }`, "variables": { "email": "johnsmith@shopify.com" }, }, }); ``` #### Response ```json { "customerEmailMarketingSubscribe": { "customer": { "email": "johnsmith@shopify.com" }, "customerUserErrors": [] } } ``` * ### customerEmailMarketingSubscribe reference