--- title: customerAccessTokenCreate - Storefront API description: | Creates a customer access token. The customer access token is required to modify the customer object in any way. api_version: 2025-10 api_name: storefront type: mutation api_type: graphql source_url: html: https://shopify.dev/docs/api/storefront/latest/mutations/customerAccessTokenCreate md: https://shopify.dev/docs/api/storefront/latest/mutations/customerAccessTokenCreate.md --- # customer​Access​Token​Create mutation Requires `unauthenticated_write_customers` access scope. Creates a customer access token. The customer access token is required to modify the customer object in any way. ## Arguments * input [Customer​Access​Token​Create​Input!](https://shopify.dev/docs/api/storefront/latest/input-objects/CustomerAccessTokenCreateInput) required The fields used to create a customer access token. *** ## Customer​Access​Token​Create​Payload returns * customer​Access​Token [Customer​Access​Token](https://shopify.dev/docs/api/storefront/latest/objects/CustomerAccessToken) The newly created customer access token object. * customer​User​Errors [\[Customer​User​Error!\]!](https://shopify.dev/docs/api/storefront/latest/objects/CustomerUserError) non-null The list of errors that occurred from executing the mutation. * user​Errors [\[User​Error!\]!](https://shopify.dev/docs/api/storefront/latest/objects/UserError) non-nullDeprecated The list of errors that occurred from executing the mutation. *** ## Examples * ### Create a customer access token #### Description Creates a unique customer access token that's required to read and modify the \[Customer]\(https\://shopify.dev/api/storefront/latest/objects/customer) object. #### Query ```graphql mutation customerAccessTokenCreate { customerAccessTokenCreate(input: {email: "ghaida@example.com", password: "7dx2gx2Z"}) { customerAccessToken { accessToken } customerUserErrors { message } } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \ -d '{ "query": "mutation customerAccessTokenCreate { customerAccessTokenCreate(input: {email: \"ghaida@example.com\", password: \"7dx2gx2Z\"}) { customerAccessToken { accessToken } customerUserErrors { message } } }" }' ``` #### 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 customerAccessTokenCreate { customerAccessTokenCreate(input: {email: "ghaida@example.com", password: "7dx2gx2Z"}) { customerAccessToken { accessToken } customerUserErrors { message } } }`, ); 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: `mutation customerAccessTokenCreate { customerAccessTokenCreate(input: {email: "ghaida@example.com", password: "7dx2gx2Z"}) { customerAccessToken { accessToken } customerUserErrors { message } } }`, }); ``` #### Response ```json { "customerAccessTokenCreate": { "customerAccessToken": { "accessToken": "ghaidas_token" }, "customerUserErrors": [] } } ``` * ### Get a customer by customer access token #### Description Retrieves the customer with the associated access token and returns the customer fields specified in the query. #### Query ```graphql query { customer(customerAccessToken: "bobs_token") { id firstName lastName acceptsMarketing email phone } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \ -d '{ "query": "query { customer(customerAccessToken: \"bobs_token\") { id firstName lastName acceptsMarketing email phone } }" }' ``` #### 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 query { customer(customerAccessToken: "bobs_token") { id firstName lastName acceptsMarketing email phone } }`, ); 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 { customer(customerAccessToken: "bobs_token") { id firstName lastName acceptsMarketing email phone } }`, }); ``` #### Response ```json { "customer": { "id": "gid://shopify/Customer/410535040", "firstName": "John", "lastName": "Smith", "acceptsMarketing": false, "email": "johnsmith@example.com", "phone": "+16134504533" } } ``` * ### customerAccessTokenCreate reference [Open in GraphiQL](http://localhost:3457/graphiql?query=mutation%20customerAccessTokenCreate%20%7B%0A%20%20customerAccessTokenCreate\(input%3A%20%7Bemail%3A%20%22ghaida%40example.com%22%2C%20password%3A%20%227dx2gx2Z%22%7D\)%20%7B%0A%20%20%20%20customerAccessToken%20%7B%0A%20%20%20%20%20%20accessToken%0A%20%20%20%20%7D%0A%20%20%20%20customerUserErrors%20%7B%0A%20%20%20%20%20%20message%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D) ```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 customerAccessTokenCreate { customerAccessTokenCreate(input: {email: "ghaida@example.com", password: "7dx2gx2Z"}) { customerAccessToken { accessToken } customerUserErrors { message } } }`, ); const json = await response.json(); return json.data; } ``` ## Response JSON ```json { "customerAccessTokenCreate": { "customerAccessToken": { "accessToken": "ghaidas_token" }, "customerUserErrors": [] } } ```