# connected: connection log

> A record each time a device connects to or disconnects from the cloud.

The `connected` table is a log of the device's connection to the cloud. Use it to see when a sensor was online, or to find the last time it was heard from.

## Fields

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Device ID. |
| `time` | integer | Time of the event, Unix milliseconds, UTC. |
| `datetime` | string | Same time in ISO 8601, UTC. |
| `isConnected` | boolean | `true` when the device connected and `false` when it disconnected. Absent on records that don't say. |

Records may carry other columns from the connection event. They are passed through as they are.

## Last time a device connected

```bash
curl -s "https://api.semitronica.pt/asense/v2/?table_name=connected&id=ASENSE00000005&start_time=0&end_time=1893456000000&ascending=false&limit=1" \
  -H "x-api-key: $ASENSE_API_KEY"
```

`ascending=false` and `limit` both work on this table. `merge`, `output_format` and `timestamps_only` have no effect on it.

Source page: https://asense.semitronica.pt/docs/data-model/connected/
