Develop Nutrition and Hydration Experiences with Google Health API

The Google Health API provides data types for tracking a user's nutrition and hydration. These types allow you to log meals, reference foods from the food database, track nutrient quantities, and log liquid intake.

Supported data types

Table: Google Health API Nutrition data types
Data type
  dataType
  filter parameter
Available
operations
Scope
Food
food
food
Record type: Food
list, get .nutrition.readonly
.nutrition.writeonly
Food Measurement Unit
food-measurement-unit
food_measurement_unit
Record type: Food

Compatible devices

list, get .nutrition.readonly
.nutrition.writeonly
Hydration Log
hydration-log
hydration_log
Record type: Session
list, get, reconcile, rollup, dailyRollup, create, update, batchDelete .nutrition.readonly
.nutrition.writeonly
Nutrition Log
nutrition-log
nutrition_log
Record type: Sample

Compatible devices

list, get, reconcile, rollup, dailyRollup, create, update, batchDelete .nutrition.readonly
.nutrition.writeonly

Nutrition Log

A Nutrition Log represents food logged by a user. There are two ways to create a nutrition log, depending on the food type:

  1. Identified food: Set the food field to reference an existing Food resource. The nutrients, energy, energyFromFat, totalCarbohydrate, totalFat, and foodDisplayName fields are populated automatically from the referenced food. This is the preferred method.

  2. Anonymous food: Set the foodDisplayName field manually and provide values for nutrients, energy, energyFromFat, totalCarbohydrate, and totalFat. Nutrition logs created from anonymous food are not editable after creation.

Create a nutrition log with anonymous food

To create a nutrition log entry, send a POST request to the nutrition-log dataPoints endpoint.

Request

POST https://health.googleapis.com/v4/users/me/dataTypes/nutrition-log/dataPoints
Authorization: Bearer access-token
Content-Type: application/json

{
  "nutritionLog": {
    "interval": {
      "startTime": "2026-06-16T18:00:00Z",
      "endTime": "2026-06-16T18:30:00Z"
    },
    "foodDisplayName": "Grilled Chicken Breast",
    "mealType": "DINNER",
    "energy": {
      "kcal": 165
    },
    "totalCarbohydrate": {
      "grams": 0
    },
    "totalFat": {
      "grams": 3.6
    },
    "nutrients": [
      {
        "nutrient": "PROTEIN",
        "quantity": {
          "grams": 31
        }
      },
      {
        "nutrient": "SODIUM",
        "quantity": {
          "grams": 0.074
        }
      }
    ],
    "serving": {
      "amount": 1.0
    }
  }
}

Response

{
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.devicesandservices.health.v4.DataPoint",
    "name": "users/user-id/dataTypes/nutrition-log/dataPoints/data-point-id",
    "dataSource": {
      "recordingMethod": "UNKNOWN",
      "application": {
        "googleWebClientId": "google-web-client-id"
      },
      "platform": "GOOGLE_WEB_API"
    },
    "nutritionLog": {
      "interval": {
        "startTime": "2026-06-16T18:00:00Z",
        "startUtcOffset": "0s",
        "endTime": "2026-06-16T18:30:00Z",
        "endUtcOffset": "0s",
        "civilStartTime": {
          "date": {
            "year": 2026,
            "month": 6,
            "day": 16
          },
          "time": {
            "hours": 18
          }
        },
        "civilEndTime": {
          "date": {
            "year": 2026,
            "month": 6,
            "day": 16
          },
          "time": {
            "hours": 18,
            "minutes": 30
          }
        }
      },
      "energy": {
        "kcal": 165
      },
      "totalCarbohydrate": {
        "grams": 0
      },
      "totalFat": {
        "grams": 3.6
      },
      "nutrients": [
        {
          "quantity": {
            "grams": 31
          },
          "nutrient": "PROTEIN"
        },
        {
          "quantity": {
            "grams": 0.074
          },
          "nutrient": "SODIUM"
        }
      ],
      "mealType": "DINNER",
      "serving": {
        "amount": 1
      },
      "foodDisplayName": "Grilled Chicken Breast"
    }
  }
}

Create a nutrition log with identified food

To log a food item from the food database, set the food field to reference a Food resource. The API populates nutritional fields automatically.

Request:

POST https://health.googleapis.com/v4/users/me/dataTypes/nutrition-log/dataPoints
Authorization: Bearer access-token
Content-Type: application/json

