|
| 1 | +--- |
| 2 | +group: graphql |
| 3 | +title: requestPasswordResetEmail mutation |
| 4 | +contributor_name: Atwix |
| 5 | +contributor_link: https://www.atwix.com/ |
| 6 | +--- |
| 7 | + |
| 8 | +The `requestPasswordResetEmail` mutation triggers the password reset email by the provided email address. Use it to initiate the process to reset the registered customer's password before calling the [resetPassword]({{page.baseurl}}/graphql/mutations/reset-password.html) mutation. |
| 9 | + |
| 10 | +## Syntax |
| 11 | + |
| 12 | +`mutation: {requestPasswordResetEmail(email: String!): Boolean}` |
| 13 | + |
| 14 | +## Example usage |
| 15 | + |
| 16 | +The following call triggers the password reset email. |
| 17 | + |
| 18 | +**Request:** |
| 19 | + |
| 20 | +```graphql |
| 21 | +mutation { |
| 22 | + requestPasswordResetEmail( |
| 23 | + email: "roni_cost@example.com" |
| 24 | + ) |
| 25 | +} |
| 26 | +``` |
| 27 | + |
| 28 | +**Response:** |
| 29 | + |
| 30 | +```json |
| 31 | +{ |
| 32 | + "data": { |
| 33 | + "requestPasswordResetEmail": true |
| 34 | + } |
| 35 | +} |
| 36 | +``` |
| 37 | + |
| 38 | +Customer will receive an email that contains a URL for resetting their password. |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +Example of `Set a New Password` button reset URL: |
| 43 | + |
| 44 | +```text |
| 45 | +https://<MAGENTOSITE>/customer/account/createPassword/?token=gh80pkjGdsPyiXc0sUUXswX1uGN7crUr |
| 46 | +``` |
| 47 | + |
| 48 | +## Input arguments |
| 49 | + |
| 50 | +You must specify the customer's email address in the `email` input argument. |
| 51 | + |
| 52 | +## Output attributes |
| 53 | + |
| 54 | +The `requestPasswordResetEmail` mutation returns `true` if both of the following operations are successful: |
| 55 | + |
| 56 | +- The reset password operation initiates. |
| 57 | +- Magento sends an email containing a reset link. |
| 58 | + |
| 59 | +Otherwise, the mutation returns `false`. |
| 60 | + |
| 61 | +## Errors |
| 62 | + |
| 63 | +Error | Description |
| 64 | +--- | --- |
| 65 | +`Cannot reset the customer's password` | A general error message that appears on some internal system errors. The original error is logged and can be found in the Magento logs. |
| 66 | +`The account is locked` | You cannot modify a locked customer account. |
| 67 | +`The email address has an invalid format.` | The value provided in the `email` argument has an invalid format. |
| 68 | +`You must specify an email address.` | An empty value is provided in the `email` argument. |
| 69 | + |
| 70 | +## Related topics |
| 71 | + |
| 72 | +* [resetPassword mutation]({{page.baseurl}}/graphql/mutations/reset-password.html) |
0 commit comments