Skip to main content

Overview

4G Direct Upload allows Bota Pin 4G devices to upload recordings directly to Bota’s API via cellular (LTE-M) connectivity, eliminating the need for a paired mobile phone during upload. Benefits:
  • Upload recordings without a nearby phone
  • Real-time transcription for time-sensitive use cases
  • Reduced latency from recording to insight
  • Better for always-on, autonomous device usage
Use Cases:
  • Medical clinics where devices are shared and not paired to personal phones
  • Field sales where reps may not have their phone nearby
  • Remote workers who want instant transcription
  • Enterprise deployments with dedicated devices

How It Works

Traditional Upload Flow (BLE)

┌──────────┐      BLE       ┌─────────┐     WiFi/4G    ┌─────────┐
│  Device  │ ────────────▶  │  Phone  │ ─────────────▶ │   API   │
└──────────┘   Transfer     └─────────┘    Upload      └─────────┘

4G Direct Upload Flow

┌──────────┐      4G/WiFi                  ┌─────────┐
│  Device  │ ────────────────────────────▶ │   API   │
└──────────┘   Direct Upload               └─────────┘
The device makes authenticated HTTPS requests directly to api.bota.dev using its embedded cellular modem.

Network Selection

Devices intelligently select the best network based on availability, cost, speed, and battery:

WiFi

Best for: Free, fast uploadsWhen used: Connected to known WiFi networkPriority: Highest (free data)

4G/LTE-M

Best for: Uploads without WiFiWhen used: No WiFi, good cellular signalPriority: Medium (metered data)

Bluetooth

Best for: Slow but reliableWhen used: No WiFi/4G, phone nearbyPriority: Lowest (slowest)

Upload Modes

You can control network selection via device settings:
ModeBehaviorUse Case
auto (Recommended)Smart selection: WiFi → 4G → BLEMost users
wifi_preferredUse WiFi when available, then 4GBalance cost & convenience
4g_preferredUse 4G first, fallback to WiFiAlways-on, real-time needs
wifi_onlyWait for WiFi connection (no 4G)Cost-sensitive, no urgency
4g_onlyUse 4G exclusivelyTesting, guaranteed 4G upload
ble_onlyTraditional BLE → phone uploadDisable direct upload

Device Settings

Configure upload behavior via the Device Settings API:

Quick Example: Enable 4G Uploads

curl -X PATCH https://api.bota.dev/v1/devices/dev_abc123/settings \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "upload": {
      "mode": "auto",
      "daily_data_limit_mb": 500,
      "allow_roaming": false
    }
  }'

Complete Upload Settings

{
  "upload": {
    "mode": "auto",                    // Network selection mode
    "streaming_enabled": false,        // Upload while recording
    "upload_delay_minutes": 0,         // Delay after recording (0 = immediate)
    "daily_data_limit_mb": 500,        // 4G data cap per day
    "allow_roaming": false,            // Block uploads when roaming
    "pause_on_low_battery": true,      // Pause when battery < 20%
    "off_peak_hours": {                // Optional: upload during off-peak
      "enabled": false,
      "start": "02:00",
      "end": "06:00",
      "timezone": "America/Los_Angeles"
    }
  }
}

Data Usage & Costs

Estimating Data Consumption

Recording Size Formula:
File Size (MB) = Duration (minutes) × Bitrate (kbps) × 60 / 8 / 1024
Examples (Opus codec, 32 kbps):
  • 5 minute meeting: ~1.2 MB
  • 30 minute meeting: ~7.2 MB
  • 1 hour meeting: ~14.4 MB

Daily Data Limits

Set daily_data_limit_mb to cap cellular usage:
{
  "upload": {
    "daily_data_limit_mb": 500  // Max 500 MB/day via 4G
  }
}
When limit is exceeded:
  • 4G uploads blocked for remainder of day
  • Device falls back to WiFi or BLE
  • Counter resets at midnight (device local time)

Monitoring Data Usage

Track data consumption via the Get Device Settings endpoint:
{
  "current_status": {
    "data_used_today_mb": 112,
    "daily_data_limit_mb": 500
  }
}

Upload While Recording (Streaming)

For long recordings (>30 minutes), enable streaming upload to upload chunks while recording continues:
{
  "upload": {
    "streaming_enabled": true
  }
}
How It Works:
  1. Device records audio in 5-minute chunks (double buffering)
  2. While recording chunk 2, upload chunk 1 in background
  3. Continue until recording ends
  4. Call /finalize to stitch chunks and trigger transcription
Benefits:
  • Reduced device storage requirements (only 2 chunks in memory)
  • Faster transcription (backend can start transcribing early chunks)
  • Better network resilience (failed chunks can retry independently)
See the Streaming Upload Guide for details.

Roaming & International Use

By default, 4G uploads are disabled when roaming to avoid high charges.

Allow Roaming Uploads

