Data types

Google Fit provides a set of health and wellness data types under the namespace.

Data types define the format of the values inside data points. A data point can represent:

  • An instantaneous reading or observation
  • An aggregate with statistics over a time interval

Google Fit defines data types for instantaneous observations and data types for aggregate data. Data points consist of values for the fields of a data type and timestamp information. Points that represent instantaneous observations include a timestamp, and points of an aggregate data type also include the start time for the interval.

Google Fit also lets you define new data types.

Data type groups

Google Fit has these data types:

Public data types
Standard data types provided by the platform have the '' prefix. For example, These data types capture instant readings for health and wellness data, including fitness activity, sleep and nutrition. Any app can request the relevant permissions to read and write to these data types, except for a few location data types which can only be read by the app that wrote them.

For more information, see:

Restricted data types
Data types provided by the platform that have restricted access due to potentially sensitive data. For more information, see Restricted data types.
Aggregate data types
Data types to read health and wellness information aggregated by time or activity type. For more information, see Aggregate data types.
Private custom data types
Custom data types defined by a specific app. Only the app that defines the data type can read and write data of this type. For more information, see Custom data types.

Using data types


On Android, data types are defined as public fields of the DataType class. How you invoke the Fitness APIs with the data type depends on what you want to accomplish:

  • To record data, use the Recording API to create a subscription for each data type you want to record.
  • To read data, use the History API to submit a read request for each data type.
  • To insert historical data from the past, use the History API to submit an insert request for each data type.
  • To create sessions, use the Sessions API to insert or record data with session metadata.

To create data points for an instaneous DataType object, assign values with the correct format. The following example shows you how to assign the food item as a string, the meal type as a constant from the Field class, and nutrient contents as mapped float values by calling the setKeyValue() method.

DataSource nutritionSource = new DataSource.Builder()

Map<String, Float> nutrients = new HashMap<>();
nutrients.put(Field.NUTRIENT_TOTAL_FAT, 0.4f);
nutrients.put(Field.NUTRIENT_SODIUM, 1f);
nutrients.put(Field.NUTRIENT_POTASSIUM, 422f);
DataPoint banana =
        .setTimestamp(now.getMillis(), TimeUnit.MILLISECONDS)
        .setField(Field.FIELD_FOOD_ITEM, "banana")
        .setField(Field.FIELD_MEAL_TYPE, Field.MEAL_TYPE_SNACK)
        .setField(Field.FIELD_NUTRIENTS, nutrients)

After setting data points in your app, you can insert, read, or delete historical data with the [History API (/fit/android/history).


The dataSources resource includes the data type (and a list of its fields) for each data source. You can specify one of these data types when you create data sources, and you can obtain the name of the data type and a list of its fields when you retrieve a data source from the fitness store.

For example, a data source representation specifies its data type as follows:

"dataStreamId": "exampleDataSourceId",
"dataType": {
  "name": ""