1SYNCTHING-EVENT-API(7)             Syncthing            SYNCTHING-EVENT-API(7)
2
3
4

NAME

6       syncthing-event-api - Event API
7

DESCRIPTION

9       Syncthing  provides a simple long polling interface for exposing events
10       from the core utility towards a GUI. To receive events, see events-get.
11

EVENT STRUCTURE

13       Each event is represented by an object similar to the following:
14
15          {
16              "id": 2,
17              "globalID": 3,
18              "type": "DeviceConnected",
19              "time": "2014-07-13T21:04:33.687836696+02:00",
20              "data": {
21                  "addr": "172.16.32.25:22000",
22                  "id": "NFGKEKE-7Z6RTH7-I3PRZXS-DEJF3UJ-FRWJBFO-VBBTDND-4SGNGVZ-QUQHJAG"
23              }
24          }
25
26       The top level keys  id,  globalID,  time,  type  and  data  are  always
27       present, though data may be null.
28
29       id     A  unique  ID  for  this  event  on  the  events  API. It always
30              increases by 1: the first event generated has id 1, the next has
31              id  2  etc.  If  this increases by more than 1, then one or more
32              events have been skipped by the events API.
33
34       globalID
35              A global ID for this event, across the  events  API,  the  audit
36              log,  and any other sources. It may increase by more than 1, but
37              it will always be greater than or equal to the id.
38
39       time   The time the event was generated.
40
41       type   Indicates the type of (i.e. reason for) the event and is one  of
42              the event types below.
43
44       data   An  object  containing  optional  extra  information;  the exact
45              structure is determined by the event type.
46

EVENT TYPES

