> ## Documentation Index
> Fetch the complete documentation index at: https://strapi-suite.littlebox.pt/llms.txt
> Use this file to discover all available pages before exploring further.

# Customer accounts

> Register, sign in and run the customer area.

Every account route answers `403 ACCOUNTS_DISABLED` in guest only mode. None of them reveals whether an email is registered, verified or blocked, with a single exception: `EMAIL_IN_USE` on an authenticated email change.

## Account Routes at a Glance

| Method | Path | Session | Answer | Rate limit |
| - | - | - | - | - |
| POST | `/account/register` | guest | `202 { status: "VERIFICATION_SENT" }` | `account.register` |
| POST | `/account/verify-email` | guest | `200 { token, expiresAt, customer }` | `account.token` |
| POST | `/account/verify-email/resend` | none | `202 { status: "ACCEPTED" }` | `account.email` |
| POST | `/account/login` | guest | `200 { token, expiresAt, customer }` | `account.login` |
| POST | `/account/password/forgot` | none | `202 { status: "ACCEPTED" }` | `account.email` |
| POST | `/account/password/reset` | guest | `204` | `account.token` |
| POST | `/account/email/confirm` | guest or login | `204` | `account.token` |
| POST | `/account/logout` | login | `204` | `account.private` |
| GET | `/account/me` | login | profile | `account.private` |
| PUT | `/account/me` | login | profile | `account.private` |
| POST | `/account/password` | login | `200 { token, expiresAt }` | `account.password` |
| POST | `/account/email` | login | `204` | `account.password` |
| GET | `/account/orders` | login | `{ results, pagination }` | `account.private` |
| GET | `/account/orders/:publicId` | login | order | `account.private` |
| GET | `/account/sessions` | login | `{ sessions }` | `account.private` |
| DELETE | `/account/sessions/:id` | login | `204` | `account.private` |
| POST | `/account/sessions/revoke-others` | login | `204` | `account.private` |

"guest" means the route needs `X-Checkout-Session` and answers `401 SESSION_INVALID` without it. "none" means no session header is needed. Private routes without a valid login session answer `401 LOGIN_REQUIRED`. Every body must be a JSON object; unknown fields are ignored.

## Account Emails and Links

Strapi sends the account emails right away with the store's email provider. The links point to **your storefront**, never to Strapi. They live in the templates (**Settings → Email templates**) and build on `{{store.url}}` (the storefront URL, without a trailing slash) plus `{{token}}` (already URL encoded):

| Template | Default link | Token lifetime |
| - | - | - |
| Account verification | `{{store.url}}/account/verify-email?token={{token}}` | 24 hours |
| Password reset | `{{store.url}}/account/reset-password?token={{token}}` | 1 hour |
| Email change verification | `{{store.url}}/account/confirm-email?token={{token}}` | 24 hours |
| Registration attempt | `{{store.url}}/account/reset-password` (no token) | |

Each page reads `token` from the query string and posts it to the matching route. Tokens are single use. If you change your routes, ask the store owner to update the templates, in every language.

> [!TIP]
>
> Mail clients and security scanners often open links before the customer does. Do not consume the token while the
> page renders. Render a button ("Confirm my email") or post from a client effect, so a plain page load never uses
> the link.

## Account Server Actions

