Skip to content

Bash / Shell Examples – Health Fitness API

You can access Health Fitness API directly from your terminal or scripts using curl.


1. GET Request Example

curl -X GET "https://api.hefitapi.com/api/v1/bmi?height=178&weight=82&units=metric&lang=en" \
  -H "X-API-Key: YOUR_API_KEY"

2. POST Request Example

curl -X POST "https://api.hefitapi.com/api/v1/bmi/post?lang=en" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{"height":178,"weight":82,"units":"metric"}'

3. GET Request with Custom Headers and Output Formatting

curl -s -X GET "https://api.hefitapi.com/api/v1/tdee?weight=82&height=178&age=34&gender=male&activity_level=moderately_active&lang=en" \
  -H "X-API-Key: YOUR_API_KEY" | jq

jq can be used to pretty-print JSON responses.


4. POST Request with JSON Payload from File

curl -X POST "https://api.hefitapi.com/api/v1/fitness/meal-timing/post?lang=en" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d @payload.json

payload.json contains your JSON body, e.g.:

{"goal":"fat_loss","training_time":"morning","fasting_style":"16_8"}

Other Languages

Explore how to integrate Health Fitness API in other programming languages:

Start integrating Health Fitness API into your Bash scripts today!


Health Fitness API Powering modern digital health infrastructure