Skip to content

Event Envelope

Every event emitted by Nexus uses this envelope. The envelope handles classification, provenance, and delivery routing. Data items inside data[] are self-contained with their own identity, timestamps, and versioning.

{
"event_id": "550e8400-e29b-41d4-a716-446655440000",
"schema_version": "1.1",
"event_type": "activity",
"stream": "session",
"provider": "fitbit",
"sources": [
{
"provider_notification_id": "notif-abc123",
"fetched_at": 1742585000000
}
],
"devices": [
{
"device_id": "dev-001",
"name": "Charge 6",
"model": "FB423",
"provider_device_id": "dev-001"
}
],
"tenant_id": "tenant-uuid",
"user_id": "user-uuid",
"external_user_ref": "your-user-123",
"connection_id": "conn-uuid",
"emitted_at": 1742585400000,
"data": [
// array of type-specific data items
]
}
FieldTypeDescription
event_idstring (uuid)Unique per emission. Re-processing the same data produces a new event_id.
schema_versionstringEnvelope schema version for forward compatibility.
event_typestringDiscriminator for the data shape. All items in data[] share this type.
streamstringStream tier: "session", "snapshot", "timeseries", "aggregate", or "profile".
providerstringSource provider identifier (e.g., "fitbit", "garmin", "oura").
sourcesarrayNotification references that triggered this event. Empty [] for backfill or non-notification events.
sources[].provider_notification_idstring | nullThe provider notification that triggered the fetch.
sources[].fetched_atnumber (epoch ms)When Nexus fetched in response to the notification.
devicesarrayDevice registry for this event. Data items reference devices by device_id.
devices[].device_idstringNexus-scoped device identifier.
devices[].namestring | nullDevice display name.
devices[].modelstring | nullDevice model identifier.
devices[].provider_device_idstring | nullProvider’s native device ID.
tenant_idstringTarget tenant.
user_idstringTarget user within the tenant (Nexus internal tenant_user_id).
external_user_refstringTenant-provided external user reference echoed from connect-time user creation.
connection_idstringThe connection that produced this data.
emitted_atnumber (epoch ms)When Nexus emitted this event.
dataarrayOne or more data items, all of the same event_type.

The sources array records which provider notifications triggered this event:

  • Notification-triggered events: One or more source entries with fetched_at timestamps.
  • Backfill / replay events: Empty array [].
  • Manual / scheduled fetches: Empty array [].

The devices array is a registry of devices relevant to this event. Individual data items reference devices by device_id. When device attribution is unavailable, a data item sets device_id to null.