The SDM API is a REST API that provides various methods to
view traits and execute trait commands for management of
Google Nest devices. Use the access token granted during the
authorization process with each API call.

<br />

> [!NOTE]
> All calls to the SDM API should use the following endpoint:  
> `https://smartdevicemanagement.googleapis.com/v1`

<br />

## Traits

The SDM API uses a trait-based model for device information
and functionality. Check the individual device guides to see what traits are
available for a device:

<br />

- [Camera](https://developers.google.com/nest/device-access/api/camera)
- [Camera (battery)](https://developers.google.com/nest/device-access/api/camera-battery)
- [Camera with Floodlight](https://developers.google.com/nest/device-access/api/camera-floodlight)
- [Camera (wired)](https://developers.google.com/nest/device-access/api/camera-wired)
- [Display](https://developers.google.com/nest/device-access/api/display)
- [Doorbell](https://developers.google.com/nest/device-access/api/doorbell)
- [Doorbell (battery)](https://developers.google.com/nest/device-access/api/doorbell-battery)
- [Doorbell (wired)](https://developers.google.com/nest/device-access/api/doorbell-wired)
- [Thermostat](https://developers.google.com/nest/device-access/api/thermostat)

<br />

## Methods

See the [API Reference](https://developers.google.com/nest/device-access/reference/rest) for complete details on
all the methods available for the SDM API.

### executeCommand

Executes a command to an authorized device.

Use a `POST` call to execute a command. For example, to change the thermostat
mode:

```
POST /enterprises/project-id/devices/device-id:executeCommand
{
  "command" : "sdm.devices.commands.ThermostatMode.SetMode",
  "params" : {
    "mode" : "HEAT"
  }
}
```

Further examples of commands can be found in each individual trait reference
page. See the complete [trait listing](https://developers.google.com/nest/device-access/traits#trait_categories)
for more information.

### get

Gets information about an authorized structure or device.

A `GET` call returns a single response with current fields and values for all
traits available for a structure or device that the user has
authorized and a \`parentRelations' object, which represents the parent resource
of the current resource, either a structure or room.

For example, a Nest Thermostat might return the
following:

```
GET /enterprises/project-id/devices/device-id
{
  "name" : "enterprises/project-id/devices/device-id",
  "type" : "sdm.devices.types.THERMOSTAT",
  "assignee" : "enterprises/project-id/structures/structure-id/rooms/room-id",
  "traits" : {
    "sdm.devices.traits.Connectivity" : {
      "status" : "ONLINE"
    },
    "sdm.devices.traits.Fan" : {
      "timerMode" : "ON",
      "timerTimeout" : "2019-05-10T03:22:54Z"
    },
    "sdm.devices.traits.Humidity" : {
      "ambientHumidityPercent" : 35.0
    },
    "sdm.devices.traits.Info" : {
      "customName" : "My device"
    },
    "sdm.devices.traits.Settings" : {
      "temperatureScale" : "CELSIUS"
    },
    "sdm.devices.traits.Temperature" : {
      "ambientTemperatureCelsius" : 23.0
    },
    "sdm.devices.traits.ThermostatEco" : {
      "availableModes" : ["MANUAL_ECO", "OFF"],
      "mode" : "MANUAL_ECO",
      "heatCelsius" : 20.0,
      "coolCelsius" : 22.0
    },
    "sdm.devices.traits.ThermostatHvac" : {
      "status" : "HEATING"
    },
    "sdm.devices.traits.ThermostatMode" : {
      "availableModes" : ["HEAT", "COOL", "HEATCOOL", "OFF"],
      "mode" : "COOL"
    },
    "sdm.devices.traits.ThermostatTemperatureSetpoint" : {
      "heatCelsius" : 20.0,
      "coolCelsius" : 22.0
    }
  },
  "parentRelations" : [
    {
      "parent" : "enterprises/project-id/structures/structure-id/rooms/room-id",
      "displayName" : "Lobby"
    }
  ]
}
```

### list

Lists authorized structures, rooms, or devices.

To list all structures, rooms, or devices authorized under a single access
token, make a `GET` call against the appropriate resource endpoint:

```
GET /enterprises/project-id/structures
```

```
GET /enterprises/project-id/structures/structure-id/rooms
```

```
GET /enterprises/project-id/devices
```

## Google Assistant integrations

> [!WARNING]
> **Warning:** Nest devices in the SDM API should not be synced to Home Graph as part of a Google Assistant integration.

Once a device is authorized for SDM, Google becomes aware of the device in Home
Graph and manages its state directly. If you have Google Assistant integration
as part of your Commercial offering:

- Do not send [Request Sync
  requests](https://developers.google.com/assistant/smarthome/develop/request-sync) for SDM devices
- Omit SDM devices from any responses to a [SYNC
  intent](https://developers.google.com/assistant/smarthome/develop/process-intents#SYNC)


## Errors

See the [API Error Code Reference](https://developers.google.com/nest/device-access/reference/errors/api) for
the full list of API error codes.

<br />