Skip to content

register-with-password

Method: POST
Path: /auth/register/password

Tags: Auth

Summary

Register with password

Description

Registers a new user with email/phone and password. Returns a User object with access_token and refresh_token.

Storefront SDK Usage

SDK Method: sdk.auth.registerWithPassword()

Example:

typescript
const { data, error } = await sdk.auth.registerWithPassword({
  email: "jane.smith@example.com",
  password: "securePassword123",
  confirm_password: "securePassword123",
});

if (error) {
  console.error("Password registration failed:", error.message);
} else {
  console.log("OTP token:", data.otp_token);
  console.log("Action:", data.otp_action);
}

TypeScript Definition

typescript
"register-with-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"]["RegisterWithEmailPassword"] | components["schemas"]["RegisterWithPhonePassword"];
            };
        };
        responses: {
            /** @description OK */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        message: string;
                        success: boolean;
                        content: components["schemas"]["OtpContent"];
                    };
                };
            };
            400: components["responses"]["BadRequest"];
            401: components["responses"]["Unauthorized"];
        };
    };

Component References

ReferenceResolves To
components["parameters"]["DebugMode"]DebugMode
components["schemas"]["RegisterWithEmailPassword"]RegisterWithEmailPassword
components["schemas"]["RegisterWithPhonePassword"]RegisterWithPhonePassword
components["schemas"]["OtpContent"]OtpContent
components["responses"]["BadRequest"]BadRequest
components["responses"]["Unauthorized"]Unauthorized

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

OpenAPI Definition

json
{
  "tags": [
    "Auth"
  ],
  "operationId": "register-with-password",
  "summary": "Register with password",
  "description": "Registers a new user with email/phone and password. Returns a `User` object with `access_token` and `refresh_token`.",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/operations/register-with-password",
    "description": "API reference for the register-with-password operation"
  },
  "parameters": [
    {
      "$ref": "#/components/parameters/DebugMode"
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "oneOf": [
            {
              "$ref": "#/components/schemas/RegisterWithEmailPassword"
            },
            {
              "$ref": "#/components/schemas/RegisterWithPhonePassword"
            }
          ]
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "message",
              "success",
              "content"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "success": {
                "type": "boolean"
              },
              "content": {
                "$ref": "#/components/schemas/OtpContent"
              }
            }
          }
        }
      }
    },
    "400": {
      "$ref": "#/components/responses/BadRequest"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  },
  "security": [
    {
      "Authorization": []
    }
  ],
  "x-speakeasy-group": "auth",
  "x-speakeasy-ignore": true,
  "x-speakeasy-name-override": "registerWithPassword"
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: