Create Client Portal Account (v1)
Method & Path
POST /api/v1/workspace/:workspaceId/nutrition/accounts
Description
Creates a portal login account for a nutrition client. The client will be able to login to the client portal using the provided username and password.
Authentication
Required: Workspace token with nutrition management permission.
Headers
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | Bearer <token> |
| Content-Type | Yes | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| workspaceId | string | Yes | Workspace ID |
Request Body
{
"clientId": "507f1f77bcf86cd799439011",
"username": "ahmed.mohamed",
"password": "temp123456",
"mustChangePassword": true
}
Body Fields
| Field | Type | Required | Description |
|---|---|---|---|
| clientId | string | Yes | The nutrition client ID |
| username | string | Yes | Login username (lowercase, alphanumeric, dots, underscores, hyphens) |
| password | string | Yes | Initial password (min 6 characters) |
| mustChangePassword | boolean | No | Force password change on first login (default: true) |
Response 201 Created
{
"account": {
"id": "507f1f77bcf86cd799439016",
"workspaceId": "507f1f77bcf86cd799439012",
"clientId": "507f1f77bcf86cd799439011",
"username": "ahmed.mohamed",
"status": "active",
"mustChangePassword": true,
"lastLoginAt": null,
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
}
}
Portal Login URL
After creating the account, provide the client with:
https://nutrition-portal.placio.app/{specialistSlug}/login
Where {specialistSlug} is configured in the nutrition settings.
Common Errors
- 400 Bad Request: Invalid input data
- 401 Unauthorized: Missing or invalid token
- 404 Not Found: Workspace or client not found
- 409 Conflict: Username already exists in workspace, or client already has an account