register-with-email
Method: POST
Path: /auth/register/email
Tags: Auth
Summary
Register with email
Description
Registers a new user with their email address. Returns a User object with 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": {
/** Format: email */
email: string;
first_name: string;
last_name?: string | null;
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": "Registers a new user with their email address. Returns a `User` object with `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": {
"type": "string",
"format": "email"
},
"first_name": {
"type": "string"
},
"last_name": {
"type": [
"string",
"null"
]
},
"phone": {
"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