Skip to main content
PUT
/
api
/
profile
Update Profile
curl --request PUT \
  --url https://api.example.com/api/profile \
  --header 'Content-Type: application/json' \
  --data '
{
  "goal": "<string>",
  "height": 123,
  "weight": 123,
  "body_type": "<string>",
  "gender": "<string>",
  "meals_per_day": 123,
  "activity_level": "<string>",
  "birth_date": "<string>",
  "body_fat_percentage": 123,
  "calories_target": 123,
  "protein_target": 123,
  "carbs_target": 123,
  "fat_target": 123,
  "tastes": [
    {
      "id": 123,
      "name": "<string>"
    }
  ],
  "restrictions": [
    {
      "id": 123,
      "name": "<string>"
    }
  ],
  "diet_types": [
    {}
  ]
}
'
{
  "id": 123,
  "user_id": 123,
  "goal": "<string>",
  "height": 123,
  "weight": 123,
  "body_type": "<string>",
  "gender": "<string>",
  "meals_per_day": 123,
  "activity_level": "<string>",
  "birth_date": "<string>",
  "body_fat_percentage": 123,
  "calories_target": 123,
  "protein_target": 123,
  "carbs_target": 123,
  "fat_target": 123,
  "tastes": [
    {}
  ],
  "restrictions": [
    {}
  ],
  "diet_types": [
    {}
  ],
  "422 Unprocessable Entity": {},
  "401 Unauthorized": {}
}

Authentication

This endpoint requires authentication. Include a valid JWT token in the Authorization header:
Authorization: Bearer <token>

Request Body

goal
string
required
User’s fitness goalAllowed values: lose_weight, maintain_weight, gain_weight
height
float
required
User’s height in centimetersConstraints: Must be between 140 and 220 cm
weight
float
required
User’s weight in kilogramsConstraints: Must be between 35 and 300 kg
body_type
string
required
User’s body typeAllowed values: lean, normal, stocky, obese
gender
string
required
User’s genderAllowed values: male, female
meals_per_day
integer
required
Number of meals per dayConstraints: Must be between 1 and 6
activity_level
string
required
User’s physical activity levelAllowed values: low, medium, high
birth_date
string
required
User’s birth date in ISO format (YYYY-MM-DD)Constraints: User must be between 16 and 100 years old
body_fat_percentage
float
User’s body fat percentageConstraints: Must be >= 0.0
calories_target
float
User’s daily calorie targetConstraints: Must be >= 0.0
protein_target
float
User’s daily protein target in gramsConstraints: Must be >= 0.0
carbs_target
float
User’s daily carbohydrate target in gramsConstraints: Must be >= 0.0
fat_target
float
User’s daily fat target in gramsConstraints: Must be >= 0.0
tastes
array
default:[]
List of user’s taste preferences
id
integer
ID of existing taste category (optional for updates)
name
string
required
Name of the taste category (will be converted to lowercase)
restrictions
array
default:[]
List of user’s dietary restrictions
id
integer
ID of existing restriction category (optional for updates)
name
string
required
Name of the restriction (will be converted to lowercase)
diet_types
array
default:[]
List of user’s diet type preferencesAllowed values: high_protein, low_carb, vegan, vegetarian, low_calorie, high_fiber, high_carb

Response

Returns the complete profile object with the same structure as the Get Profile endpoint.
id
integer
required
Profile ID
user_id
integer
required
Associated User ID
goal
string
required
User’s fitness goal
height
float
required
User’s height in centimeters
weight
float
required
User’s weight in kilograms
body_type
string
required
User’s body type
gender
string
required
User’s gender
meals_per_day
integer
required
Number of meals per day
activity_level
string
required
User’s activity level
birth_date
string
required
User’s birth date
body_fat_percentage
float
User’s body fat percentage
calories_target
float
User’s target calories
protein_target
float
User’s target protein in grams
carbs_target
float
User’s target carbs in grams
fat_target
float
User’s target fat in grams
tastes
array
List of taste preferences
restrictions
array
List of dietary restrictions
diet_types
array
List of diet types

Example Request

curl -X PUT "https://api.smarteat.com/api/profile" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "goal": "lose_weight",
    "height": 175.0,
    "weight": 80.5,
    "body_type": "normal",
    "gender": "male",
    "meals_per_day": 4,
    "activity_level": "medium",
    "birth_date": "1990-05-15",
    "body_fat_percentage": 18.5,
    "calories_target": 2200.0,
    "protein_target": 165.0,
    "carbs_target": 220.0,
    "fat_target": 73.0,
    "tastes": [
      {"name": "spicy"},
      {"name": "savory"}
    ],
    "restrictions": [
      {"name": "lactose intolerance"}
    ],
    "diet_types": ["high_protein"]
  }'

Example Response

{
  "id": 1,
  "user_id": 42,
  "goal": "lose_weight",
  "height": 175.0,
  "weight": 80.5,
  "body_type": "normal",
  "gender": "male",
  "meals_per_day": 4,
  "activity_level": "medium",
  "birth_date": "1990-05-15",
  "body_fat_percentage": 18.5,
  "calories_target": 2200.0,
  "protein_target": 165.0,
  "carbs_target": 220.0,
  "fat_target": 73.0,
  "tastes": [
    {
      "id": 1,
      "name": "spicy"
    },
    {
      "id": 3,
      "name": "savory"
    }
  ],
  "restrictions": [
    {
      "id": 2,
      "name": "lactose intolerance"
    }
  ],
  "diet_types": [
    {
      "id": 5,
      "name": "high_protein"
    }
  ]
}

Error Responses

422 Unprocessable Entity
error
Validation error - invalid field values
{
  "detail": [
    {
      "loc": ["body", "height"],
      "msg": "ensure this value is greater than or equal to 140",
      "type": "value_error.number.not_ge"
    }
  ]
}
401 Unauthorized
error
Authentication token is missing or invalid
{
  "detail": "Not authenticated"
}

Notes

  • This endpoint performs an upsert operation - it will create a new profile if one doesn’t exist, or update the existing profile
  • All names in tastes and restrictions arrays are automatically converted to lowercase
  • The birth_date is validated to ensure the user is between 16 and 100 years old
  • Diet types must be one of the predefined enum values

Build docs developers (and LLMs) love