register-with-email
Method: POST
Path: /auth/register/email
Tags: Auth
Summary
Register with email
Description
The API allows users to register with their email address. This endpoint enables the registration process by requesting the user's email, first name, last name, phone number. The response will include a message indicating the success or failure of the registration process, as well as additional information such as the user's information, access token and refresh token.
Storefront SDK Usage
SDK Method: sdk.auth.registerWithEmail()
Example:
typescript
// Register a new user with email address
const { data, error } = await sdk.auth.registerWithEmail({
email: "jane.smith@example.com",
first_name: "Jane",
last_name: "Smith",
phone: "9876543210"
});
if (error) {
console.error("Email registration failed:", error.message);
} else {
console.log("Registration successful:", data.user.email);
console.log("User ID:", data.user.id);
console.log("Access token:", data.access_token);
}TypeScript Definition
typescript
"register-with-email": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": {
/** @description A string representing the email address. */
email: string;
/** @description A string representing the first name. */
first_name: string;
/** @description A string representing the last name. */
last_name?: string | null;
/** @description A string representing the phone number. */
phone?: string | null;
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
/** @description A descriptive message confirming the success or failure of the Registration process. */
message: string;
/** @description Indicates whether the request was successful or failure (true for success, false for failure). */
success: boolean;
/** @description An object containing the response content. */
content: {
/** @description An object representing user details. */
user: components["schemas"]["User"];
/** @description It is a string-based token utilized for authentication and authorization. */
access_token: string;
/** @description It is a string-based token designed for refreshing the user's access token. */
refresh_token: string;
};
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["schemas"]["User"] | User |
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
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-email",
"summary": "Register with email",
"description": "The API allows users to register with their email address. This endpoint enables the registration process by requesting the user's email, first name, last name, phone number.\nThe response will include a message indicating the success or failure of the registration process, as well as additional information such as the user's information, access token and refresh token.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/register-with-email",
"description": "API reference for the register-with-email operation"
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"email",
"first_name"
],
"properties": {
"email": {
"description": "A string representing the email address.",
"type": "string"
},
"first_name": {
"description": "A string representing the first name.",
"type": "string"
},
"last_name": {
"description": "A string representing the last name.",
"type": [
"string",
"null"
]
},
"phone": {
"description": "A string representing the phone number.",
"type": [
"string",
"null"
]
}
}
}
}
}
},
"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 Registration process.",
"type": "string"
},
"success": {
"description": "Indicates whether the request was successful or failure (true for success, false for failure).",
"type": "boolean"
},
"content": {
"description": "An object containing the response content.",
"properties": {
"user": {
"description": "An object representing user details.",
"$ref": "#/components/schemas/User"
},
"access_token": {
"description": "It is a string-based token utilized for authentication and authorization.",
"type": "string"
},
"refresh_token": {
"description": "It is a string-based token designed for refreshing the user's access token.",
"type": "string"
}
},
"required": [
"user",
"access_token",
"refresh_token"
],
"type": "object"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "auth",
"x-speakeasy-ignore": true,
"x-speakeasy-name-override": "registerWithEmail"
}Auto-generated from OpenAPI spec and TypeScript definitions