Troubleshooting

This guide explains how to troubleshoot common issues when using the Google Health API.

4xx client errors

4xx status codes are returned when a problem exists in the client app code. Look at the response body elements for more information about the problem.

400 Bad Request

Message Description Recommendation
Request contains an invalid argument. The data type ID {value} is not supported. Verify the data type being referenced is supported by the endpoint.
Invalid JSON payload received. Octal/hex numbers are not valid JSON values. The dailyRollUp endpoint does not support month and day values represented as MM or DD, respectfully. Single digits shouldn't have a leading 0 (zero).
Your client has issued a malformed or illegal request. Possible causes:
  • Verify the correct HTTP method is being used
  • Check the endpoint syntax for typos
Invalid project number in resource name When deleting or updating a subscriber using your Google Cloud project ID in the request URL instead of project number. This applies to webhook subscriptions using the projects.subscribers endpoint. Use your Google Cloud project number in the request URL, not the project ID.

401 Unauthorized

Message Description Recommendation
Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. INVALID_AUTHENTICATOR: Token expired Your access token has expired. Use the refresh token to obtain a new access token & refresh token, or the user should re-consent to the application.

403 Forbidden

Message Description Recommendation
The caller does not have permission When creating or listing subscribers using your Google Cloud project ID in the request URL instead of project number. This applies to webhook subscriptions using the projects.subscribers endpoint. Use your Google Cloud project number in the request URL, not the project ID.
The caller does not have permission. Could not mint UberMint from GaiaMint.

The user was able to complete the authorization flow, but the endpoint call failed. This can occur when a legacy Fitbit account consents to the app instead of a Google Account. To resolve this error:

  1. Sign out of the Fitbit mobile app through the Fitbit settings.
  2. Sign into the Fitbit mobile app either by pressing the "Continue with Google" or "Sign in with Google" button. If you receive a message that states "Can't use Fitbit with this Google Account", your email address is still registered as a legacy Fitbit account. Follow the steps in this help article to migrate your account.

404 Not Found

Message Description Recommendation
The requested URL /v4/users/me/dataTypes/{dataType}/dataPoints was not found on this server. Possible causes:
  • Verify the correct verb is being used
  • Check the endpoint syntax for typos

Retrieve a Fitbit user ID

To help troubleshoot a user issue, you may need to verify the Google Account of the user logged into the Fitbit mobile app.

To find the Fitbit user ID:

  1. Open the Fitbit mobile app.
  2. Press the You icon in the bottom right hand corner.
  3. Press the Edit profile link in the top tile containing the user's name and joined date.
  4. Go to the bottom of the page. In the section Your account, the value assigned to the ID is the Fitbit user ID. (For example: CV5TKH)

When helping a user troubleshoot their OAuth2 connection to your app, you may need them to unlink their account from your app and then complete your authorization flow again.

To unlink their Google Account from your app:

  1. Open the Fitbit mobile app.
  2. Press the Fitbit user profile icon in the upper right corner.
  3. Press Manage your Google Account.
  4. Select the tile Data & privacy.
  5. Go down to the section **Data from apps and services you use. Under Apps and services, select Third-party apps & services.
  6. Look for your app name in the list of connected apps, and have the user select it.
  7. Press Delete all connections you have with <app name>.
  8. Have the user press confirm to revoke consent to your app.

When the revoke process completes, the user will be taken back to the list of Third-party apps & services page. The user might need to refresh the page to see the app name removed from the list.

Troubleshoot device syncing delays

When debugging issues related to missing or delayed user data, it is helpful to check the user's paired device model and their last synchronization date.

The model information (such as a Fitbit tracker or smartwatch model) and last sync date are useful for troubleshooting and to fetch historical data after syncing delays.

For example, if you notice an unexpected gap or delay in data delivery:

  1. Verify that the user ID you are querying matches the user ID of the Fitbit account logged into the mobile app. To obtain the user ID in the mobile app, see Retrieve a Fitbit user ID. To obtain the user ID from the access token, call the getIdentity endpoint.
  2. Check the last sync time to determine when the user's device last synced with the Google Health mobile app.
  3. If the device has not synced recently, it indicates that the delay is likely due to the device being offline or not syncing with the mobile application, rather than an API issue.
  4. Once the user opens the mobile application and syncs their device, you can fetch historical data for the period since the last sync time.

To retrieve a user's paired device information, call the users.pairedDevices.list endpoint. This returns a list of devices containing:

  • deviceVersion: The product name or model of the device (for example, "Charge 6").
  • lastSyncTime: The timestamp of the last successful synchronization.