> For the complete documentation index, see [llms.txt](https://docs.spurtcommerce.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.spurtcommerce.com/api-reference/store/authentication/customer-login-and-sessions.md).

# Customer Login And Sessions

Register, authenticate and sign out customer accounts.

## Authenticate a Store customer and return a JWT.

> Authenticate a Store customer and return a JWT.\
> \
> \*\*Authentication:\*\* Public; \`languageKey\` and \`key\` headers are documented.\
> \
> \*\*Feature area:\*\* Authentication\
> \
> \*\*Implementation source:\*\* \`src/api/store/controllers/CustomerController.ts\`\
> \
> \*\*Request example provenance:\*\* Source-defined request fields and success response structure; error wording can vary by branch.\
> \
> \*\*Response example provenance:\*\* Source-defined request fields and success response structure; error wording can vary by branch.\
> \
> \> Example is based on the linked repository source. Replace example identifiers and credentials with values from your tenant.

```json
{"openapi":"3.0.3","info":{"title":"SpurtCommerce Store API","version":"6.0.0"},"tags":[{"name":"Customer login and sessions","description":"Register, authenticate and sign out customer accounts."}],"servers":[{"url":"https://api.example.com","description":"Replace with your SpurtCommerce API host. Paths include the /api prefix."}],"security":[{"StoreKey":[]}],"components":{"securitySchemes":{"StoreKey":{"type":"apiKey","in":"header","name":"key","description":"Store key header documented on Store customer login."}}},"paths":{"/api/customer/login":{"post":{"operationId":"postApiCustomerLogin","summary":"Authenticate a Store customer and return a JWT.","description":"Authenticate a Store customer and return a JWT.\n\n**Authentication:** Public; `languageKey` and `key` headers are documented.\n\n**Feature area:** Authentication\n\n**Implementation source:** `src/api/store/controllers/CustomerController.ts`\n\n**Request example provenance:** Source-defined request fields and success response structure; error wording can vary by branch.\n\n**Response example provenance:** Source-defined request fields and success response structure; error wording can vary by branch.\n\n> Example is based on the linked repository source. Replace example identifiers and credentials with values from your tenant.","tags":["Customer login and sessions"],"parameters":[{"name":"languageKey","in":"header","required":false,"schema":{"type":"string"},"description":"languageKey request header."}],"responses":{"200":{"description":"Successful response. Source-defined request fields and success response structure; error wording can vary by branch.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"string"},"data":{"type":"object","properties":{"token":{"type":"string","writeOnly":true},"user":{"type":"object","properties":{"id":{"type":"integer"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"mobileNumber":{"type":"string"},"avatar":{"type":"string"},"avatarPath":{"type":"string"},"lockedOn":{"type":"string"}},"additionalProperties":true}},"additionalProperties":true}},"additionalProperties":true}}}},"400":{"description":"Error response example. Source-defined request fields and success response structure; error wording can vary by branch.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"message":{"type":"string"}},"additionalProperties":true}}}}},"requestBody":{"required":false,"description":"Sample request body. Source-defined request fields and success response structure; error wording can vary by branch.","content":{"application/json":{"schema":{"type":"object","properties":{"emailId":{"type":"string"},"password":{"type":"string","writeOnly":true},"type":{"type":"string"},"token":{"type":"string","writeOnly":true}},"additionalProperties":true}}}}}}}}
```

## Invalidate the current customer access token.

> Invalidate the current customer access token.\
> \
> \*\*Authentication:\*\* Customer bearer token required.\
> \
> \*\*Feature area:\*\* Authentication\
> \
> \*\*Implementation source:\*\* \`src/api/store/controllers/CustomerController.ts\`\
> \
> \*\*Request example provenance:\*\* Source-defined success example.\
> \
> \*\*Response example provenance:\*\* Source-defined success example.\
> \
> \> Example is based on the linked repository source. Replace example identifiers and credentials with values from your tenant.

```json
{"openapi":"3.0.3","info":{"title":"SpurtCommerce Store API","version":"6.0.0"},"tags":[{"name":"Customer login and sessions","description":"Register, authenticate and sign out customer accounts."}],"servers":[{"url":"https://api.example.com","description":"Replace with your SpurtCommerce API host. Paths include the /api prefix."}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Paste the JWT access token returned by the corresponding login endpoint."}}},"paths":{"/api/customer/logout":{"post":{"operationId":"postApiCustomerLogout","summary":"Invalidate the current customer access token.","description":"Invalidate the current customer access token.\n\n**Authentication:** Customer bearer token required.\n\n**Feature area:** Authentication\n\n**Implementation source:** `src/api/store/controllers/CustomerController.ts`\n\n**Request example provenance:** Source-defined success example.\n\n**Response example provenance:** Source-defined success example.\n\n> Example is based on the linked repository source. Replace example identifiers and credentials with values from your tenant.","tags":["Customer login and sessions"],"responses":{"200":{"description":"Successful response. Source-defined success example.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true}}}}}}}}}
```

## Register a Store customer after OTP verification.

> Register a Store customer after OTP verification.\
> \
> \*\*Authentication:\*\* Public; tenant validation applies.\
> \
> \*\*Feature area:\*\* Authentication\
> \
> \*\*Implementation source:\*\* \`src/api/store/controllers/CustomerController.ts\`\
> \
> \*\*Request example provenance:\*\* Request fields are from CustomerRegisterRequest; success wrapper is from the handler, with PII-safe example values.\
> \
> \*\*Response example provenance:\*\* Request fields are from CustomerRegisterRequest; success wrapper is from the handler, with PII-safe example values.\
> \
> \> Example is based on the linked repository source. Replace example identifiers and credentials with values from your tenant.

```json
{"openapi":"3.0.3","info":{"title":"SpurtCommerce Store API","version":"6.0.0"},"tags":[{"name":"Customer login and sessions","description":"Register, authenticate and sign out customer accounts."}],"servers":[{"url":"https://api.example.com","description":"Replace with your SpurtCommerce API host. Paths include the /api prefix."}],"paths":{"/api/customer/register":{"post":{"operationId":"postApiCustomerRegister","summary":"Register a Store customer after OTP verification.","description":"Register a Store customer after OTP verification.\n\n**Authentication:** Public; tenant validation applies.\n\n**Feature area:** Authentication\n\n**Implementation source:** `src/api/store/controllers/CustomerController.ts`\n\n**Request example provenance:** Request fields are from CustomerRegisterRequest; success wrapper is from the handler, with PII-safe example values.\n\n**Response example provenance:** Request fields are from CustomerRegisterRequest; success wrapper is from the handler, with PII-safe example values.\n\n> Example is based on the linked repository source. Replace example identifiers and credentials with values from your tenant.","tags":["Customer login and sessions"],"responses":{"200":{"description":"Successful response. Request fields are from CustomerRegisterRequest; success wrapper is from the handler, with PII-safe example values.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"message":{"type":"string"},"data":{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"emailId":{"type":"string"}},"additionalProperties":true}},"additionalProperties":true}}}},"400":{"description":"Error response example. Request fields are from CustomerRegisterRequest; success wrapper is from the handler, with PII-safe example values.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer"},"message":{"type":"string"}},"additionalProperties":true}}}}},"requestBody":{"required":true,"description":"Request body follows the current CustomerRegisterRequest DTO. Required fields and password constraints are taken from class-validator decorators.","content":{"application/json":{"schema":{"type":"object","properties":{"firstName":{"type":"string","maxLength":32,"description":"Required. Customer first name."},"lastName":{"type":"string","description":"Optional. Customer last name."},"companyName":{"type":"string"},"taxNumber":{"type":"string"},"password":{"type":"string","format":"password","minLength":8,"maxLength":128,"writeOnly":true,"description":"Required. At least 8 characters; must include uppercase and lowercase letters and a number or symbol."},"emailId":{"type":"string","maxLength":96,"description":"Required. Customer email address."},"otp":{"type":"integer","description":"Required. OTP sent to the email address."},"phoneNumber":{"type":"string","maxLength":15,"description":"Optional. Customer phone number."}},"additionalProperties":true,"required":["firstName","password","emailId","otp"]}}}}}}}}
```
