Download OpenAPI specification:
Manage remote access sessions to IoT devices on the SmartTouch Cloud Platform.
A session is an authenticated tunnel opened through the Remote Access Service between a client (developer, platform engineer, administrator, or automation) and a device's Remote Access Agent.
POST /remote-access/sessions → session.opened (audit event)
↓ (session active)
DELETE /remote-access/sessions/{id} → session.closed (audit event)
Sessions also close automatically when their TTL expires, producing a
session.expired audit event.
| Protocol | Minimum role | Description |
|---|---|---|
diagnostics |
developer | Read-only diagnostic commands |
shell |
platform-engineer | Full interactive shell on the device |
file-transfer |
administrator | Upload and download files |
Returns remote access sessions. Developers see only their own sessions. Administrators see sessions for all users.
| device_id | string Example: device_id=sensor-001 Filter sessions by device ID |
| protocol | string Enum: "shell" "diagnostics" "file-transfer" Filter sessions by protocol |
| status | string Enum: "open" "closed" Filter sessions by status |
| since | string <date-time> Example: since=2026-06-08T00:00:00Z Return sessions opened after this ISO 8601 timestamp |
| page | integer >= 1 Default: 1 |
| per_page | integer [ 1 .. 200 ] Default: 50 |
{- "status": 200,
- "data": [
- {
- "id": "sess-7f3a1b",
- "device_id": "sensor-001",
- "protocol": "diagnostics",
- "status": "open",
- "user": "alice@example.com",
- "opened_at": "2026-06-08T09:00:00Z",
- "expires_at": "2026-06-08T10:00:00Z",
- "closed_at": null,
- "trace_id": "abc123def456"
}
], - "meta": {
- "page": 1,
- "per_page": 50,
- "total": 1
}
}Opens a new remote access session to a device.
The device's Remote Access Agent must be online. Verify agent status with
GET /devices/{deviceId}/agent-status before calling this endpoint.
Only one session per protocol per device can be open at a time. If a session
of the requested protocol is already open, the endpoint returns 409 Conflict.
On success, the response includes a websocket_url. Use this URL to connect
a WebSocket client for interactive sessions. stctl remote-access open handles
this automatically.
| device_id required | string Target device ID |
| protocol required | string Enum: "shell" "diagnostics" "file-transfer" Session protocol. Determines the level of access granted.
|
| ttl_seconds | integer [ 60 .. 28800 ] Default: 3600 Session time-to-live in seconds. The session closes automatically when the TTL elapses. |
{- "device_id": "sensor-001",
- "protocol": "diagnostics",
- "ttl_seconds": 1800
}{- "status": 201,
- "data": {
- "id": "sess-9c4d2e",
- "device_id": "sensor-001",
- "protocol": "diagnostics",
- "status": "open",
- "user": "alice@example.com",
- "opened_at": "2026-06-08T09:05:00Z",
- "expires_at": "2026-06-08T09:35:00Z",
- "closed_at": null,
- "websocket_url": "wss://broker.smarttouch.local:8443/sessions/sess-9c4d2e",
- "trace_id": "xyz789abc012"
}
}Returns details for a single session, including its current status, byte counters, and the trace ID for log correlation.
| sessionId required | string Example: sess-9c4d2e Unique session identifier (e.g., |
{- "status": 200,
- "data": {
- "id": "sess-9c4d2e",
- "device_id": "sensor-001",
- "protocol": "diagnostics",
- "status": "open",
- "user": "alice@example.com",
- "opened_at": "2026-06-08T09:05:00Z",
- "expires_at": "2026-06-08T09:35:00Z",
- "closed_at": null,
- "bytes_sent": 4096,
- "bytes_received": 2048,
- "trace_id": "xyz789abc012"
}
}Closes an open session immediately. The device agent terminates the tunnel
within 5 seconds. A session.closed event is written to the audit log.
Closing an already-closed session returns 404 Not Found.
| sessionId required | string Example: sess-9c4d2e Unique session identifier (e.g., |
{- "status": 200,
- "data": {
- "id": "sess-9c4d2e",
- "status": "closed",
- "closed_at": "2026-06-08T09:18:44Z"
}
}