{
  "nutritionLog": {
    "interval": {
      "startTime": "2026-06-16T12:00:00Z",
      "endTime": "2026-06-16T12:30:00Z"
    },
    "food": "users/me/dataTypes/food/dataPoints/food-id",
    "mealType": "LUNCH",
    "serving": {
      "amount": 1.0
    }
  }
}

Delete nutrition logs

To delete one or more nutrition log entries, send a POST request to the batchDelete method with the resource names of the entries to remove.

Request:

POST https://health.googleapis.com/v4/users/me/dataTypes/nutrition-log/dataPoints:batchDelete
Authorization: Bearer access-token
Content-Type: application/json

{
  "names": [
    "users/me/dataTypes/nutrition-log/dataPoints/data-point-id"
  ]
}

NutritionLog fields

For a complete list of fields and descriptions, see the Reference Documentation.

EnergyQuantity

Represents an energy measurement, measured in kilocalories (kcal). For details, see EnergyQuantity.

{
  "kcal": 165
}

WeightQuantity

Represents a weight measurement, measured in grams. For details, see WeightQuantity.

{
  "grams": 27.3
}

NutrientQuantity

Represents a specific nutrient and its measured quantity. For details, see NutrientQuantity.

{
  "nutrient": "PROTEIN",
  "quantity": {
    "grams": 31
  }
}

Nutrient values

For a complete list of supported nutrient types, see Nutrient.

Serving

Represents the serving information for a nutrition log entry. For details, see Serving.

{
  "amount": 1.5
}

MealType values

For a complete list of supported meal types, see MealType.

Food

Food is a read-only data type that represents a food item in the food database. Use the list and get operations to browse available foods and retrieve their nutritional information.

List foods

To list foods, send a GET request to the food dataPoints endpoint:

GET https://health.googleapis.com/v4/users/me/dataTypes/food/dataPoints
Authorization: Bearer access-token
Accept: application/json

Food Measurement Unit

Food Measurement Unit is a read-only data type that represents measurement units used for food servings (for example, "cup", "tablespoon", or "piece").

List available measurement units

To list available measurement units:

GET https://health.googleapis.com/v4/users/me/dataTypes/food-measurement-unit/dataPoints
Authorization: Bearer access-token
Accept: application/json

Hydration Log

A Hydration Log represents liquid logged by a user. Unlike foods, which reference a Food database and measure nutrient or energy intake, hydration entries track the specific volume of liquid consumed over a given time interval.

Create a hydration log

To create a hydration log entry, send a POST request to the hydration-log dataPoints endpoint. All volume quantities are converted to milliliters in the API format.

Request

POST https://health.googleapis.com/v4/users/me/dataTypes/hydration-log/dataPoints
Authorization: Bearer access-token
Content-Type: application/json

{
  "hydrationLog": {
    "interval": {
      "startTime": "2026-06-16T14:00:00Z",
      "endTime": "2026-06-16T14:00:01Z"
    },
    "amountConsumed": {
      "milliliters": 500,
      "userProvidedUnit": "FLUID_OUNCE_US"
    }
  }
}

Response

{
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.devicesandservices.health.v4.DataPoint",
    "name": "users/user-id/dataTypes/hydration-log/dataPoints/data-point-id",
    "dataSource": {
      "recordingMethod": "UNKNOWN",
      "application": {
        "googleWebClientId": "google-web-client-id"
      },
      "platform": "GOOGLE_WEB_API"
    },
    "hydrationLog": {
      "interval": {
        "startTime": "2026-06-16T14:00:00Z",
        "startUtcOffset": "0s",
        "endTime": "2026-06-16T14:00:01Z",
        "endUtcOffset": "0s",
        "civilStartTime": {
          "date": {
            "year": 2026,
            "month": 6,
            "day": 16
          },
          "time": {
            "hours": 14
          }
        },
        "civilEndTime": {
          "date": {
            "year": 2026,
            "month": 6,
            "day": 16
          },
          "time": {
            "hours": 14,
            "seconds": 1
          }
        }
      },
      "amountConsumed": {
        "milliliters": 500,
        "userProvidedUnit": "FLUID_OUNCE_US"
      }
    }
  }
}

Update a hydration log

To update a hydration log entry, send a PATCH request to the hydration-log dataPoints endpoint with the ID of the data point.

Request

PATCH https://health.googleapis.com/v4/users/me/dataTypes/hydration-log/dataPoints/data-point-id
Authorization: Bearer access-token
Content-Type: application/json

{
  "hydrationLog": {
    "interval": {
      "startTime": "2026-06-16T10:00:00Z",
      "endTime": "2026-06-16T10:00:01Z"
    },
    "amountConsumed": {
      "milliliters": 500
    }
  }
}

Response

{
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.devicesandservices.health.v4.DataPoint",
    "name": "users/user-id/dataTypes/hydration-log/dataPoints/data-point-id",
    "dataSource": {
      "recordingMethod": "UNKNOWN",
      "application": {
        "googleWebClientId": "google-web-client-id"
      },
      "platform": "GOOGLE_WEB_API"
    },
    "hydrationLog": {
      "interval": {
        "startTime": "2026-06-16T10:00:00Z",
        "startUtcOffset": "0s",
        "endTime": "2026-06-16T10:00:01Z",
        "endUtcOffset": "0s",
        "civilStartTime": {
          "date": {
            "year": 2026,
            "month": 6,
            "day": 16
          },
          "time": {
            "hours": 10
          }
        },
        "civilEndTime": {
          "date": {
            "year": 2026,
            "month": 6,
            "day": 16
          },
          "time": {
            "hours": 10,
            "seconds": 1
          }
        }
      },
      "amountConsumed": {
        "milliliters": 500
      }
    }
  }
}

Delete hydration logs

To delete one or more hydration log entries, send a POST request to the batchDelete method.

Request

POST https://health.googleapis.com/v4/users/me/dataTypes/hydration-log/dataPoints:batchDelete
Authorization: Bearer access-token
Content-Type: application/json

{
  "names": [
    "users/me/dataTypes/hydration-log/dataPoints/data-point-id"
  ]
}

Response

{
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.devicesandservices.health.v4.BatchDeleteDataPointsResponse",
    "dataPoints": [
      {
        "name": "users/user-id/dataTypes/hydration-log/dataPoints/data-point-id",
        "dataSource": {
          "recordingMethod": "UNKNOWN",
          "application": {
            "googleWebClientId": "google-web-client-id"
          },
          "platform": "GOOGLE_WEB_API"
        },
        "hydrationLog": {
          "interval": {
            "startTime": "2026-06-16T14:00:00Z",
            "startUtcOffset": "0s",
            "endTime": "2026-06-16T14:00:01Z",
            "endUtcOffset": "0s",
            "civilStartTime": {
              "date": {
                "year": 2026,
                "month": 6,
                "day": 16
              },
              "time": {
                "hours": 14
              }
            },
            "civilEndTime": {
              "date": {
                "year": 2026,
                "month": 6,
                "day": 16
              },
              "time": {
                "hours": 14,
                "seconds": 1
              }
            }
          },
          "amountConsumed": {
            "milliliters": 500,
            "userProvidedUnit": "FLUID_OUNCE_US"
          }
        }
      }
    ]
  }
}

HydrationLog fields

For a complete list of fields and descriptions, see the Reference Documentation.

VolumeQuantity

Represents a volume measurement, measured in milliliters. For details, see VolumeQuantity.

{
  "milliliters": 250,
  "userProvidedUnit": "MILLILITER"
}

VolumeUnit values

For a complete list of supported volume units, see VolumeUnit. Common values include MILLILITER, LITER, CUP_US, and FLUID_OUNCE_US.

Guidelines

  • Use identified food when possible. The API populates nutritional fields automatically, reducing errors and ensuring consistency with the food database.
  • Nutrition logs created from anonymous food cannot be updated after creation. If you need to correct an anonymous food log, delete it and create a new one.
  • Unlike anonymous food nutrition logs, hydration log entries are fully mutable and can be updated after creation using a PATCH request.
  • All nutrient quantities in the nutrients array use grams as the unit of measurement.
  • The energy and energyFromFat fields use kilocalories (kcal) as the unit of measurement.
  • The API converts and stores all hydration quantities in milliliters. The optional userProvidedUnit field in VolumeQuantity is only used for client-side user-facing display.
  • Direct HTTP DELETE requests to individual hydration-log data points return 404 Not Found. Use the batchDelete method to remove these resource entries.
  • Hydration logs use a short interval where the startTime and endTime represent the period of time in which the liquid was consumed.