```ts src/app/(store)/account/actions.ts theme={null}
"use server";

import { redirect } from "next/navigation";
import { getLocale } from "next-intl/server";
import { storeFetch } from "@/lib/store/client";
import {
  readAuth,
  withSession,
  saveCustomerToken,
  dropCustomerToken,
  dropCheckoutToken,
} from "@/lib/store/session";
import { toActionError, type ActionResult } from "@/lib/store/result";
import type { AccountProfile } from "@/lib/store/types";

type LoginResult = { token: string; expiresAt: string; customer: AccountProfile };

async function startLogin(result: LoginResult) {
  await saveCustomerToken(result.token, result.expiresAt);
  // Strapi merged the guest cart into the account and retired the guest session.
  await dropCheckoutToken();
}

export async function register(_: unknown, form: FormData): Promise<ActionResult> {
  const locale = await getLocale();
  try {
    await withSession("guest", (auth) =>
      storeFetch("/account/register", {
        method: "POST",
        auth,
        body: {
          email: form.get("email"),
          password: form.get("password"),
          firstName: form.get("firstName"),
          lastName: form.get("lastName"),
          phone: form.get("phone") || undefined,
          locale,
        },
      }),
    );
  } catch (error) {
    return toActionError(error);
  }
  redirect("/account/login?registered=1");
}

export async function login(_: unknown, form: FormData): Promise<ActionResult> {
  try {
    const result = await withSession("guest", (auth) =>
      storeFetch<LoginResult>("/account/login", {
        method: "POST",
        auth,
        body: { email: form.get("email"), password: form.get("password") },
      }),
    );
    await startLogin(result);
  } catch (error) {
    return toActionError(error);
  }
  redirect("/account");
}

export async function verifyEmail(_: unknown, form: FormData): Promise<ActionResult> {
  try {
    const result = await withSession("guest", (auth) =>
      storeFetch<LoginResult>("/account/verify-email", { method: "POST", auth, body: { token: form.get("token") } }),
    );
    await startLogin(result);
  } catch (error) {
    return toActionError(error);
  }
  redirect("/account");
}

export async function logout() {
  const { customer } = await readAuth();
  if (customer) {
    try {
      await storeFetch("/account/logout", { method: "POST", auth: { customer } });
    } catch {
      // Drop the cookie anyway.
    }
  }
  await dropCustomerToken();
  redirect("/");
}

export async function changePassword(_: unknown, form: FormData): Promise<ActionResult> {
  try {
    const { customer } = await readAuth();
    const result = await storeFetch<{ token: string; expiresAt: string }>("/account/password", {
      method: "POST",
      auth: { customer },
      body: { currentPassword: form.get("currentPassword"), newPassword: form.get("newPassword") },
    });
    // The old token no longer works: store the new one.
    await saveCustomerToken(result.token, result.expiresAt);
    return { ok: true, data: undefined };
  } catch (error) {
    return toActionError(error);
  }
}
```

> [!NOTE]
>
> `login` and `verifyEmail` send only the guest session on purpose. If an old customer cookie is still around and
> Strapi answers `401 CUSTOMER_SESSION_INVALID`, `withSession` drops it and tries again.

## Register

`POST /account/register`

```json Request theme={null}
{
  "email": "jane@example.com",
  "password": "correct horse battery",
  "firstName": "Jane",
  "lastName": "Doe",
  "phone": "+351912345678",
  "locale": "en"
}
```

```json Response 202 theme={null}
{ "status": "VERIFICATION_SENT" }
```

The answer is always `202` for valid input, whatever the state of the email, so it never reveals whether someone already has an account. Behind the scenes, a new email gets an account and a verification email. A guest customer (one who only bought before) becomes a registered account and keeps its past orders. An unverified account gets the new password and a new email. A verified account changes nothing and gets a "someone tried to register" notice. A blocked customer gets nothing. Always show "Check your inbox to confirm your email".

Password rules: 10 to 128 characters (counted after Unicode NFC normalization), not equal to the email. No composition rules.

Errors: `400 invalid_email` (`email`), `400 required` (`firstName`, `lastName`, up to 100 characters each), `400 invalid` (`phone`, up to 40 characters), `400 WEAK_PASSWORD` with `details.reason` set to `TOO_SHORT`, `TOO_LONG` or `EQUALS_EMAIL`; `401 SESSION_INVALID`; `429 RATE_LIMITED`; `503 ACCOUNTS_UNAVAILABLE`.

## Verify the Email

`POST /account/verify-email`

```json Request theme={null}
{ "token": "TOKEN_FROM_THE_LINK" }
```

```json Response 200 theme={null}
{
  "token": "eyJhbGciOiJIUzI1NiJ9.YOUR_LOGIN_TOKEN",
  "expiresAt": "2027-02-25T10:00:00.000Z",
  "customer": {
    "id": 77,
    "email": "jane@example.com",
    "pendingEmail": null,
    "firstName": "Jane",
    "lastName": "Doe",
    "phone": "+351912345678",
    "locale": "en",
    "createdAt": "2026-11-27T09:58:00.000Z"
  }
}
```

