Create Nutrition Client (v1)
Method & Path
POST /api/v1/workspace/:workspaceId/nutrition/clients
Description
Creates a new nutrition client in the workspace. The client will be used for tracking nutrition plans, progress, and sessions.
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
{
"name": "أحمد محمد",
"email": "ahmed@example.com",
"phone": "+972501234567",
"birthDate": "1990-05-15T00:00:00.000Z",
"gender": "male",
"height": 175,
"currentWeight": 85,
"targetWeight": 75,
"activityLevel": "moderate",
"healthConditions": ["diabetes", "high blood pressure"],
"allergies": ["peanuts", "shellfish"],
"goals": "خسارة 10 كيلو في 3 أشهر",
"notes": "يفضل الوجبات النباتية",
"tags": ["vip", "weight-loss"]
}
Body Fields
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Client's full name |
| string | No | Email address | |
| phone | string | No | Phone number |
| birthDate | string | No | ISO 8601 date |
| gender | string | No | "male" or "female" |
| height | number | No | Height in cm |
| currentWeight | number | No | Current weight in kg |
| targetWeight | number | No | Target weight in kg |
| activityLevel | string | No | sedentary, light, moderate, active, very_active |
| healthConditions | string[] | No | List of health conditions |
| allergies | string[] | No | List of allergies |
| goals | string | No | Client's nutrition goals |
| notes | string | No | Additional notes |
| tags | string[] | No | Tags for categorization |
Response 201 Created
{
"client": {
"id": "507f1f77bcf86cd799439011",
"workspaceId": "507f1f77bcf86cd799439012",
"clientId": null,
"name": "أحمد محمد",
"email": "ahmed@example.com",
"phone": "+972501234567",
"birthDate": "1990-05-15T00:00:00.000Z",
"gender": "male",
"height": 175,
"currentWeight": 85,
"targetWeight": 75,
"activityLevel": "moderate",
"healthConditions": ["diabetes", "high blood pressure"],
"allergies": ["peanuts", "shellfish"],
"goals": "خسارة 10 كيلو في 3 أشهر",
"notes": "يفضل الوجبات النباتية",
"customFields": {},
"tags": ["vip", "weight-loss"],
"avatarUrl": null,
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
}
}
Common Errors
- 400 Bad Request: Invalid input data (missing name, invalid email format)
- 401 Unauthorized: Missing or invalid token
- 403 Forbidden: Insufficient permissions
- 404 Not Found: Workspace not found