---
title: customerCreate - Storefront API
description: >
  Creates a new [`Customer`](/docs/api/storefront/unstable/objects/Customer)
  account with the provided contact information and login credentials. The
  customer can then sign in for things such as accessing their account, viewing
  order history, and managing saved addresses.


  > Caution:

  > This mutation creates customer credentials. Ensure passwords are collected
  securely and never logged or exposed in client-side code.
api_version: unstable
api_name: storefront
source_url:
  html: 'https://shopify.dev/docs/api/storefront/unstable/mutations/customerCreate'
  md: 'https://shopify.dev/docs/api/storefront/unstable/mutations/customerCreate.md'
---

# customer​Create

mutation

Requires `unauthenticated_write_customers` access scope.

Creates a new [`Customer`](https://shopify.dev/docs/api/storefront/unstable/objects/Customer) account with the provided contact information and login credentials. The customer can then sign in for things such as accessing their account, viewing order history, and managing saved addresses.

***

**Caution:** This mutation creates customer credentials. Ensure passwords are collected securely and never logged or exposed in client-side code.

***

## Arguments

* input

  [Customer​Create​Input!](https://shopify.dev/docs/api/storefront/unstable/input-objects/CustomerCreateInput)

  required

  The fields used to create a new customer.

***

## Customer​Create​Payload returns

* customer

  [Customer](https://shopify.dev/docs/api/storefront/unstable/objects/Customer)

  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.

* user​Errors

  [\[User​Error!\]!](https://shopify.dev/docs/api/storefront/unstable/objects/UserError)

  non-nullDeprecated

  The list of errors that occurred from executing the mutation.

***

## Examples

* ### Create a customer

  #### Description

  Create a new customer

  #### Query

  ```graphql
  mutation customerCreate($input: CustomerCreateInput!) {
    customerCreate(input: $input) {
      customer {
        firstName
        lastName
        email
        phone
        acceptsMarketing
      }
      customerUserErrors {
        field
        message
        code
      }
    }
  }
  ```

  #### Variables

  ```json
  {
    "input": {
      "firstName": "John",
      "lastName": "Smith",
      "email": "johnsmith@shopify.com",
      "phone": "+15146669999",
      "password": "5hopify",
      "acceptsMarketing": true
    }
  }
  ```

  #### 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 customerCreate($input: CustomerCreateInput!) { customerCreate(input: $input) { customer { firstName lastName email phone acceptsMarketing } customerUserErrors { field message code } } }",
   "variables": {
      "input": {
        "firstName": "John",
        "lastName": "Smith",
        "email": "johnsmith@shopify.com",
        "phone": "+15146669999",
        "password": "5hopify",
        "acceptsMarketing": true
      }
    }
  }'
  ```

  #### 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 customerCreate($input: CustomerCreateInput!) {
      customerCreate(input: $input) {
        customer {
          firstName
          lastName
          email
          phone
          acceptsMarketing
        }
        customerUserErrors {
          field
          message
          code
        }
      }
    }`,
    {
      variables: {
          "input": {
              "firstName": "John",
              "lastName": "Smith",
              "email": "johnsmith@shopify.com",
              "phone": "+15146669999",
              "password": "5hopify",
              "acceptsMarketing": true
          }
      },
    },
    );
    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 customerCreate($input: CustomerCreateInput!) {
        customerCreate(input: $input) {
          customer {
            firstName
            lastName
            email
            phone
            acceptsMarketing
          }
          customerUserErrors {
            field
            message
            code
          }
        }
      }`,
      "variables": {
          "input": {
              "firstName": "John",
              "lastName": "Smith",
              "email": "johnsmith@shopify.com",
              "phone": "+15146669999",
              "password": "5hopify",
              "acceptsMarketing": true
          }
      },
    },
  });
  ```

  #### Response

  ```json
  {
    "customerCreate": {
      "customer": {
        "firstName": "John",
        "lastName": "Smith",
        "email": "johnsmith@shopify.com",
        "phone": "+15146669999",
        "acceptsMarketing": true
      },
      "customerUserErrors": []
    }
  }
  ```

* ### customerCreate reference
