chirpstack_api 3.8.1

ChirpStack Protobuf / gRPC API definitions.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
syntax = "proto3";

package api;

option go_package = "github.com/brocaar/chirpstack-api/go/v3/as/external/api";
option java_package = "io.chirpstack.api.as.external.api";

import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "common/common.proto";
import "as/external/api/frameLog.proto";


// DeviceService is the service managing the devices.
service DeviceService {
    // Create creates the given device.
    rpc Create(CreateDeviceRequest) returns (google.protobuf.Empty) {
        option(google.api.http) = {
            post: "/api/devices"
            body: "*"
        };
    }

    // Get returns the device matching the given DevEUI.
    rpc Get(GetDeviceRequest) returns (GetDeviceResponse) {
        option (google.api.http) = {
            get: "/api/devices/{dev_eui}"
        };
    }

    // List returns the available devices.
    rpc List(ListDeviceRequest) returns (ListDeviceResponse) {
        option (google.api.http) = {
            get: "/api/devices"
        };
    }

    // Delete deletes the device matching the given DevEUI.
    rpc Delete(DeleteDeviceRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
            delete: "/api/devices/{dev_eui}"
        };
    }

    // Update updates the device matching the given DevEUI.
    rpc Update(UpdateDeviceRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
            put: "/api/devices/{device.dev_eui}"
            body: "*"
        };
    }

    // CreateKeys creates the given device-keys.
    rpc CreateKeys(CreateDeviceKeysRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
            post: "/api/devices/{device_keys.dev_eui}/keys"
            body: "*"
        };
    }

    // GetKeys returns the device-keys for the given DevEUI.
    rpc GetKeys(GetDeviceKeysRequest) returns (GetDeviceKeysResponse) {
        option (google.api.http) = {
            get: "/api/devices/{dev_eui}/keys"
        };
    }

    // UpdateKeys updates the device-keys.
    rpc UpdateKeys(UpdateDeviceKeysRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
            put: "/api/devices/{device_keys.dev_eui}/keys"
            body: "*"
        };
    }

    // DeleteKeys deletes the device-keys for the given DevEUI.
    rpc DeleteKeys(DeleteDeviceKeysRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
            delete: "/api/devices/{dev_eui}/keys"
        };
    };

    // Activate (re)activates the device with the given parameters (for ABP or for importing OTAA activations).
    rpc Activate(ActivateDeviceRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
            post: "/api/devices/{device_activation.dev_eui}/activate"
            body: "*"
        };
    }

    // Deactivate de-activates the device.
    rpc Deactivate(DeactivateDeviceRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
            delete: "/api/devices/{dev_eui}/activation"
        };
    }

    // GetActivation returns the current activation details of the device (OTAA and ABP).
    rpc GetActivation(GetDeviceActivationRequest) returns (GetDeviceActivationResponse) {
        option (google.api.http) = {
            get: "/api/devices/{dev_eui}/activation"
        };
    }

    // GetRandomDevAddr returns a random DevAddr taking the NwkID prefix into account.
    rpc GetRandomDevAddr(GetRandomDevAddrRequest) returns (GetRandomDevAddrResponse) {
        option (google.api.http) = {
            post: "/api/devices/{dev_eui}/getRandomDevAddr"
        };
    }

    // StreamFrameLogs streams the uplink and downlink frame-logs for the given DevEUI.
	//   * These are the raw LoRaWAN frames and this endpoint is intended for debugging only.
	//   * This endpoint does not work from a web-browser.
    rpc StreamFrameLogs(StreamDeviceFrameLogsRequest) returns (stream StreamDeviceFrameLogsResponse) {
        option (google.api.http) = {
            get: "/api/devices/{dev_eui}/frames"
        };
    }

    // StreamEventLogs stream the device events (uplink payloads, ACKs, joins, errors).
	//   * This endpoint is intended for debugging only.
	//   * This endpoint does not work from a web-browser.
    rpc StreamEventLogs(StreamDeviceEventLogsRequest) returns (stream StreamDeviceEventLogsResponse) {
        option (google.api.http) = {
            get: "/api/devices/{dev_eui}/events"
        };
    }
}

