Request Sync

Request Sync triggers a SYNC request to your fulfillment for any Google user with devices that have the specified agentUserId associated with them (which you sent in the original SYNC request). This allows you to update users' devices without unlinking and relinking their account. All users linked to this identifier will receive a SYNC request.

You should trigger a SYNC request:

  • If the user adds a new device.
  • If the user removes an existing device.
  • If the user renames an existing device.
  • If the user change a device location such as rooms (only if your application supports this).
  • If you implement a new device type, trait, or add a new device feature.

Get started

To implement Report State:

Enable the API and download credentials

Do the following to implement Request Sync:

  1. In the Cloud Platform Console, go to the Projects page. Select the project that matches your smart home project id.

  2. Enable the Google HomeGraph API.

  3. Generate an API key. From the left navbar, select Credentials under APIs & Services. Click the Create Credentials button and select API key. Copy the API key for later use.

Call the API

Use the API key mentioned above and the agentUserId in your request. Here's an example of how to make the request in the command line using curl, as a test:

curl -i -s -X POST -H "Content-Type: application/json" -d "{agentUserId: \"agentUserId\", async: true}" ""

Code sample


const {smarthome} = require('actions-on-google');
const app = smarthome({
  key: '123ABC'
// ...
// New device is added for user
  .then((res) => {
    // Request sync was successful
  .catch((res) => {
    // Request sync failed


In order to run the Java sample, you must have a service account key.
private void onDeviceAdded() throws IOException {
    FileInputStream stream = new FileInputStream("service-account-key.json");
    GoogleCredentials credentials = GoogleCredentials.fromStream(stream);

    RequestSyncDevicesResponse response = mySmartHomeApp.requestSync("user-123");


#!/usr/bin/env python

# Copyright 2018 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# See the License for the specific language governing permissions and
# limitations under the License.

import argparse
import json

import requests
from six.moves import urllib

def request_sync(api_key, agent_user_id):
    url = '' + api_key
    data = {"agentUserId": agent_user_id};

    response =, json=data)

    print 'Response: ' + response.text

    return response.status_code ==

def main(api_key, agent_user_id):
    if (request_sync(api_key, agent_user_id)):
        print 'Request Sync has been done successfully.'
        print 'Request Sync failed. Please check the log above.'

if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        help='The api key downloaded from Google Cloud Platform Console.')
        help='The unique user ID on the agent\'s platform which returned in the SYNC response.')

    args = parser.parse_args()

    main(args.api_key, args.agent_user_id)

Error responses

See these possible responses to understand what you may receive back from Google upon making a Request Sync request.