> ## Documentation Index
> Fetch the complete documentation index at: https://viewerdocs.planpoint.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Portal authentication

> Sign up, log in, validate and revoke sessions, and reset a buyer password.

All paths below use the [API base URL and access labels](https://viewerdocs.planpoint.io/api-documentation/portal/overview.md#base-url-and-credentials). Examples are synthetic.

## Sign up

`POST /api/portal/signup` — **Public**

| JSON field | Required | Description |
| - | - | - |
| `projectId` | One scope | Project ID. Use this or `groupId`. |
| `groupId` | One scope | Group ID. Use this or `projectId`. |
| `email` | Yes | Valid email address, stored lowercase. |
| `password` | Yes | At least 6 characters. |
| Additional form fields | No | Top-level fields such as `firstName` and `lastName` are sanitized and stored in the buyer's `data` object. |

```json Request theme={null}
{
  "projectId": "000000000000000000000001",
  "email": "buyer@example.com",
  "password": "<BUYER_PASSWORD>",
  "firstName": "Example",
  "lastName": "Buyer"
}
```

```json Response (201) theme={null}
{
  "message": "Signup successful",
  "token": "<PORTAL_TOKEN>",
  "email": "buyer@example.com",
  "id": "000000000000000000000003"
}
```

Creates the scoped buyer and a seven-day session. Errors include `400` for invalid input or an already-registered email in that scope, `403` when Portal is disabled, `404` when the entity is missing, and `429` when rate-limited.

## Log in

`POST /api/portal/login` — **Public**

Send `email`, a nonempty `password`, and either `projectId` or `groupId`.

```json Request theme={null}
{
  "projectId": "000000000000000000000001",
  "email": "buyer@example.com",
  "password": "<BUYER_PASSWORD>"
}
```

```json Response (200) theme={null}
{
  "message": "Login successful",
  "token": "<PORTAL_TOKEN>"
}
```

Invalid credentials, a missing entity, and disabled Portal all return `401` with `"Invalid e-mail / password / project combination"`. Invalid input returns `400`; rate limiting returns `429`.

## Check session

`GET /api/portal/check-session` — **Portal buyer**

Send either `projectId` or `groupId` in the query string.

```bash theme={null}
curl 'https://app.planpoint.io/api/portal/check-session?projectId=000000000000000000000001' \
  -H 'Authorization: Bearer <PORTAL_TOKEN>'
```

```json Response (200) theme={null}
{
  "message": "Session valid",
  "data": {
    "projectId": "000000000000000000000001",
    "userId": "000000000000000000000003",
    "iat": 1795737600,
    "exp": 1796342400,
    "aud": "planpoint:portal"
  }
}
```

`data` is the decoded session payload; a group session has `groupId` instead of `projectId`. Do not depend on additional JWT claims.

Missing scope returns `400`. An expired, revoked, or invalid token returns `401`; a scope mismatch returns `401` with `"Not logged in to this viewer"`.

## Log out

`POST /api/portal/logout` — **Portal token**

Send the Portal bearer header; no JSON fields are required. The server deletes that token's session. Remove your local copy after success.

```json Response (200) theme={null}
{ "message": "Logout successful" }
```

Logout is idempotent: an already-removed or expired token can still be submitted. A missing token returns `401`; a server failure returns `500`.

## Request a password reset

`POST /api/portal/forgot-password` — **Public**

Send `email` and either `projectId` or `groupId`. Optional `hostURL` requests a reset link back to the embedded experience.

```json Request theme={null}
{
  "projectId": "000000000000000000000001",
  "email": "buyer@example.com"
}
```

```json Response (200) theme={null}
{
  "message": "If an account with that email exists, a reset link has been sent."
}
```

The same response is used when no matching buyer exists. A missing project or group returns `404`. Other errors include `400`, `429`, and `500`.

Reset links expire after one hour. A supplied `hostURL` must have a trusted origin associated with the signup or entity custom domain; otherwise the link uses the Planpoint Viewer. HTTPS is required except for local development. This call can send email.

## Reset password

`POST /api/portal/reset-password` — **Reset token**, not a Portal session token

| JSON field | Required | Description |
| - | - | - |
| `token` | Yes | Nonempty reset token from the email link. |
| `newPassword` | Yes | At least 6 characters. |
| `confirmPassword` | Yes | Must match `newPassword`. |

```json Request theme={null}
{
  "token": "<RESET_TOKEN>",
  "newPassword": "<NEW_BUYER_PASSWORD>",
  "confirmPassword": "<NEW_BUYER_PASSWORD>"
}
```

```json Response (200) theme={null}
{
  "message": "Password reset successful",
  "token": "<NEW_PORTAL_TOKEN>",
  "user": {
    "_id": "000000000000000000000003",
    "email": "buyer@example.com",
    "firstName": "Example",
    "lastName": "Buyer"
  }
}
```

Names are omitted if not stored. Success consumes the reset token and creates a new seven-day Portal session. Use the returned token for subsequent requests. Invalid or expired reset tokens and mismatched passwords return `400`; rate limiting returns `429`.


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