message Device {
    // Device EUI (HEX encoded).
    string dev_eui = 1 [json_name = "devEUI"]; 
    
    // Name of the device (if left blank, it will be set to the DevEUI).
    string name = 2;

    // ID of the application to which the device must be added.
    // It is possible to move a device to a different application on update,
    // given that both the old and the new application share the same
    // service-profile.
    int64 application_id = 3 [json_name = "applicationID"];

    // Description of the device.
    string description = 4;

    // DeviceProfileID attached to the device.
    string device_profile_id = 5 [json_name = "deviceProfileID"];

    // Skip frame-counter checks (this is insecure, but could be helpful for debugging).
    bool skip_f_cnt_check = 6;

    // Reference altitude.
    // When using geolocation, this altitude will be used as a reference
    // (when supported by the geolocation-server) to increase geolocation
    // accuracy.
    double reference_altitude = 7;

    // Variables (user defined).
    // These variables can be used together with integrations to store tokens /
    // secrets that must be configured per device. These variables are not
    // exposed in the event payloads.
    map<string, string> variables = 8;

    // Tags (user defined).
    // These tags are exposed in the event payloads or to integration. Tags are
    // intended for aggregation and filtering.
    map<string, string> tags = 9;

    // Device is disabled.
    bool is_disabled = 10;
}

message DeviceListItem {
    // Device EUI (HEX encoded).
    string dev_eui = 1 [json_name = "devEUI"]; 
    
    // Name of the device.
    string name = 2;

    // Application ID.
    int64 application_id = 3 [json_name = "applicationID"];

    // Description of the device.
    string description = 4;

    // Device-profile ID attached to the device.
    string device_profile_id = 5 [json_name = "deviceProfileID"];

    // Device-profile name.
    string device_profile_name = 6;

    // The device battery status (deprecated, use device_status_battery_level).
    // 0:      The end-device is connected to an external power source
    // 1..254: The battery level, 1 being at minimum and 254 being at maximum
    // 255:    The end-device was not able to measure the battery level
    // 256:    The device-status is not available.
    uint32 device_status_battery = 7;

    // The device margin status
    // -32..32: The demodulation SNR ration in dB
    // 256:     The device-status is not available.
    int32  device_status_margin = 8;

    // Device is connected to an external power source.
    bool device_status_external_power_source = 10;

    // Device battery status is unavailable.
    bool device_status_battery_level_unavailable = 11;

    // Device battery level as a percentage.
    float device_status_battery_level = 12;

    // The last time the application-server received any data from the device,
    // or an empty string when the device never sent any data.
    google.protobuf.Timestamp last_seen_at = 9 [json_name = "lastSeenAt"];
}

message DeviceKeys {
    // Device EUI (HEX encoded).
    string dev_eui = 1 [json_name = "devEUI"];

    // Network root key (HEX encoded).
    // Note: For LoRaWAN 1.0.x, use this field for the LoRaWAN 1.0.x 'AppKey`!
    string nwk_key = 2;

    // Application root key (HEX encoded).
    // Note: This field only needs to be set for LoRaWAN 1.1.x devices!
    string app_key = 3;

    // Gen application key (HEX encoded).
    // This is an optional key that only must be set for LORaWAN 1.0.x devices
    // that implement the remote multicast setup specification.
    string gen_app_key = 4;
}

message CreateDeviceRequest {
    // Device object to create.
    Device device = 1;
}

message GetDeviceRequest {
    // Device EUI (HEX encoded).
    string dev_eui = 1 [json_name = "devEUI"];
}

message GetDeviceResponse {
    // Device object.
    Device device = 1;

    // Created at 2
    // Updated at 3
    // First seen at 4

    // Last seen timestamp.
    google.protobuf.Timestamp last_seen_at = 5 [json_name = "lastSeenAt"];

    // The device battery status
    // 0:      The end-device is connected to an external power source
    // 1..254: The battery level, 1 being at minimum and 254 being at maximum
    // 255:    The end-device was not able to measure the battery level
    // 256:    The device-status is not available.
    uint32 device_status_battery = 6;

    // The device margin status
    // -32..32: The demodulation SNR ration in dB
    // 256:     The device-status is not available.
    int32  device_status_margin = 20;

    // Device location.
    // This will set when the network-server was able to resolve the location
    // using the geolocation-server.
    common.Location location = 21;
}