{
  "upload": {
    "allow_roaming": true  // Allow 4G uploads when roaming
  }
}
Roaming Charges: Enabling roaming uploads may incur significant international data charges. Only enable if necessary and monitor usage carefully.

Travel Mode Preset

For international travel, use WiFi-only mode:
{
  "upload": {
    "mode": "wifi_only",
    "allow_roaming": false
  }
}

Battery Optimization

4G uploads consume more power than BLE. Optimize battery life with these settings:

Delay Uploads Until Charging

{
  "upload": {
    "pause_on_low_battery": true,  // Pause when battery < 20%
    "upload_delay_minutes": 15      // Wait 15 min before uploading
  }
}

Off-Peak Uploads

Upload during off-peak hours (e.g., overnight while charging):
{
  "upload": {
    "off_peak_hours": {
      "enabled": true,
      "start": "02:00",      // 2:00 AM
      "end": "06:00",        // 6:00 AM
      "timezone": "America/Los_Angeles"
    }
  }
}
Recordings will queue during the day and upload during the off-peak window.

Mobile App Integration

Fetch Current Settings

const settings = await bota.devices.getSettings('dev_abc123');

console.log(settings.upload.mode);              // "auto"
console.log(settings.current_status.network_type); // "wifi" | "4g" | "ble"

Update Settings from App

// User toggles "Allow Roaming" switch
await bota.devices.patchSettings('dev_abc123', {
  upload: {
    allow_roaming: userToggledRoaming
  }
});

Write Settings to Device via BLE

If the device is connected via BLE, write settings to hardware immediately:
import { BotaBLEDevice } from '@bota-dev/react-native-sdk';

const device = await BotaBLEDevice.connect('dev_abc123');

// Write upload settings to BLE characteristic
await device.writeUploadConfig({
  mode: 'auto',
  daily_data_limit_mb: 500,
  allow_roaming: false
});
Otherwise, settings sync on next heartbeat (every 15 minutes).

Preset Configurations

Common upload presets for different use cases:

Maximum Quality (Enterprise)

{
  "upload": {
    "mode": "auto",
    "streaming_enabled": true,
    "upload_delay_minutes": 0,
    "daily_data_limit_mb": 0  // Unlimited
  }
}
Best for: Real-time transcription, doctors, sales teams
{
  "upload": {
    "mode": "wifi_preferred",
    "streaming_enabled": false,
    "upload_delay_minutes": 5,
    "daily_data_limit_mb": 500
  }
}
Best for: Most users, balance cost & speed

Data Saver

{
  "upload": {
    "mode": "wifi_only",
    "streaming_enabled": false,
    "off_peak_hours": {
      "enabled": true,
      "start": "02:00",
      "end": "06:00"
    },
    "daily_data_limit_mb": 100
  }
}
Best for: Budget-conscious, no urgency

Battery Saver

{
  "upload": {
    "mode": "ble_only",
    "streaming_enabled": false
  }
}
Best for: Low battery, sync via phone only

Monitoring Upload Status

Track Upload Method

Each recording tracks the upload method used:
GET /v1/recordings/rec_abc123
{
  "id": "rec_abc123",
  "upload_method": "4g_direct",  // "ble" | "wifi_direct" | "4g_direct"
  "data_uploaded_bytes": 15728640,
  "upload_completed_at": "2025-01-13T14:23:45Z"
}

Analytics Queries

Query recordings by upload method:
GET /v1/recordings?upload_method=4g_direct&start_date=2025-01-01
Track 4G adoption rate, data usage, and upload performance.

Troubleshooting

Recording Not Uploading via 4G

Check:
  1. Device has 4G connectivity (signal strength > -85 dBm)
  2. Upload mode is not ble_only or wifi_only
  3. Daily data limit not exceeded
  4. Device not roaming (if allow_roaming: false)
  5. Battery level sufficient (if pause_on_low_battery: true)
Get Device Status:
GET /v1/devices/dev_abc123/settings
{
  "current_status": {
    "network_type": "4g",
    "signal_strength_dbm": -75,
    "is_roaming": false,
    "data_used_today_mb": 450,
    "battery_percent": 65
  }
}

Upload Failed - Poor Signal

If 4G signal is weak (< -95 dBm), device will fallback to BLE or queue upload for later. Solution: Configure WiFi credentials via mobile app, or set mode: "wifi_preferred".

Data Limit Exceeded

When daily limit is hit:
  • Device blocks 4G uploads
  • Falls back to WiFi or BLE
  • Resets at midnight
Solution: Increase daily_data_limit_mb or enable WiFi fallback.

Security & Authentication

4G uploads use device tokens (dtok_*) for authentication. Tokens are:
  • Bound to specific device + end user
  • Short-lived (90 days, auto-renewed)
  • Written to device flash during provisioning
See Device Token Authentication for details.