A successful verification **logs the customer in**: it merges the guest cart and returns a login token. Store it and drop the guest cookie. Every failure (unknown, used, expired token, blocked customer) answers `400 TOKEN_INVALID`. Offer the resend form then.

```tsx src/app/(store)/account/verify-email/page.tsx theme={null}
import VerifyEmailForm from "./verify-email-form";

export default async function VerifyEmailPage({ searchParams }: { searchParams: Promise<{ token?: string }> }) {
  const { token } = await searchParams;
  if (!token) return <p>This link is incomplete. Request a new one from the login page.</p>;
  return <VerifyEmailForm token={token} />;
}
```

```tsx src/app/(store)/account/verify-email/verify-email-form.tsx theme={null}
"use client";

import { useActionState } from "react";
import { verifyEmail } from "../actions";

export default function VerifyEmailForm({ token }: { token: string }) {
  const [state, action, pending] = useActionState(verifyEmail, null);
  return (
    <form action={action}>
      <input type="hidden" name="token" value={token} />
      <button disabled={pending}>Confirm my email</button>
      {state && !state.ok && <p>This link is invalid or has expired. Request a new one.</p>}
    </form>
  );
}
```

## Resend the Verification Email

`POST /account/verify-email/resend` with `{ "email": "jane@example.com" }`. Always answers `202 { "status": "ACCEPTED" }`. Strapi sends an email only for a registered, unverified, unblocked account. No session needed.

## Log In

`POST /account/login`

```json Request theme={null}
{ "email": "jane@example.com", "password": "correct horse battery" }
```

