---
title: customerResetByUrl - Storefront API
description: |-
  Resets a customer's password using the reset URL from a password recovery
  email. The reset URL is generated by the [`customerRecover`](/docs/api/storefront/2026-10/mutations/customerRecover) mutation.

  On success, returns the updated
  [`Customer`](/docs/api/storefront/2026-10/objects/Customer) and a new [`CustomerAccessToken`](/docs/api/storefront/2026-10/objects/CustomerAccessToken)
  for immediate authentication.

  > Caution:
  > This mutation handles customer credentials. Ensure the new password is
  transmitted securely and never logged or exposed in client-side code.
api_version: 2026-10
source_url:
  html: https://shopify.dev/docs/api/storefront/latest/mutations/customerresetbyurl
  md: https://shopify.dev/docs/api/storefront/latest/mutations/customerresetbyurl.md
---

# customerResetByUrl

mutation

Requires `unauthenticated_write_customers` access scope.

Resets a customer's password using the reset URL from a password recovery email. The reset URL is generated by the [`customerRecover`](https://shopify.dev/docs/api/storefront/2026-10/mutations/customerRecover) mutation.

On success, returns the updated [`Customer`](https://shopify.dev/docs/api/storefront/2026-10/objects/Customer) and a new [`CustomerAccessToken`](https://shopify.dev/docs/api/storefront/2026-10/objects/CustomerAccessToken) for immediate authentication.

***

**Caution:** This mutation handles customer credentials. Ensure the new password is transmitted securely and never logged or exposed in client-side code.

***

## Arguments

* password

  [String!](https://shopify.dev/docs/api/storefront/latest/scalars/String)

  required

  New password that will be set as part of the reset password process.

* resetUrl

  [URL!](https://shopify.dev/docs/api/storefront/latest/scalars/URL)

  required

  The customer's reset password url.

***

## CustomerResetByUrlPayload returns

* customer

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

  The customer object which was reset.

* customerAccessToken

  [CustomerAccessToken](https://shopify.dev/docs/api/storefront/latest/objects/CustomerAccessToken)

  A newly created customer access token object for the customer.

* customerUserErrors

  [\[CustomerUserError!\]!](https://shopify.dev/docs/api/storefront/latest/objects/CustomerUserError)

  non-null

  The list of errors that occurred from executing the mutation.

* userErrors

  [\[UserError!\]!](https://shopify.dev/docs/api/storefront/latest/objects/UserError)

  non-nullDeprecated

  The list of errors that occurred from executing the mutation.

***

## Examples

* ### Reset a customer's password with a reset URL

  #### Description

  Set a new password for a customer with the reset URL from their password reset email, which the \`customerRecover\` mutation sends. The mutation enables the customer and returns a new customer access token that signs them in.

  #### Query

  ```graphql
  mutation customerResetByUrl($resetUrl: URL!, $password: String!) {
    customerResetByUrl(resetUrl: $resetUrl, password: $password) {
      customer {
        id
      }
      customerAccessToken {
        accessToken
        expiresAt
      }
      customerUserErrors {
        field
        message
        code
      }
    }
  }
  ```

  #### Variables

  ```json
  {
    "resetUrl": "https://cadetgear.example.com/account/reset/89322529/example-reset-token",
    "password": "b33fcake"
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/api/2026-10/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \
  -d '{
  "query": "mutation customerResetByUrl($resetUrl: URL!, $password: String!) { customerResetByUrl(resetUrl: $resetUrl, password: $password) { customer { id } customerAccessToken { accessToken expiresAt } customerUserErrors { field message code } } }",
   "variables": {
      "resetUrl": "https://cadetgear.example.com/account/reset/89322529/example-reset-token",
      "password": "b33fcake"
    }
  }'
  ```

  #### 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 customerResetByUrl($resetUrl: URL!, $password: String!) {
      customerResetByUrl(resetUrl: $resetUrl, password: $password) {
        customer {
          id
        }
        customerAccessToken {
          accessToken
          expiresAt
        }
        customerUserErrors {
          field
          message
          code
        }
      }
    }`,
    {
      variables: {
          "resetUrl": "https://cadetgear.example.com/account/reset/89322529/example-reset-token",
          "password": "b33fcake"
      },
    },
    );
    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 customerResetByUrl($resetUrl: URL!, $password: String!) {
        customerResetByUrl(resetUrl: $resetUrl, password: $password) {
          customer {
            id
          }
          customerAccessToken {
            accessToken
            expiresAt
          }
          customerUserErrors {
            field
            message
            code
          }
        }
      }`,
      "variables": {
          "resetUrl": "https://cadetgear.example.com/account/reset/89322529/example-reset-token",
          "password": "b33fcake"
      },
    },
  });
  ```

  #### Response

  ```json
  {
    "customerResetByUrl": {
      "customer": {
        "id": "gid://shopify/Customer/89322529"
      },
      "customerAccessToken": {
        "accessToken": "example-access-token",
        "expiresAt": "2026-07-13T12:00:00Z"
      },
      "customerUserErrors": []
    }
  }
  ```

* ### Return an error for an expired reset URL

  #### Description

  Try to reset a customer's password with a reset URL whose token has expired. The password isn't changed, and the mutation returns an \`INVALID\` error on the \`resetUrl\` field. Send a new password reset email with the \`customerRecover\` mutation to get a new reset URL.

  #### Query

  ```graphql
  mutation customerResetByUrl($resetUrl: URL!, $password: String!) {
    customerResetByUrl(resetUrl: $resetUrl, password: $password) {
      customer {
        id
      }
      customerUserErrors {
        field
        message
        code
      }
    }
  }
  ```

  #### Variables

  ```json
  {
    "resetUrl": "https://cadetgear.example.com/account/reset/89322529/example-reset-token",
    "password": "b33fcake"
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/api/2026-10/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \
  -d '{
  "query": "mutation customerResetByUrl($resetUrl: URL!, $password: String!) { customerResetByUrl(resetUrl: $resetUrl, password: $password) { customer { id } customerUserErrors { field message code } } }",
   "variables": {
      "resetUrl": "https://cadetgear.example.com/account/reset/89322529/example-reset-token",
      "password": "b33fcake"
    }
  }'
  ```

  #### 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 customerResetByUrl($resetUrl: URL!, $password: String!) {
      customerResetByUrl(resetUrl: $resetUrl, password: $password) {
        customer {
          id
        }
        customerUserErrors {
          field
          message
          code
        }
      }
    }`,
    {
      variables: {
          "resetUrl": "https://cadetgear.example.com/account/reset/89322529/example-reset-token",
          "password": "b33fcake"
      },
    },
    );
    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 customerResetByUrl($resetUrl: URL!, $password: String!) {
        customerResetByUrl(resetUrl: $resetUrl, password: $password) {
          customer {
            id
          }
          customerUserErrors {
            field
            message
            code
          }
        }
      }`,
      "variables": {
          "resetUrl": "https://cadetgear.example.com/account/reset/89322529/example-reset-token",
          "password": "b33fcake"
      },
    },
  });
  ```

  #### Response

  ```json
  {
    "customerResetByUrl": {
      "customer": null,
      "customerUserErrors": [
        {
          "field": [
            "resetUrl"
          ],
          "message": "Invalid reset url",
          "code": "INVALID"
        }
      ]
    }
  }
  ```

* ### customerResetByUrl reference