> ## Documentation Index
> Fetch the complete documentation index at: https://usenaive.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Device Relay (SSE)

> Device-token authenticated. One outbound SSE the box holds open to receive relayed events.

The box opens **one** outbound Server-Sent Events stream and holds it. The
control plane relays durable `device_events` down it — claim/provision
notifications and `trigger.wake` events for box-resident agents. The stream
replays anything after `Last-Event-ID`, then streams live, with a 25s heartbeat.
Device-token authenticated.

This is the box's inbound path **without any inbound ports**: the box dials out
and keeps the connection open. Sensitive payloads (inbound mail/SMS routed to a
box-resident agent) are sealed to the device's X25519 key before they are stored
or relayed.

<RequestExample>
  ```bash theme={"theme":"css-variables"}
  curl -N https://api.usenaive.ai/v1/devices/self/events \
    -H "Authorization: Bearer <device_token>" \
    -H "Accept: text/event-stream" \
    -H "Last-Event-ID: 128"
  ```
</RequestExample>

<ResponseExample>
  ```
  id: 129
  event: trigger.wake
  data: {"delivery_id":"td_01H...","source":"email","sealed":true,"payload":"<ciphertext>"}

  : heartbeat 1720471200
  ```
</ResponseExample>

<Note>
  Once the box's local runtime accepts a wake, it POSTs
  [`/v1/devices/self/deliveries/{id}/ack`](/docs/api-reference/devices/self-deliveries-ack)
  to advance the delivery to `processed`. See the
  [event router](/docs/architecture/event-router).
</Note>
