# customerCreate - storefront - MUTATION Version: 2024-10 ## Description Creates a new customer. ### Access Scopes `unauthenticated_write_customers` access scope. ## Arguments * [input](/docs/api/storefront/2024-10/input-objects/CustomerCreateInput): CustomerCreateInput! - The fields used to create a new customer. ## Returns * [customer](/docs/api/storefront/2024-10/objects/Customer): Customer The created customer object. * [customerUserErrors](/docs/api/storefront/2024-10/objects/CustomerUserError): CustomerUserError! The list of errors that occurred from executing the mutation. * [userErrors](/docs/api/storefront/2024-10/objects/UserError): UserError! The list of errors that occurred from executing the mutation. ## Examples ### Create a customer Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \\\n-d '{\n\"query\": \"mutation customerCreate($input: CustomerCreateInput!) { customerCreate(input: $input) { customer { firstName lastName email phone acceptsMarketing } customerUserErrors { field message code } } }\",\n \"variables\": {\n \"input\": {\n \"firstName\": \"John\",\n \"lastName\": \"Smith\",\n \"email\": \"johnsmith@shopify.com\",\n \"phone\": \"+15146669999\",\n \"password\": \"5hopify\",\n \"acceptsMarketing\": true\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Storefront({\n domain: 'your-development-store.myshopify.com',\n storefrontAccessToken,\n});\nconst data = await client.query({\n data: {\n \"query\": `mutation customerCreate($input: CustomerCreateInput!) {\n customerCreate(input: $input) {\n customer {\n firstName\n lastName\n email\n phone\n acceptsMarketing\n }\n customerUserErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"firstName\": \"John\",\n \"lastName\": \"Smith\",\n \"email\": \"johnsmith@shopify.com\",\n \"phone\": \"+15146669999\",\n \"password\": \"5hopify\",\n \"acceptsMarketing\": true\n }\n },\n },\n});\n" Ruby example: null Remix example: "const { storefront } = await unauthenticated.storefront(\n 'your-development-store.myshopify.com'\n);\n\nconst response = await storefront.graphql(\n `#graphql\n mutation customerCreate($input: CustomerCreateInput!) {\n customerCreate(input: $input) {\n customer {\n firstName\n lastName\n email\n phone\n acceptsMarketing\n }\n customerUserErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"firstName\": \"John\",\n \"lastName\": \"Smith\",\n \"email\": \"johnsmith@shopify.com\",\n \"phone\": \"+15146669999\",\n \"password\": \"5hopify\",\n \"acceptsMarketing\": true\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation customerCreate($input: CustomerCreateInput!) {\n customerCreate(input: $input) {\n customer {\n firstName\n lastName\n email\n phone\n acceptsMarketing\n }\n customerUserErrors {\n field\n message\n code\n }\n }\n}" #### Graphql Input { "input": { "firstName": "John", "lastName": "Smith", "email": "johnsmith@shopify.com", "phone": "+15146669999", "password": "5hopify", "acceptsMarketing": true } } #### Graphql Response { "data": { "customerCreate": { "customer": { "firstName": "John", "lastName": "Smith", "email": "johnsmith@shopify.com", "phone": "+15146669999", "acceptsMarketing": true }, "customerUserErrors": [] } } }