Skip to content

Create Newsletter ​

About ​

The createNewsletter mutation subscribes an email address to the store newsletter on the current channel. Use this mutation to:

  • Add newsletter opt-in to the storefront footer or account page
  • Re-subscribe a customer who previously unsubscribed
  • Capture marketing consent during registration or checkout
  • Track submissions using clientMutationId

The subscription is scoped to the current channel.

Authentication ​

The mutation is public — the storefront key alone is enough, so a footer signup form works for guests.

A customer token is optional. When one is sent, the subscription is linked to that customer's account; without it the row is stored as a guest subscription.

Authorization: Bearer <accessToken>

Arguments ​

ArgumentTypeRequiredDescription
inputcreateNewsletterInput!✅ YesInput object containing the subscription fields.

Input Fields (createNewsletterInput) ​

FieldTypeRequiredDescription
customerEmailString!✅ YesEmail address to subscribe. Must be valid and unique in the subscribers list.
clientMutationIdString❌ NoOptional client-side identifier for tracking the mutation request.

Possible Returns ​

FieldTypeDescription
newsletter.successBoolean!true if the subscription was created successfully.
newsletter.messageString!Human-readable confirmation or error message.
clientMutationIdStringEchoed back from the input if provided.

Use Cases ​

Trigger this mutation when a logged-in customer submits the newsletter form, then display message as feedback.

2. Account Preferences ​

Let customers manage their marketing consent from the account settings page.

Best Practices ​

  1. Validate email client-side first to reduce unnecessary API calls.
  2. Always read success before showing a success state.
  3. Handle the already-subscribed case gracefully — surface the server message.

Released under the MIT License.