# Method: devices.reportStateAndNotification

- [HTTP request](https://developers.home.google.com/reference/home-graph/rest/v1/devices/reportStateAndNotification#body.HTTP_TEMPLATE)
- [Request body](https://developers.home.google.com/reference/home-graph/rest/v1/devices/reportStateAndNotification#body.request_body)
  - [JSON representation](https://developers.home.google.com/reference/home-graph/rest/v1/devices/reportStateAndNotification#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.home.google.com/reference/home-graph/rest/v1/devices/reportStateAndNotification#body.response_body)
  - [JSON representation](https://developers.home.google.com/reference/home-graph/rest/v1/devices/reportStateAndNotification#body.ReportStateAndNotificationResponse.SCHEMA_REPRESENTATION)
- [Authorization Scopes](https://developers.home.google.com/reference/home-graph/rest/v1/devices/reportStateAndNotification#body.aspect)
- [StateAndNotificationPayload](https://developers.home.google.com/reference/home-graph/rest/v1/devices/reportStateAndNotification#StateAndNotificationPayload)
  - [JSON representation](https://developers.home.google.com/reference/home-graph/rest/v1/devices/reportStateAndNotification#StateAndNotificationPayload.SCHEMA_REPRESENTATION)
- [ReportStateAndNotificationDevice](https://developers.home.google.com/reference/home-graph/rest/v1/devices/reportStateAndNotification#ReportStateAndNotificationDevice)
  - [JSON representation](https://developers.home.google.com/reference/home-graph/rest/v1/devices/reportStateAndNotification#ReportStateAndNotificationDevice.SCHEMA_REPRESENTATION)

Reports device state and optionally sends device notifications. Called by your smart home Action when the state of a third-party device changes or you need to send a notification about the device. See [Implement Report State](https://developers.home.google.com/cloud-to-cloud/integration/report-state) for more information.

This method updates the device state according to its declared [traits](https://developers.home.google.com/cloud-to-cloud/primer/device-types-and-traits). Publishing a new state value outside of these traits will result in an `INVALID_ARGUMENT` error response.

The third-party user's identity is passed in via the `agentUserId` (see `ReportStateAndNotificationRequest`). This request must be authorized using service account credentials from your Actions console project.

### HTTP request

`POST https://homegraph.googleapis.com/v1/devices:reportStateAndNotification`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "requestId": string, "eventId": string, "agentUserId": string, "followUpToken": string, "payload": { object (`https://developers.home.google.com/reference/home-graph/rest/v1/devices/reportStateAndNotification#StateAndNotificationPayload`) } } ``` |

| Fields ||
|---|---|
| `requestId` | `string` Request ID used for debugging. |
| `eventId` | `string` Unique identifier per event (for example, a doorbell press). |
| `agentUserId` | `string` Required. Third-party user ID. |
| `followUpToken (deprecated)` | `string` Deprecated. |
| `payload` | ``object (`https://developers.home.google.com/reference/home-graph/rest/v1/devices/reportStateAndNotification#StateAndNotificationPayload`)`` Required. State of devices to update and notification metadata for devices. |

### Response body

If successful, the response body contains data with the following structure:
Response type for the [`devices.reportStateAndNotification`](https://developers.home.google.com/reference/home-graph/rest/v1/devices/reportStateAndNotification#google.home.graph.v1.HomeGraphApiService.ReportStateAndNotification) call.

| JSON representation |
|---|
| ``` { "requestId": string } ``` |

| Fields ||
|---|---|
| `requestId` | `string` Request ID copied from `ReportStateAndNotificationRequest`. |

### Authorization Scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/homegraph`

For more information, see the [OAuth 2.0 Overview](https://developers.google.com/identity/protocols/OAuth2).

## StateAndNotificationPayload

Payload containing the state and notification information for devices.

| JSON representation |
|---|
| ``` { "devices": { object (`https://developers.home.google.com/reference/home-graph/rest/v1/devices/reportStateAndNotification#ReportStateAndNotificationDevice`) } } ``` |

| Fields ||
|---|---|
| `devices` | ``object (`https://developers.home.google.com/reference/home-graph/rest/v1/devices/reportStateAndNotification#ReportStateAndNotificationDevice`)`` The devices for updating state and sending notifications. |

## ReportStateAndNotificationDevice

The states and notifications specific to a device.

| JSON representation |
|---|
| ``` { "states": { object }, "notifications": { object } } ``` |

| Fields ||
|---|---|
| `states` | ``object (`https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Struct` format)`` States of devices to update. See the **Device STATES** section of the individual trait [reference guides](https://developers.home.google.com/cloud-to-cloud/traits). |
| `notifications` | ``object (`https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Struct` format)`` Notifications metadata for devices. See the **Device NOTIFICATIONS** section of the individual trait [reference guides](https://developers.home.google.com/cloud-to-cloud/traits). |