The success answer has the same shape as the verify email answer. Store the token, drop the guest cookie, and reload the cart: it now holds the merged lines (same variants add up, codes are combined, and the guest's destination, shipping method, gift choices and locale win when set).

| Status | Code | When |
| - | - | - |
| 401 | `INVALID_CREDENTIALS` | Wrong email or password, a guest customer, or a blocked one. Always the same answer. |
| 403 | `EMAIL_NOT_VERIFIED` | Right password, but the email is not verified yet. Offer to resend the verification email. |
| 401 | `SESSION_INVALID` | No guest session. |
| 429 | `RATE_LIMITED` | 10 tries per minute per IP, or 5 failed tries per 15 minutes per email. |
| 503 | `ACCOUNTS_UNAVAILABLE` | Accounts are not set up on the server. |

There is no account lockout: the limits only slow down guessing.

## Forgot and Reset Password

`POST /account/password/forgot` with `{ "email": "jane@example.com" }`. Always answers `202 { "status": "ACCEPTED" }`. Strapi sends the reset email only to a registered, unblocked account (verified or not). No session needed.

`POST /account/password/reset`

```json Request theme={null}
{ "token": "TOKEN_FROM_THE_LINK", "password": "a brand new passphrase" }
```

Answers `204`. The reset also marks the email verified (the link proves ownership), **ends every login session** of the customer and sends a "password changed" email. Send the customer to the login page. Strapi checks the password rules before it uses the token, so a weak password does not burn the link.

Errors: `400 WEAK_PASSWORD` (with `reason`), `400 TOKEN_INVALID`, `401 SESSION_INVALID`, `429 RATE_LIMITED`.

Your `/account/reset-password` page serves both cases: with a `token` in the query string, show the "new password" form; without one (the link in the "registration attempt" email), show the "forgot password" form.

## Log Out

`POST /account/logout` answers `204`, also when the session was already gone. Drop the customer cookie. Open a new guest session only when the visitor needs one again.

## Profile

`GET /account/me` returns the profile (the `customer` object shown above). `pendingEmail` holds an email change that waits for confirmation.

`PUT /account/me` changes only `firstName`, `lastName`, `phone` (send `null` to clear it) and `locale`. Send only the fields you change. It returns the updated profile.

```json Request theme={null}
{ "firstName": "Janet", "phone": null, "locale": "pt" }
```

Errors: `400 required` or `too_long` (names, up to 100 characters), `400 invalid` (`phone`, up to 40 characters), `400 invalid_locale`.

## Change the Password

`POST /account/password`

```json Request theme={null}
{ "currentPassword": "correct horse battery", "newPassword": "an even better passphrase" }
```

```json Response 200 theme={null}
{ "token": "eyJhbGciOiJIUzI1NiJ9.YOUR_NEW_LOGIN_TOKEN", "expiresAt": "2027-02-25T10:00:00.000Z" }
```

**Replace the customer cookie with the new token.** The change ends every other session of the customer and sends a "password changed" email. Errors: `400 INVALID_CREDENTIALS` (wrong current password; note the `400`, not `401`), `400 WEAK_PASSWORD`, `429 RATE_LIMITED` (5 tries per 15 minutes per session).

## Change the Email

`POST /account/email`

```json Request theme={null}
{ "currentPassword": "an even better passphrase", "newEmail": "jane.doe@example.com" }
```

Answers `204`. Strapi stores the new email as pending (it shows in `pendingEmail`) and sends a confirmation link to the **new** address. A new request replaces the previous one.

Errors: `400 invalid_email` or `same_email` (`newEmail`), `400 INVALID_CREDENTIALS`, `409 EMAIL_IN_USE` (another customer has it), `429 RATE_LIMITED`.

`POST /account/email/confirm` with `{ "token": "TOKEN_FROM_THE_LINK" }`

Needs any session, guest or login, because the link can open on another device. Answers `204`. Strapi swaps the email, moves the store credits and promotion usage to the new address, ends every other login session (it keeps the current one when it belongs to that customer) and tells the old address. Errors: `400 TOKEN_INVALID`, `409 EMAIL_IN_USE`.

## Orders

`GET /account/orders?page=1&pageSize=10`

Lists the customer's orders, newest first. `pageSize` defaults to 10 and caps at 50. Each result has the [order status](https://strapi-suite.littlebox.pt/frontend/guides/ecommerce/payments.md#order-status) shape. Use `GET /orders/:publicId/status` or `POST /orders/:publicId/payment` with the login session to follow or pay any of them.

```json Response 200 theme={null}
{
  "results": [
    {
      "publicId": "3f6c1d2e-8b7a-4c1f-9e2d-5a4b3c2d1e0f",
      "reference": "#1042",
      "createdAt": "2026-11-27T10:02:11.000Z",
      "total": 4990,
      "orderStatus": "OPEN",
      "paymentStatus": "PAID",
      "paymentResult": "PAID",
      "currency": "EUR",
      "totals": { "itemsOriginal": 5000, "productDiscount": 0, "subtotal": 5000, "orderDiscount": 500, "shippingTotal": 490, "total": 4990, "paid": 4990, "due": 0 },
      "lines": [],
      "promotions": [],
      "shipping": { "name": "Standard delivery" },
      "locale": "en"
    }
  ],
  "pagination": { "page": 1, "pageSize": 10, "total": 1, "pageCount": 1 }
}
```

`GET /account/orders/:publicId` returns one order in the same shape. Another customer's order answers `404 ORDER_NOT_FOUND`.

## Sessions

`GET /account/sessions` lists the customer's live login sessions, so they can see where they are logged in:

```json Response 200 theme={null}
{
  "sessions": [
    {
      "id": 15,
      "createdAt": "2026-11-20T08:00:00.000Z",
      "lastUsedAt": "2026-11-27T10:00:00.000Z",
      "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 Safari/605.1.15",
      "ipPrefix": "203.0.113.0/24",
      "current": true
    }
  ]
}
```

`ipPrefix` keeps only the network part of the IP (IPv4 `/24`, IPv6 `/48`). `userAgent` comes from the `X-Storefront-Client-User-Agent` header you send at login.

* `DELETE /account/sessions/:id` ends one session and answers `204`. It can be the current one: then drop the cookie. A session of another customer answers `404 NOT_FOUND`.
* `POST /account/sessions/revoke-others` ends every session except the current one and answers `204`.

## Blocked Customers

The store owner can block a customer. Blocking ends all their sessions. After that, login answers `INVALID_CREDENTIALS`, the email links answer `TOKEN_INVALID`, register, resend and forgot password do nothing, and guest checkout with that email answers `403 CUSTOMER_BLOCKED`. Show a neutral message and the store's support contact.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.