Google Home
Google Home Local API
This is an unofficial documentation of the local API used by the Home app to communicate with GH devices.
Getting Started
Requests must be made over HTTPS, port 8443, so the base URL for these endpoints is: https://<google-home-ip>:8443/setup/
Get the IP of Google Home from the Google Home app (Device Settings -> End of the list) or from your router.
GET requests are simple, in the browser kind.
POST requests need to set the header (when there's a body): content-type: application/json
Authentication
Since June 2019, most requests (with exceptions like /setup/eureka_info) need a local authorization token.
There are 3 kinds of tokens involved here:
Local Authorization Token
This token must be sent in all requests in the header cast-local-authorization-token. It is short-lived (~1 day) and may change unexpectedly (with a sync, change in homegraph, etc.)
Get this token
- With access to an android device, .
- Without a device, or to integrate it with a script, use an access token to get the homegraph and extract the token. To get an access token, read the next section. Check the example section for more info.
Access Token
This is a standard google oauth2 access token. It is in the form ya29.***.
This gives access to the Google Home Foyer API. These expire in an hour.
Use this to get the homegraph (and then the local authorization token above).
Get this token
To get this access token, either a Google account username/password or a Google Master Token is needed. More info in the gist. Use the script .
Master Token
This is in the form aas_et/*** and can be used to request access tokens.
Get this token
The same that gets the access token can also get the master token. Needs Google account creds.
Example
Here's the whole flow from just a pair of username/password to using the local API.
Prerequisites:
- (preserve folder structure)
1. Get an access token with the script
- Download get_tokens.py
- Fill in username and password
2. Use the access token and get home graph
- This prints the json and uses jq to parse and filter out the fields deviceName and localAuthToken
- This will give a list of all devices and their local auth tokens
3. Make the call to the local device using the local auth token
python3 get_tokens.py# Note down the access token printed../grpcurl -H 'authorization: Bearer ya29.a0Af****' \ -import-path /path/to/protos \ -proto /path/to/protos/google/internal/home/foyer/v1.proto \ googlehomefoyer-pa.googleapis.com:443 \ google.internal.home.foyer.v1.StructuresService/GetHomeGraph | jq '.home.devices[] | {deviceName, localAuthToken}'# Note down the local auth token for the device you want.curl -H "cast-local-authorization-token: LOCAL_AUTH_TOKEN" --verbose --insecure https://192.168.0.18:8443/setup/bluetooth/status- Homepage
- https://api.apis.guru/v2/specs/google.home/2.0.json
- Provider
- google.home
- OpenAPI version
- 3.0.0
- Spec (JSON)
- https://api.apis.guru/v2/specs/google.home/2.0/openapi.json
- Spec (YAML)
- https://api.apis.guru/v2/specs/google.home/2.0/openapi.yaml
Tools (32)
Extracted live via the executor SDK.
-
assistant.accessibilityThis controls Accessibility sounds.
hotword_enabledis for 'Play start sound' andendpoint_enabledis for 'Play end sound'.
Sending an empty-body POST request returns the current values.
Either of the fields or both can be sent and new values will be saved. -
assistant.alarmVolumeThis gets and sets alarms and timers volume.
Note: This is not the same as normal volume.Volume is a float number in [0, 1] where 0 is minimum and 1 is maximum.
Sending an empty body gets the volume. Sendingvolumesets the volume. -
assistant.deleteAlarmsandTimersThis deletes alarms and timers by their id.
idsis a list of ids to be deleted. Sending invalid id still returns a 200 OK. The/in the ids have to be escaped like\/. -
assistant.doNotDisturbThis is for the Do Not Disturb option. Sending an empty-body POST returns the current value. Sending a new value changes it.
-
assistant.getAlarmsandTimersThis gives a list of all active alarms and timers.
Both alarms and timers have
ids which can be used to delete them. (There is no known way of creating/deleting yet). The value ofstatushave different meanings for alarms and timers (given below).Alarms have
date_patternandtime_patternwith day, month, year, hour, minute, second.fire_timeis the same in unix time (milliseconds, not seconds).
statusis 1 for set up and 2 for ringing.Timers have
original_durationis the original duration.
statusis 1 for set up and 3 for ringing. -
assistant.setEqualizerValuesThis can only set new equalizer values. To get already set values, use /setup/eureka_info.
The body is mandatory. It can either contain
low_shelforhigh_shelfor both.low_shelf.gain_dbandhigh_shelf.gain_dbrefer to bass and treble respectively.Default values are 0 for both.
While the slider in the Home app only ranges from -6 to +6, they can be set to any integer like 50 or -100. These changes persist. -
bluetooth.changeDiscoverabilitySee note for Bluetooth under
/setup/bluetooth/statusFor Part 1 only
This enables/disables Home's bluetooth discovery and other devices can pair with Home (where Home acts as a speaker).
-
bluetooth.forgetpaireddeviceSee note for Bluetooth under
/setup/bluetooth/statusFor both parts
This is to forget paired devices by mac address. Works for both kinds of devices (Part 1 and Part 2).
-
bluetooth.getPairedDevicesSee note for Bluetooth under
/setup/bluetooth/statusFor both parts
This gives a list of all paired or 'bonded' devices. The response field names are self-descriptive.
-
bluetooth.getScanResultsSee note for Bluetooth under
/setup/bluetooth/statusFor Part 2 only
This returns a list of all nearby bluetooth devices. While the Home app only shows speakers, this list contains all devices including TVs, mobiles, etc.
rssiis signal strength,nameis name,mac_addressis mac address.
device_classanddevice_typeare bluetooth codes.The Home app only lists those devices with
expected_profiles> 0. Basically, the device should function as a speaker. -
bluetooth.pairwithSpeakerSee note for Bluetooth under
/setup/bluetooth/statusFor Part 2 only
This pairs with other bluetooth speakers by mac address.
-
bluetooth.scanfordevicesSee note for Bluetooth under
/setup/bluetooth/statusFor Part 2 only
This initiates scan for other bluetooth speakers/devices. Scan results will be updated continuously for
timeoutseconds.
To get the scan results, see /setup/bluetooth/scan_results. -
bluetooth.statusThere are 2 parts of Bluetooth.
Part 1: Devices like phones connect to Home and play audio through Home.
For this, /setup/bluetooth/discovery is used to make Home discoverable. Then devices can connect to it as if Home is just another bluetooth speaker.Part 2: Bluetooth speakers connect to Home and Home plays audio through the speakers. For this, /setup/bluetooth/scan and /setup/bluetooth/scan_results are used to connect to other speakers.
The other endpoints are common for both parts.
For both parts
This gives the status of all bluetooth things.
- Not sure what
audio_modeis. discovery_enabledstates whether Home is discoverable. (Part 1)connecting_devicesis a list of all media sources (like phones) connected to Home. (Part 1)scanning_enabledstates whether Home scanning for other bluetooth speakers/devices. (Part 2)connected_devicesis a list of all speakers connected to Home. (Part 2)
- Not sure what
-
deviceInfo.appDeviceIdThis gives "app device id", "certificate" and "signed data".
Theapp_idin the request is mandatory and refers to Chromecast backdrop/screensaver app. It has to be set toE8C28D3C.The certificate is valid and issued by
Chromecast ICA 6 (Audio Assist), Google Inc.Not sure what the other two are.
-
deviceInfo.checkReadyStatusUpdate: This seems to have changed now and is no longer possible. The error is also new.
Setting
play_ready_messageto true plays a welcome message on the device saying "Hi, I'm your Google Assistant. I'm here to help. To learn a few things you can do, continue in the Google Home app." -
deviceInfo.eurekaInfoThis gives most of the device info. The GET parameter
paramis a comma separated list of json keys to fetch. Currently, these params are known:version,audio,name,build_info,detail,device_info,net,wifi,setup,settings,opt_in,opencast,multizone,proxy,night_mode_params,user_eq,room_equalizer,sign,aogh,ultrasound,meshNested items can also be filtered using the dot notation. Example:
audio.digitalThe
optionsGET parameter is always set todetailordetail,sign.signsigns thenonceand returns some value.The
nonceGET parameter is an integer value signed with needed (seeoptionparameter above). -
deviceInfo.localesSimply returns a list of all supported locales.
-
deviceInfo.offerThis gives a token which is used by the Home app to get offers. The offers themselves are not stored on the device.
A new token is generated for every request. -
deviceInfo.testInternetDownloadSpeedUpdate: This seems to have been removed. Returns 404 Not Found.
This endpoint tests internet download speed. Any sample file URL can be provided.
-
deviceInfo.timezonesSimply returns a list of all supported timezones.
-
deviceSettings.nightModesettingsThis sets night mode options.
To view currently set values, use /setup/eureka_info.
Ifenabledis set to false, night mode is disabled and the other values do not matter.
led_brightnessandvolumerefer to the maximum LED Brightness and Volume that is set during night mode.
demo_to_useris always set totrueso change in values will be visible in realtime (like brightness).
windows: A combination oflength_hoursandstart_houris used to define start and end times for night mode. In this example, night mode starts at 10 PM (22) and ends at 6 AM (8 hours later).windows.daysis an array of days of week when night mode will be enabled. Example: 0->Sunday, 1-> Monday, ..., 6->Saturday. -
deviceSettings.rebootandFactoryResetThis can simply reboot the device (
params: "now") or factory reset the device (params: "fdr"). -
deviceSettings.setEurekaInfoThis can set custom values to some options.
Only fields to be modified need to be sent, not all. The example has some modifiable fields.
TODO: List all modifiable fields.
Sending non-existant fields will still return a 200 OK, but they are not saved.
-
staticFiles.chromecastIconUpdate: This no longer exists. It's not useful, anyway.
A redirect to
http://www.gstatic.com/eureka/images/eureka_device.png -
staticFiles.legalNoticeAll licenses of programs used by Home.
-
wifi.connecttoWiFiNetworkNote: Not sure how the password is encrypted. Might be using the public certificate from /setup/eureka_info. So this cannot be used as of now. If someone figures it out, please .
-
wifi.forgetWiFiNetworkThis is to forget a saved network by
wpa_id. Get thewpa_idfrom /setup/configured_networks -
wifi.getSavedNetworksThis gets a list of all saved Wi-Fi networks.
Each network has
ssid,wpa_auth,wpa_cipherandwpa_id.
wpa_idis an incrementing number used to identify a saved network.
#TODO: Add values forwpa_authandwpa_cipher. -
wifi.getWiFiScanResultsThis gets a list of all nearby Wi-Fi access points.
The list only has the connected AP by default. Once a scan is triggered by
/setup/scan_wifi, the whole list is cached for ~3 minutes. Then it will revert to returning only the connected AP again. -
wifi.scanforNetworksThis initiates scanning for Wi-Fi networks.
The results can be obtained with
/setup/scan_resultsafter triggering the scan with this request. -
openapi.previewSpecPreview an OpenAPI document before adding it as a source
-
openapi.addSourceAdd an OpenAPI source and register its operations as tools