login-pos-device-with-email
Method: POST
Path: /pos/auth/login/email
Tags: Authentication
Summary
Login with email
Description
Login to POS device using email. Login to POS device using phone. The endpoint requires authentication with an API key that has the scope set to 'storefront' for a particular store, ensuring secure access for user login operation. 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.
Pos SDK Usage
SDK Method: pos.loginWithEmail()
Example:
const { data, error } = await pos.loginWithEmail({
location_id: "pos-location-123",
email: "staff@example.com"
});
if (error) {
console.error("Login failed:", error.message);
} else {
console.log("OTP sent:", data.otp_token);
console.log("Action:", data.otp_action);
// Use the otp_token to verify OTP
}TypeScript Definition
"login-pos-device-with-email": {
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": {
location_id: string;
/** Format: email */
email: string;
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: string;
success: boolean;
content: {
otp_token: string;
/** @constant */
otp_action: "login";
/** @description Returned only in test environments when the request sends `X-Debug-Mode: true`. */
otp?: string;
};
};
};
};
400: components["responses"]["BadRequest"];
/** @description The user has no role at this location. */
401: components["responses"]["Unauthorized"];
/** @description The API key is missing or invalid. */
403: components["responses"]["Forbidden"];
500: components["responses"]["InternalServerError"];
504: components["responses"]["GatewayTimeout"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["parameters"]["DebugMode"] | DebugMode |
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["Forbidden"] | Forbidden |
components["responses"]["InternalServerError"] | InternalServerError |
components["responses"]["GatewayTimeout"] | GatewayTimeout |
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
Authentication failed. Codes include token-required, token-expired and token_not_valid for an invalid or expired token.
403
Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.
500
The request failed because of an unexpected error.
504
The request timed out.
OpenAPI Definition
{
"operationId": "login-pos-device-with-email",
"summary": "Login with email",
"description": "Login to POS device using email. Login to POS device using phone. The endpoint requires authentication with an API key that has the scope set to 'storefront' for a particular store, ensuring secure access for user login operation. 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.",
"parameters": [
{
"$ref": "#/components/parameters/DebugMode"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"location_id": {
"type": "string",
"maxLength": 128,
"minLength": 1
},
"email": {
"type": "string",
"format": "email"
}
},
"required": [
"location_id",
"email"
]
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
},
"content": {
"properties": {
"otp_token": {
"type": "string"
},
"otp_action": {
"type": "string",
"const": "login"
},
"otp": {
"description": "Returned only in test environments when the request sends `X-Debug-Mode: true`.",
"type": "string"
}
},
"required": [
"otp_token",
"otp_action"
],
"type": "object"
}
},
"required": [
"message",
"success",
"content"
]
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"description": "The user has no role at this location.",
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"description": "The API key is missing or invalid.",
"$ref": "#/components/responses/Forbidden"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
},
"504": {
"$ref": "#/components/responses/GatewayTimeout"
}
},
"externalDocs": {
"url": "https://llm-docs.commercengine.io/admin-pos/operations/login-pos-device-with-email"
},
"security": [
{
"X-Api-Key": []
}
],
"tags": [
"Authentication"
],
"x-speakeasy-group": "pos",
"x-speakeasy-name-override": "loginWithEmail"
}Auto-generated from OpenAPI spec and TypeScript definitions