48   ConfigSaved
49       Emitted after the config has been saved by the  user  or  by  Syncthing
50       itself.
51
52          {
53              "id": 50,
54              "globalID": 50,
55              "type": "ConfigSaved",
56              "time": "2014-12-13T00:09:13.5166486Z",
57              "data": {
58                  "Version": 7,
59                  "Options": {"..."},
60                  "GUI": {"..."},
61                  "Devices": [{"..."}],
62                  "Folders": [{"..."}]
63              }
64          }
65
66   DeviceConnected
67       Generated each time a connection to a device has been established.
68
69          {
70              "id": 2,
71              "globalID": 2,
72              "type": "DeviceConnected",
73              "time": "2014-07-13T21:04:33.687836696+02:00",
74              "data": {
75                  "addr": "172.16.32.25:22000",
76                  "id": "NFGKEKE-7Z6RTH7-I3PRZXS-DEJF3UJ-FRWJBFO-VBBTDND-4SGNGVZ-QUQHJAG",
77                  "deviceName": "Laptop",
78                  "clientName": "syncthing",
79                  "clientVersion": "v0.13.4",
80                  "type": "TCP (Client)"
81              }
82          }
83
84   DeviceDisconnected
85       Generated each time a connection to a device has been terminated.
86
87          {
88              "id": 48,
89              "globalID": 48,
90              "type": "DeviceDisconnected",
91              "time": "2014-07-13T21:18:52.859929215+02:00",
92              "data": {
93                  "error": "unexpected EOF",
94                  "id": "NFGKEKE-7Z6RTH7-I3PRZXS-DEJF3UJ-FRWJBFO-VBBTDND-4SGNGVZ-QUQHJAG"
95              }
96          }
97
98       NOTE:
99          The  error key contains the cause for disconnection, which might not
100          necessarily be an error as such. Specifically, “EOF” and “unexpected
101          EOF”  both  signify  TCP  connection  termination, either due to the
102          other device restarting or going offline or due to a network change.
103
104   DeviceDiscovered
105       Emitted when a new device is discovered using local discovery.
106
107          {
108              "id": 13,
109              "globalID": 13,
110              "type": "DeviceDiscovered",
111              "time": "2014-07-17T13:28:05.043465207+02:00",
112              "data": {
113                  "addrs": [
114                      "172.16.32.25:22000"
115                  ],
116                  "device": "NFGKEKE-7Z6RTH7-I3PRZXS-DEJF3UJ-FRWJBFO-VBBTDND-4SGNGVZ-QUQHJAG"
117              }
118          }
119
120   DevicePaused
121       Emitted when a device was paused.
122
123          {
124              "id": 13,
125              "globalID": 13,
126              "type": "DevicePaused",
127              "time": "2014-07-17T13:28:05.043465207+02:00",
128              "data": {
129                  "device": "NFGKEKE-7Z6RTH7-I3PRZXS-DEJF3UJ-FRWJBFO-VBBTDND-4SGNGVZ-QUQHJAG"
130              }
131          }
132
133   DeviceRejected
134       Deprecated since version v1.13.0: This event is still emitted for  com‐
135       patibility,    but    deprecated.     Use    the    replacement   pend‐
136       ing-devices-changed event instead.
137
138
139       Emitted when there is a connection from a device we are not  configured
140       to talk to.
141
142          {
143              "id": 24,
144              "globalID": 24,
145              "type": "DeviceRejected",
146              "time": "2014-08-19T10:43:00.562821045+02:00",
147              "data": {
148                  "address": "127.0.0.1:51807",
149                  "name": "My dusty computer",
150                  "device": "EJHMPAQ-OGCVORE-ISB4IS3-SYYVJXF-TKJGLTU-66DIQPF-GJ5D2GX-GQ3OWQK"
151              }
152          }
153
154   DeviceResumed
155       Generated each time a device was resumed.
156
157          {
158              "id": 2,
159              "globalID": 2,
160              "type": "DeviceResumed",
161              "time": "2014-07-13T21:04:33.687836696+02:00",
162              "data": {
163                  "device": "NFGKEKE-7Z6RTH7-I3PRZXS-DEJF3UJ-FRWJBFO-VBBTDND-4SGNGVZ-QUQHJAG"
164              }
165          }
166
167   DownloadProgress
168       Emitted during file downloads for each folder for each file. By default
169       only a single file in a folder is handled at the same time, but  custom
170       configuration can cause multiple files to be shown.
171
172          {
173              "id": 221,
174              "globalID": 221,
175              "type": "DownloadProgress",
176              "time": "2014-12-13T00:26:12.9876937Z",
177              "data": {
178                  "folder1": {
179                      "file1": {
180                          "total": 800,
181                          "pulling": 2,
182                          "copiedFromOrigin": 0,
183                          "reused": 633,
184                          "copiedFromElsewhere": 0,
185                          "pulled": 38,
186                          "bytesTotal": 104792064,
187                          "bytesDone": 87883776
188                      },
189                      "dir\\file2": {
190                          "total": 80,
191                          "pulling": 2,
192                          "copiedFromOrigin": 0,
193                          "reused": 0,
194                          "copiedFromElsewhere": 0,
195                          "pulled": 32,
196                          "bytesTotal": 10420224,
197                          "bytesDone": 4128768
198                      }
199                  },
200                  "folder2": {
201                      "file3": {
202                          "total": 800,
203                          "pulling": 2,
204                          "copiedFromOrigin": 0,
205                          "reused": 633,
206                          "copiedFromElsewhere": 0,
207                          "pulled": 38,
208                          "bytesTotal": 104792064,
209                          "bytesDone": 87883776
210                      },
211                      "dir\\file4": {
212                          "total": 80,
213                          "pulling": 2,
214                          "copiedFromOrigin": 0,
215                          "reused": 0,
216                          "copiedFromElsewhere": 0,
217                          "pulled": 32,
218                          "bytesTotal": 10420224,
219                          "bytesDone": 4128768
220                      }
221                  }
222              }
223          }
224
225       · total - total number of blocks in the file
226
227       · pulling - number of blocks currently being downloaded
228
229       · copiedFromOrigin - number of blocks copied from the file we are about
230         to replace
231
232       · reused - number of blocks reused from a previous temporary file
233
234       · copiedFromElsewhere - number of blocks copied  from  other  files  or
235         potentially other folders
236
237       · pulled - number of blocks actually downloaded so far
238
239       · bytesTotal - approximate total file size
240
241       · bytesDone  -  approximate  number  of  bytes already handled (already
242         reused, copied or pulled)
243
244       Where block size is 128KB.
245
246       Files/folders appearing in the event data imply that the  download  has
247       been  started for that file/folder, where disappearing implies that the
248       downloads have been finished or failed for that file/folder.  There  is
249       always  a  last event emitted with no data, which implies all downloads
250       have finished/failed.
251
252   FolderCompletion
253       The FolderCompletion event is emitted when the local or remote contents
254       for a folder changes. It contains the completion percentage for a given
255       remote device and  is  emitted  once  per  currently  connected  remote
256       device.
257
258          {
259              "id": 84,
260              "globalID": 84,
261              "type": "FolderCompletion",
262              "time": "2015-04-17T14:14:27.043576583+09:00",
263              "data": {
264                  "completion": 100,
265                  "device": "I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU",
266                  "folder": "default"
267              }
268          }
269
270   FolderErrors
271       The  FolderErrors event is emitted when a folder cannot be successfully
272       synchronized. The event contains the ID of the affected  folder  and  a
273       list of errors for files or directories therein. This list of errors is
274       obsolete once the folder changes state to syncing -  if  errors  remain
275       after  the  next  synchronization  attempt, a new FolderErrors event is
276       emitted.
277
278          {
279              "id": 132,
280              "type": "FolderErrors",
281              "time": "2015-06-26T13:39:24.697401384+02:00",
282              "data": {
283                  "errors": [
284                      {
285                          "error": "open /Users/jb/src/github.com/syncthing/syncthing/test/s2/h2j/.syncthing.aslkjd.tmp: permission denied",
286                          "path": "h2j/aslkjd"
287                      }
288                  ],
289                  "folder": "default"
290              }
291          }
292
293       New in version 0.11.12.
294
295
296       SEE ALSO:
297          The statechanged event.
298
299   FolderRejected
300       Deprecated since version v1.13.0: This event is still emitted for  com‐
301       patibility,   but   deprecated.    Use  the  replacement  pending-fold‐
302       ers-changed event instead.
303
304
305       Emitted when a device sends index information for a folder  we  do  not
306       have, or have but do not share with the device in question.
307
308          {
309              "id": 27,
310              "globalID": 27,
311              "type": "FolderRejected",
312              "time": "2014-08-19T10:41:06.761751399+02:00",
313              "data": {
314                  "device": "EJHMPAQ-OGCVORE-ISB4IS3-SYYVJXF-TKJGLTU-66DIQPF-GJ5D2GX-GQ3OWQK",
315                  "folder": "GXWxf-3zgnU",
316                  "folderLabel": "My Pictures"
317              }
318          }
319
320   Folder Scan Progress
321       Emitted  in  regular intervals (folder setting ProgressIntervalS, 2s by
322       default) during scans giving the amount of bytes already scanned and to
323       be  scanned  in  total , as well as the current scanning rates in bytes
324       per second.
325
326          {
327             "data" : {
328                "total" : 1,
329                "rate" : 0,
330                "current" : 0,
331                "folder" : "bd7q3-zskm5"
332             },
333             "globalID" : 29,
334             "type" : "FolderScanProgress",
335             "time" : "2017-03-06T15:00:58.072004209+01:00",
336             "id" : 29
337          }
338
339   FolderSummary
340       The FolderSummary event is emitted when folder  contents  have  changed
341       locally.  This  can  be  used to calculate the current local completion
342       state.
343
344          {
345              "id": 16,
346              "globalID": 16,
347              "type": "FolderSummary",
348              "time": "2015-04-17T14:12:20.460121585+09:00",
349              "data": {
350                  "folder": "default",
351                  "summary": {
352                      "globalBytes": 0,
353                      "globalDeleted": 0,
354                      "globalFiles": 0,
355                      "ignorePatterns": false,
356                      "inSyncBytes": 0,
357                      "inSyncFiles": 0,
358                      "invalid": "",
359                      "localBytes": 0,
360                      "localDeleted": 0,
361                      "localFiles": 0,
362                      "needBytes": 0,
363                      "needFiles": 0,
364                      "state": "idle",
365                      "stateChanged": "2015-04-17T14:12:12.455224687+09:00",
366                      "version": 0
367                  }
368              }
369          }
370
371   ItemFinished
372       Generated when Syncthing ends synchronizing a file to a newer  version.
373       A successful operation:
374
375          {
376              "id": 93,
377              "globalID": 93,
378              "type": "ItemFinished",
379              "time": "2014-07-13T21:22:03.414609034+02:00",
380              "data": {
381                  "item": "test.txt",
382                  "folder": "default",
383                  "error": null,
384                  "type": "file",
385                  "action": "update"
386              }
387          }
388
389       An unsuccessful operation:
390
391          {
392              "id": 44,
393              "globalID": 44,
394              "type": "ItemFinished",
395              "time": "2015-05-27T11:21:05.711133004+02:00",
396              "data": {
397                  "action": "update",
398                  "error": "open /Users/jb/src/github.com/syncthing/syncthing/test/s2/foo/.syncthing.hej.tmp: permission denied",
399                  "folder": "default",
400                  "item": "foo/hej",
401                  "type": "file"
402              }
403          }
404
405       The  action  field  is either update (contents changed), metadata (file
406       metadata changed but not contents), or delete.
407
408       New in version 0.11.10: The metadata action.
409
410
411   ItemStarted
412       Generated when Syncthing begins synchronizing a file to  a  newer  ver‐
413       sion.
414
415          {
416              "id": 93,
417              "globalID": 93,
418              "type": "ItemStarted",
419              "time": "2014-07-13T21:22:03.414609034+02:00",
420              "data": {
421                  "item": "test.txt",
422                  "folder": "default",
423                  "type": "file",
424                  "action": "update"
425              }
426          }
427
428       The  action  field  is either update (contents changed), metadata (file
429       metadata changed but not contents), or delete.
430
431       New in version 0.11.10: The metadata action.
432
433
434   Listen Addresses Changed
435       This event is emitted when a listen address changes.
436
437          {
438             "type" : "ListenAddressesChanged",
439             "id" : 70,
440             "time" : "2017-03-06T15:01:24.88340663+01:00",
441             "globalID" : 70,
442             "data" : {
443                "address" : {
444                   "Fragment" : "",
445                   "RawQuery" : "",
446                   "Scheme" : "dynamic+https",
447                   "Path" : "/endpoint",
448                   "RawPath" : "",
449                   "User" : null,
450                   "ForceQuery" : false,
451                   "Host" : "relays.syncthing.net",
452                   "Opaque" : ""
453                },
454                "wan" : [
455                   {
456                      "ForceQuery" : false,
457                      "User" : null,
458                      "Host" : "31.15.66.212:443",
459                      "Opaque" : "",
460                      "Path" : "/",
461                      "RawPath" : "",
462                      "RawQuery" : "id=F4HSJVO-CP2C3IL-YLQYLSU-XTYODAG-PPU4LGV-PH3MU4N-G6K56DV-IPN47A&pingInterval=1m0s&networkTimeout=2m0s&sessionLimitBps=0&globalLimitBps=0&statusAddr=:22070&providedBy=",
463                      "Scheme" : "relay",
464                      "Fragment" : ""
465                   }
466                ],
467                "lan" : [
468                   {
469                      "RawQuery" : "id=F4HSJVO-CP2C3IL-YLQYLSU-XTYODAG-PPU4LGV-PH3MU4N-G6K56DV-IPN47A&pingInterval=1m0s&networkTimeout=2m0s&sessionLimitBps=0&globalLimitBps=0&statusAddr=:22070&providedBy=",
470                      "Scheme" : "relay",
471                      "Fragment" : "",
472                      "RawPath" : "",
473                      "Path" : "/",
474                      "Host" : "31.15.66.212:443",
475                      "Opaque" : "",
476                      "ForceQuery" : false,
477                      "User" : null
478                   }
479                ]
480             }
481          }
482
483   LocalChangeDetected
484       Generated upon scan whenever the local disk has discovered  an  updated
485       file  from  the  previous  scan.  This does not include events that are
486       discovered and copied from other devices (remote-change-detected), only
487       files that were changed on the local filesystem.
488
489          {
490            "id": 7,
491            "globalID": 59,
492            "time": "2016-09-26T22:07:10.7189141-04:00",
493            "type": "LocalChangeDetected",
494            "data": {
495              "action": "deleted",
496              "folderID": "vitwy-zjxqt",
497              "label": "TestSync",
498              "path": "C:\\Users\\Nate\\Sync\\testfolder\\test file.rtf",
499              "type": "file"
500            }
501          }
502
503   LocalIndexUpdated
504       Generated when the local index information has changed, due to synchro‐
505       nizing one or more items from the cluster or discovering local  changes
506       during a scan.
507
508          {
509              "id": 59,
510              "globalID": 59,
511              "type": "LocalIndexUpdated",
512              "time": "2014-07-17T13:27:28.051369434+02:00",
513              "data": {
514                  "folder": "default",
515                  "items": 1000,
516              }
517          }
518
519   Login Attempt
520       When  authentication  is  enabled for the GUI, this event is emitted on
521       every login attempt. If either the username or password are  incorrect,
522       success is false and in any case the given username is returned.
523
524          {
525             "id" : 187,
526             "time" : "2017-03-07T00:19:24.420386143+01:00",
527             "data" : {
528                "username" : "somename",
529                "success" : false
530             },
531             "type" : "LoginAttempt",
532             "globalID" : 195
533          }
534
535   PendingDevicesChanged
536       New in version 1.14.0.
537
538
539       Emitted  when  pending  devices  were  added / updated (connection from
540       unknown ID) or removed (device is ignored or added).
541
542          {
543            "id": 87,
544            "type": "PendingDevicesChanged",
545            "time": "2020-12-22T22:24:37.578586718+01:00",
546            "data": {
547              "added": [
548                {
549                  "address": "127.0.0.1:51807",
550                  "device": "EJHMPAQ-OGCVORE-ISB4IS3-SYYVJXF-TKJGLTU-66DIQPF-GJ5D2GX-GQ3OWQK",
551                  "name": "My dusty computer"
552                }
553              ],
554              "removed": [
555                {
556                  "device": "P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"
557                }
558              ]
559            }
560          }
561
562   PendingFoldersChanged
563       New in version 1.14.0.
564
565
566       Emitted when pending folders were added  /  updated  (offered  by  some
567       device,  but not shared to them) or removed (folder ignored or added or
568       no longer offered from the remote device).
569
570          {
571            "id": 101,
572            "type": "PendingFoldersChanged",
573            "time": "2020-12-22T22:36:55.66744317+01:00",
574            "data": {
575              "added": [
576                {
577                  "device": "EJHMPAQ-OGCVORE-ISB4IS3-SYYVJXF-TKJGLTU-66DIQPF-GJ5D2GX-GQ3OWQK",
578                  "folder": "GXWxf-3zgnU",
579                  "folderLabel": "My Pictures"
580                }
581              ],
582              "removed": [
583                {
584                  "device": "P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2",
585                  "folder": "neyfh-sa2nu"
586                }
587              ]
588            }
589          }
590
591   RemoteChangeDetected
592       Generated upon scan whenever a file is locally updated due to a  remote
593       change.  Files that are updated locally produce a local-change-detected
594       event.
595
596          {
597             "time" : "2017-03-06T23:58:21.844739891+01:00",
598             "globalID" : 123,
599             "data" : {
600                "type" : "file",
601                "action" : "deleted",
602                "path" : "/media/ntfs_data/Dokumente/testfile",
603                "label" : "Dokumente",
604                "folderID" : "Dokumente",
605                "modifiedBy" : "BPDFDTU"
606             },
607             "type" : "RemoteChangeDetected",
608             "id" : 2
609          }
610
611   Remote Download Progress
612       This event is emitted when a download-progress message is received.  It
613       returns  a map data of filenames with a count of downloaded blocks. The
614       files in questions are currently being downloaded on the remote  device
615       and belong to folder.
616
617          {
618             "time" : "2017-03-07T00:11:37.65838955+01:00",
619             "globalID" : 170,
620             "data" : {
621                "state" : {
622                   "tahr64-6.0.5.iso" : 1784
623                },
624                "device" : "F4HSJVO-CP2C3IL-YLQYLSU-XTYODAG-PPU4LGV-PH3MU4N-G6K56DV-IPN47A",
625                "folder" : "Dokumente"
626             },
627             "type" : "RemoteDownloadProgress",
628             "id" : 163
629          }
630
631   RemoteIndexUpdated
632       Generated each time new index information is received from a device.
633
634          {
635              "id": 44,
636              "globalID": 44,
637              "type": "RemoteIndexUpdated",
638              "time": "2014-07-13T21:04:35.394184435+02:00",
639              "data": {
640                  "device": "NFGKEKE-7Z6RTH7-I3PRZXS-DEJF3UJ-FRWJBFO-VBBTDND-4SGNGVZ-QUQHJAG",
641                  "folder": "lightroom",
642                  "items": 1000
643              }
644          }
645
646   Starting
647       Emitted  exactly once, when Syncthing starts, before parsing configura‐
648       tion etc.
649
650          {
651              "id": 1,
652              "globalID": 1,
653              "type": "Starting",
654              "time": "2014-07-17T13:13:32.044470055+02:00",
655              "data": {
656                  "home": "/home/jb/.config/syncthing"
657              }
658          }
659
660   StartupComplete
661       Emitted exactly once, when initialization is complete and Syncthing  is
662       ready to start exchanging data with other devices.
663
664          {
665              "id": 1,
666              "globalID": 1,
667              "type": "StartupComplete",
668              "time": "2014-07-13T21:03:18.383239179+02:00",
669              "data": null
670          }
671
672   StateChanged
673       Emitted  when  a  folder changes state. Possible states are idle, scan‐
674       ning, syncing and error. The field duration is the  number  of  seconds
675       the  folder  spent  in  state  from.  In  the example below, the folder
676       default was in state scanning for 0.198 seconds and  is  now  in  state
677       idle.
678
679          {
680              "id": 8,
681              "globalID": 8,
682              "type": "StateChanged",
683              "time": "2014-07-17T13:14:28.697493016+02:00",
684              "data": {
685                  "folder": "default",
686                  "from": "scanning",
687                  "duration": 0.19782869900000002,
688                  "to": "idle"
689              }
690          }
691

AUTHOR

693       The Syncthing Authors
694
696       2014-2019, The Syncthing Authors
697
698
699
700
701v1                               Feb 17, 2021           SYNCTHING-EVENT-API(7)
Impressum