forgot-password
Method: POST
Path: /auth/forgot-password
Tags: Account recovery
Summary
Forgot password
Description
Initiates password recovery by sending an OTP. Returns an otp_token to pass to the reset-password endpoint. Asking again while the code is valid sends the same code (and otp_token); once it has expired or been used up, a new one.
Storefront SDK Usage
SDK Method: sdk.auth.forgotPassword()
Example:
typescript
// Send password reset OTP
const { data, error } = await sdk.auth.forgotPassword({
email: "[email protected]"
});
if (error) {
console.error("Password reset failed:", error.message);
} else {
console.log("OTP token:", data.otp_token);
console.log("Action:", data.otp_action);
}TypeScript Definition
typescript
"forgot-password": {
parameters: {
query?: never;
header?: {
/** @description This param is used to enable debug mode. If debug mode is enabled, the API will return OTP as well. This is only for development and testing purposes. */
"x-debug-mode"?: components["parameters"]["DebugMode"];
};
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["SendOtpWithEmail"] | components["schemas"]["SendOtpWithPhone"];
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
/** @description A descriptive message confirming the success or failure of the operation. */
message: string;
/** @description Indicates whether the request was successful or failure (true for success, false for failure). */
success: boolean;
content: components["schemas"]["OtpContent"];
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
404: components["responses"]["NotFound"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["parameters"]["DebugMode"] | DebugMode |
components["schemas"]["SendOtpWithEmail"] | SendOtpWithEmail |
components["schemas"]["SendOtpWithPhone"] | SendOtpWithPhone |
components["schemas"]["OtpContent"] | OtpContent |
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["NotFound"] | NotFound |
Parameters
- x-debug-mode (header): This param is used to enable debug mode. If debug mode is enabled, the API will return OTP as well. This is only for development and testing purposes.
Request Body
Content Types: application/json
Responses
200
OK
400
Bad request
401
Not authorized for given operation on the Resource
404
Requested resource not found
OpenAPI Definition
json
{
"tags": [
"Account recovery"
],
"operationId": "forgot-password",
"summary": "Forgot password",
"description": "Initiates password recovery by sending an OTP. Returns an `otp_token` to pass to the reset-password endpoint. Asking again while the code is valid sends the same code (and `otp_token`); once it has expired or been used up, a new one.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/forgot-password",
"description": "API reference for the forgot-password operation"
},
"parameters": [
{
"$ref": "#/components/parameters/DebugMode"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/SendOtpWithEmail"
},
{
"$ref": "#/components/schemas/SendOtpWithPhone"
}
]
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success",
"content"
],
"properties": {
"message": {
"description": "A descriptive message confirming the success or failure of the operation.",
"type": "string"
},
"success": {
"description": "Indicates whether the request was successful or failure (true for success, false for failure).",
"type": "boolean"
},
"content": {
"$ref": "#/components/schemas/OtpContent"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "auth",
"x-speakeasy-ignore": true,
"x-speakeasy-name-override": "forgotPassword"
}Auto-generated from OpenAPI spec and TypeScript definitions