Syncing User Data

Batch Queries are one way to keep you user's information up-to-date. For best practices, see [Keeping User Data Up-to-date](🔗).

Only available for Wellness

Batch Queries are currently not available for the Medical API

To make your data synchronization tasks more efficient you can take advantage of the batch query capabilities of the [Application level API](🔗) . This allows you to synchronize the data for all of the users of your app in one query per data type. You need to use the `updated_since` query parameter and keep track of the last query time so that you can retrieve only the data that has been updated since the last time you queried.

# Endpoints

Base URL

Individual Endpoints

These endpoints replicate those available for the individual user queries. The payload data model is the same for individual and batch queries, except the batch query results return data for multiple users so you need to parse the data accordingly.

Although [we recommend](🔗) using [Notifications](🔗) in tandem with batch queries, in some cases developers rely solely on batch queries for data synchronization. If you do so, it is recommended that you run the queries frequently to avoid accumulating a lot of data resulting in huge payloads and longer response times. A good role of thumb is to run your query as often as required to avoid having to paginate your queries.

Updated_since is Required

Do not perform regular batch queries without the `updated_since` query parameter. By supplying `updated_since` with your last query time, you can ensure that your queries are quick and efficient.

  • If `updated_since` is not specified, you will only get 24 hours of updated data. Additionally, the maximum amount of time that can be queried by batch will be 31 days.

  • To pull all of your application’s data, you will need to use a combination of `updated_since` and `updated_before` to pull data for time intervals no greater than 31 days per query.

# Authentication

Authentication for Batch Queries is the same as that for the [Application API](🔗). Instead of user accessTokens, which authorize access to an individual user's data, you will need to use your `App Key` to authorize the request on behalf of your full application. The `App Key` should be sent sent as the username of your request with the password left blank. See the example below for what this looks like:

# Example GET Query

Using curl command line:

An example activity payload is shown below. It is the same format as the standard endpoint except each record can have a different `humanId`:


The default number of results returned per query is 50 and the max is 500 by setting a higher `limit`. You can paginate through the rest of the results based on the documentation [here](🔗).