> Documentation index: https://nao-rs.lukaloehr.com/llms.txt, a list of every page in this documentation.

# State

> REST API: Sensors, joints, battery, temperatures. Generated from the OpenAPI document.

## Latest full state

`GET /v1/state`

Sensors, joints (position, temperature, current), battery, IMU, sonar, foot pressure and touch, as last reported by the robot (20 per second). Units are on [Body sensors and units](https://nao-rs.lukaloehr.com/hardware/sensors.md).

**Token:** required · **Lease:** not needed

| Status | Meaning | Body |
| --- | --- | --- |
| 200 | The latest state | [RobotState](https://nao-rs.lukaloehr.com/reference/rest-api/schemas.md#robotstate) |
| 401 | Missing or wrong token | [ErrorBody](https://nao-rs.lukaloehr.com/reference/rest-api/schemas.md#errorbody) |
| 503 | No state yet | [ErrorBody](https://nao-rs.lukaloehr.com/reference/rest-api/schemas.md#errorbody) |

```bash
curl -H "Authorization: Bearer $TOKEN" http://$ROBOT:7702/v1/state
```

## Stream the state

`GET /v1/state/stream`

Server-Sent Events: one `state` event with a `RobotState` per period. Browsers can pass the token as `?access_token=`.

**Token:** required · **Lease:** not needed

| Parameter | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `rate` | query | number | no | States per second, 0.1 to 20 (default 10). (0.1 to 20) |

| Status | Meaning | Body |
| --- | --- | --- |
| 200 | Server-Sent Events, `event: state` with a `RobotState` as data | `text/event-stream` |
| 401 | Missing or wrong token | [ErrorBody](https://nao-rs.lukaloehr.com/reference/rest-api/schemas.md#errorbody) |
| 422 | Invalid rate | [ErrorBody](https://nao-rs.lukaloehr.com/reference/rest-api/schemas.md#errorbody) |
| 503 | Too many streams open | [ErrorBody](https://nao-rs.lukaloehr.com/reference/rest-api/schemas.md#errorbody) |

```bash
curl -N -H "Authorization: Bearer $TOKEN" "http://$ROBOT:7702/v1/state/stream?rate=2"
```

## Related topics

- [REST API](https://nao-rs.lukaloehr.com/reference/rest-api.md)
- [System](https://nao-rs.lukaloehr.com/reference/rest-api/system.md)
- [Robot](https://nao-rs.lukaloehr.com/reference/rest-api/robot.md)
- [Events](https://nao-rs.lukaloehr.com/reference/rest-api/events.md)
- [Safety](https://nao-rs.lukaloehr.com/reference/rest-api/safety.md)
- [Control](https://nao-rs.lukaloehr.com/reference/rest-api/control.md)
- [LEDs](https://nao-rs.lukaloehr.com/reference/rest-api/leds.md)
- [Audio](https://nao-rs.lukaloehr.com/reference/rest-api/audio.md)
- [Cameras](https://nao-rs.lukaloehr.com/reference/rest-api/cameras.md)
- [Power](https://nao-rs.lukaloehr.com/reference/rest-api/power.md)
- [Motion](https://nao-rs.lukaloehr.com/reference/rest-api/motion.md)
- [Schemas](https://nao-rs.lukaloehr.com/reference/rest-api/schemas.md)
- Previous: [Robot](https://nao-rs.lukaloehr.com/reference/rest-api/robot.md)
- Next: [Events](https://nao-rs.lukaloehr.com/reference/rest-api/events.md)