message ListDeviceRequest {
    // Max number of devices to return in the result-set.
    int64 limit = 1;

    // Offset in the result-set (for pagination).
    int64 offset = 2;

    // Application ID to filter on.
    int64 application_id = 3 [json_name = "applicationID"];

    // Search on name or DevEUI.
    string search = 4;

    // Multicast-group ID to filter on (string formatted UUID).
    string multicast_group_id = 5 [json_name = "multicastGroupID"];

    // Service-profile ID to filter on (string formatted UUID).
    string service_profile_id = 6 [json_name = "serviceProfileID"];

    // Tags to filter on.
    map<string, string> tags = 7;
}

message ListDeviceResponse {
    // Total number of devices available within the result-set.
    int64 total_count = 1;

    // Devices within this result-set.
    repeated DeviceListItem result = 2;
}

message DeleteDeviceRequest {
    // Device EUI (HEX encoded).
    string dev_eui = 1 [json_name = "devEUI"];
}


message UpdateDeviceRequest {
    // Device object to update.
    Device device = 1;
}

message CreateDeviceKeysRequest {
    // Device-keys object to create.
    DeviceKeys device_keys = 1;
}

message GetDeviceKeysRequest {
    // Device EUI (HEX encoded).
    string dev_eui = 1 [json_name = "devEUI"];
}

message GetDeviceKeysResponse {
    // Device-key object.
    DeviceKeys device_keys = 1;
}

message UpdateDeviceKeysRequest {
    // Device-keys object to update.
    DeviceKeys device_keys = 1;
}

message DeleteDeviceKeysRequest {
    // Device EUI (HEX encoded).
    string dev_eui = 1 [json_name = "devEUI"];
}

message DeviceActivation {
    // Device EUI (HEX encoded).
    string dev_eui = 1 [json_name = "devEUI"];

    // Device address (HEX encoded).
    string dev_addr = 2;

    // Application session key (HEX encoded).
    string app_s_key = 3;

    // Network session encryption key (HEX encoded).
    string nwk_s_enc_key = 4;

    // Serving network session integrity key (HEX encoded).
    string s_nwk_s_int_key = 8;

    // Forwarding network session integrity key (HEX encoded).
    string f_nwk_s_int_key = 9;

    // Uplink frame-counter.
    uint32 f_cnt_up = 5;

    // Downlink network frame-counter.
    uint32 n_f_cnt_down = 6;

    // Downlink application frame-counter.
    uint32 a_f_cnt_down = 10;
}

message ActivateDeviceRequest {
    DeviceActivation device_activation = 1;
}

message DeactivateDeviceRequest {
    // Device EUI (HEX encoded).
    string dev_eui = 1 [json_name = "devEUI"];
}

message GetDeviceActivationRequest {
    // Device EUI (HEX encoded).
    string dev_eui = 1 [json_name = "devEUI"];
}

message GetDeviceActivationResponse {
    // Device-activation object.
    DeviceActivation device_activation = 1;
}

message GetRandomDevAddrRequest {
    // Device EUI (HEX encoded).
    string dev_eui = 1 [json_name = "devEUI"];
}

message GetRandomDevAddrResponse {
    // Device address (HEX encoded).
    string dev_addr = 1;
}

message StreamDeviceFrameLogsRequest {
    // Device EUI (HEX encoded).
    string dev_eui = 1 [json_name = "devEUI"];
}

message StreamDeviceFrameLogsResponse {
    oneof frame {
        // Contains an uplink frame.
        UplinkFrameLog uplink_frame = 1;

        // Contains a downlink frame.
        DownlinkFrameLog downlink_frame = 2;
    }
}

message StreamDeviceEventLogsRequest {
    // Device EUI (HEX encoded).
    string dev_eui = 1 [json_name = "devEUI"];
}

message StreamDeviceEventLogsResponse {
    // The event type.
    string type = 1;

    // The event payload in JSON encoding.
    string payload_json = 2 [json_name = "payloadJSON"];
}