Python scripts to export and import devices and device profiles between ChirpStack v4 tenants.
| Script | Purpose |
|---|---|
export_devices.py |
Export devices + keys from a tenant → timestamped JSON + CSV |
export_profiles.py |
Export device profiles (incl. codec scripts) → timestamped JSON |
import_devices.py |
Import devices from a backup JSON into a target tenant |
import_profiles.py |
Import device profiles from a backup JSON into a target tenant |
pip install requests richCredentials are stored locally in import_profiles.json (gitignored — never committed).
Copy the example to get started:
cp import_profiles.example.json import_profiles.jsonThen edit import_profiles.json with your real values:
| Field | Description |
|---|---|
label |
A friendly name for this profile |
base_url |
Your ChirpStack REST API base URL |
api_key |
A ChirpStack API key with tenant access |
tenant_id |
The tenant UUID |
You can also just run any script and enter credentials interactively — they will be saved automatically.
python3 export_devices.py # → YYYY-MM-DD_HHMMSS_<slug>_devices_backup.json + .csv
python3 export_profiles.py # → YYYY-MM-DD_HHMMSS_<slug>_device_profiles_backup.json
python3 import_devices.py # import devices from a *_devices_backup.json
python3 import_profiles.py # import profiles from a *_device_profiles_backup.jsonAll scripts are fully interactive — they guide you through source/target selection, profile mapping, and row-level selection before making any API calls.