github.com/artpar/rclone@v1.67.3/docs/content/rc.md (about) 1 --- 2 title: "Remote Control / API" 3 description: "Remote controlling rclone with its API" 4 versionIntroduced: "v1.40" 5 --- 6 7 # Remote controlling rclone with its API 8 9 If rclone is run with the `--rc` flag then it starts an HTTP server 10 which can be used to remote control rclone using its API. 11 12 You can either use the [rc](#api-rc) command to access the API 13 or [use HTTP directly](#api-http). 14 15 If you just want to run a remote control then see the [rcd](/commands/rclone_rcd/) command. 16 17 ## Supported parameters 18 19 ### --rc 20 21 Flag to start the http server listen on remote requests 22 23 ### --rc-addr=IP 24 25 IPaddress:Port or :Port to bind server to. (default "localhost:5572") 26 27 ### --rc-cert=KEY 28 SSL PEM key (concatenation of certificate and CA certificate) 29 30 ### --rc-client-ca=PATH 31 Client certificate authority to verify clients with 32 33 ### --rc-htpasswd=PATH 34 35 htpasswd file - if not provided no authentication is done 36 37 ### --rc-key=PATH 38 39 SSL PEM Private key 40 41 ### --rc-max-header-bytes=VALUE 42 43 Maximum size of request header (default 4096) 44 45 ### --rc-min-tls-version=VALUE 46 47 The minimum TLS version that is acceptable. Valid values are "tls1.0", 48 "tls1.1", "tls1.2" and "tls1.3" (default "tls1.0"). 49 50 ### --rc-user=VALUE 51 52 User name for authentication. 53 54 ### --rc-pass=VALUE 55 56 Password for authentication. 57 58 ### --rc-realm=VALUE 59 60 Realm for authentication (default "rclone") 61 62 ### --rc-server-read-timeout=DURATION 63 64 Timeout for server reading data (default 1h0m0s) 65 66 ### --rc-server-write-timeout=DURATION 67 68 Timeout for server writing data (default 1h0m0s) 69 70 ### --rc-serve 71 72 Enable the serving of remote objects via the HTTP interface. This 73 means objects will be accessible at http://127.0.0.1:5572/ by default, 74 so you can browse to http://127.0.0.1:5572/ or http://127.0.0.1:5572/* 75 to see a listing of the remotes. Objects may be requested from 76 remotes using this syntax http://127.0.0.1:5572/[remote:path]/path/to/object 77 78 Default Off. 79 80 ### --rc-serve-no-modtime 81 82 Set this flag to skip reading the modification time (can speed things up). 83 84 Default Off. 85 86 ### --rc-files /path/to/directory 87 88 Path to local files to serve on the HTTP server. 89 90 If this is set then rclone will serve the files in that directory. It 91 will also open the root in the web browser if specified. This is for 92 implementing browser based GUIs for rclone functions. 93 94 If `--rc-user` or `--rc-pass` is set then the URL that is opened will 95 have the authorization in the URL in the `http://user:pass@localhost/` 96 style. 97 98 Default Off. 99 100 ### --rc-enable-metrics 101 102 Enable OpenMetrics/Prometheus compatible endpoint at `/metrics`. 103 104 Default Off. 105 106 ### --rc-web-gui 107 108 Set this flag to serve the default web gui on the same port as rclone. 109 110 Default Off. 111 112 ### --rc-allow-origin 113 114 Set the allowed Access-Control-Allow-Origin for rc requests. 115 116 Can be used with --rc-web-gui if the rclone is running on different IP than the web-gui. 117 118 Default is IP address on which rc is running. 119 120 ### --rc-web-fetch-url 121 122 Set the URL to fetch the rclone-web-gui files from. 123 124 Default https://api.github.com/repos/artpar/artpar-webui-react/releases/latest. 125 126 ### --rc-web-gui-update 127 128 Set this flag to check and update rclone-webui-react from the rc-web-fetch-url. 129 130 Default Off. 131 132 ### --rc-web-gui-force-update 133 134 Set this flag to force update rclone-webui-react from the rc-web-fetch-url. 135 136 Default Off. 137 138 ### --rc-web-gui-no-open-browser 139 140 Set this flag to disable opening browser automatically when using web-gui. 141 142 Default Off. 143 144 ### --rc-job-expire-duration=DURATION 145 146 Expire finished async jobs older than DURATION (default 60s). 147 148 ### --rc-job-expire-interval=DURATION 149 150 Interval duration to check for expired async jobs (default 10s). 151 152 ### --rc-no-auth 153 154 By default rclone will require authorisation to have been set up on 155 the rc interface in order to use any methods which access any rclone 156 remotes. Eg `operations/list` is denied as it involved creating a 157 remote as is `sync/copy`. 158 159 If this is set then no authorisation will be required on the server to 160 use these methods. The alternative is to use `--rc-user` and 161 `--rc-pass` and use these credentials in the request. 162 163 Default Off. 164 165 ### --rc-baseurl 166 167 Prefix for URLs. 168 169 Default is root 170 171 ### --rc-template 172 173 User-specified template. 174 175 ## Accessing the remote control via the rclone rc command {#api-rc} 176 177 Rclone itself implements the remote control protocol in its `rclone 178 rc` command. 179 180 You can use it like this 181 182 ``` 183 $ rclone rc rc/noop param1=one param2=two 184 { 185 "param1": "one", 186 "param2": "two" 187 } 188 ``` 189 190 Run `rclone rc` on its own to see the help for the installed remote 191 control commands. 192 193 ## JSON input 194 195 `rclone rc` also supports a `--json` flag which can be used to send 196 more complicated input parameters. 197 198 ``` 199 $ rclone rc --json '{ "p1": [1,"2",null,4], "p2": { "a":1, "b":2 } }' rc/noop 200 { 201 "p1": [ 202 1, 203 "2", 204 null, 205 4 206 ], 207 "p2": { 208 "a": 1, 209 "b": 2 210 } 211 } 212 ``` 213 214 If the parameter being passed is an object then it can be passed as a 215 JSON string rather than using the `--json` flag which simplifies the 216 command line. 217 218 ``` 219 rclone rc operations/list fs=/tmp remote=test opt='{"showHash": true}' 220 ``` 221 222 Rather than 223 224 ``` 225 rclone rc operations/list --json '{"fs": "/tmp", "remote": "test", "opt": {"showHash": true}}' 226 ``` 227 228 ## Special parameters 229 230 The rc interface supports some special parameters which apply to 231 **all** commands. These start with `_` to show they are different. 232 233 ### Running asynchronous jobs with _async = true 234 235 Each rc call is classified as a job and it is assigned its own id. By default 236 jobs are executed immediately as they are created or synchronously. 237 238 If `_async` has a true value when supplied to an rc call then it will 239 return immediately with a job id and the task will be run in the 240 background. The `job/status` call can be used to get information of 241 the background job. The job can be queried for up to 1 minute after 242 it has finished. 243 244 It is recommended that potentially long running jobs, e.g. `sync/sync`, 245 `sync/copy`, `sync/move`, `operations/purge` are run with the `_async` 246 flag to avoid any potential problems with the HTTP request and 247 response timing out. 248 249 Starting a job with the `_async` flag: 250 251 ``` 252 $ rclone rc --json '{ "p1": [1,"2",null,4], "p2": { "a":1, "b":2 }, "_async": true }' rc/noop 253 { 254 "jobid": 2 255 } 256 ``` 257 258 Query the status to see if the job has finished. For more information 259 on the meaning of these return parameters see the `job/status` call. 260 261 ``` 262 $ rclone rc --json '{ "jobid":2 }' job/status 263 { 264 "duration": 0.000124163, 265 "endTime": "2018-10-27T11:38:07.911245881+01:00", 266 "error": "", 267 "finished": true, 268 "id": 2, 269 "output": { 270 "_async": true, 271 "p1": [ 272 1, 273 "2", 274 null, 275 4 276 ], 277 "p2": { 278 "a": 1, 279 "b": 2 280 } 281 }, 282 "startTime": "2018-10-27T11:38:07.911121728+01:00", 283 "success": true 284 } 285 ``` 286 287 `job/list` can be used to show the running or recently completed jobs 288 289 ``` 290 $ rclone rc job/list 291 { 292 "jobids": [ 293 2 294 ] 295 } 296 ``` 297 298 ### Setting config flags with _config 299 300 If you wish to set config (the equivalent of the global flags) for the 301 duration of an rc call only then pass in the `_config` parameter. 302 303 This should be in the same format as the `config` key returned by 304 [options/get](#options-get). 305 306 For example, if you wished to run a sync with the `--checksum` 307 parameter, you would pass this parameter in your JSON blob. 308 309 "_config":{"CheckSum": true} 310 311 If using `rclone rc` this could be passed as 312 313 rclone rc sync/sync ... _config='{"CheckSum": true}' 314 315 Any config parameters you don't set will inherit the global defaults 316 which were set with command line flags or environment variables. 317 318 Note that it is possible to set some values as strings or integers - 319 see [data types](#data-types) for more info. Here is an example 320 setting the equivalent of `--buffer-size` in string or integer format. 321 322 "_config":{"BufferSize": "42M"} 323 "_config":{"BufferSize": 44040192} 324 325 If you wish to check the `_config` assignment has worked properly then 326 calling `options/local` will show what the value got set to. 327 328 ### Setting filter flags with _filter 329 330 If you wish to set filters for the duration of an rc call only then 331 pass in the `_filter` parameter. 332 333 This should be in the same format as the `filter` key returned by 334 [options/get](#options-get). 335 336 For example, if you wished to run a sync with these flags 337 338 --max-size 1M --max-age 42s --include "a" --include "b" 339 340 you would pass this parameter in your JSON blob. 341 342 "_filter":{"MaxSize":"1M", "IncludeRule":["a","b"], "MaxAge":"42s"} 343 344 If using `rclone rc` this could be passed as 345 346 rclone rc ... _filter='{"MaxSize":"1M", "IncludeRule":["a","b"], "MaxAge":"42s"}' 347 348 Any filter parameters you don't set will inherit the global defaults 349 which were set with command line flags or environment variables. 350 351 Note that it is possible to set some values as strings or integers - 352 see [data types](#data-types) for more info. Here is an example 353 setting the equivalent of `--buffer-size` in string or integer format. 354 355 "_filter":{"MinSize": "42M"} 356 "_filter":{"MinSize": 44040192} 357 358 If you wish to check the `_filter` assignment has worked properly then 359 calling `options/local` will show what the value got set to. 360 361 ### Assigning operations to groups with _group = value 362 363 Each rc call has its own stats group for tracking its metrics. By default 364 grouping is done by the composite group name from prefix `job/` and id of the 365 job like so `job/1`. 366 367 If `_group` has a value then stats for that request will be grouped under that 368 value. This allows caller to group stats under their own name. 369 370 Stats for specific group can be accessed by passing `group` to `core/stats`: 371 372 ``` 373 $ rclone rc --json '{ "group": "job/1" }' core/stats 374 { 375 "speed": 12345 376 ... 377 } 378 ``` 379 380 ## Data types {#data-types} 381 382 When the API returns types, these will mostly be straight forward 383 integer, string or boolean types. 384 385 However some of the types returned by the [options/get](#options-get) 386 call and taken by the [options/set](#options-set) calls as well as the 387 `vfsOpt`, `mountOpt` and the `_config` parameters. 388 389 - `Duration` - these are returned as an integer duration in 390 nanoseconds. They may be set as an integer, or they may be set with 391 time string, eg "5s". See the [options section](/docs/#options) for 392 more info. 393 - `Size` - these are returned as an integer number of bytes. They may 394 be set as an integer or they may be set with a size suffix string, 395 eg "10M". See the [options section](/docs/#options) for more info. 396 - Enumerated type (such as `CutoffMode`, `DumpFlags`, `LogLevel`, 397 `VfsCacheMode` - these will be returned as an integer and may be set 398 as an integer but more conveniently they can be set as a string, eg 399 "HARD" for `CutoffMode` or `DEBUG` for `LogLevel`. 400 - `BandwidthSpec` - this will be set and returned as a string, eg 401 "1M". 402 403 ## Specifying remotes to work on 404 405 Remotes are specified with the `fs=`, `srcFs=`, `dstFs=` 406 parameters depending on the command being used. 407 408 The parameters can be a string as per the rest of rclone, eg 409 `s3:bucket/path` or `:sftp:/my/dir`. They can also be specified as 410 JSON blobs. 411 412 If specifying a JSON blob it should be a object mapping strings to 413 strings. These values will be used to configure the remote. There are 414 3 special values which may be set: 415 416 - `type` - set to `type` to specify a remote called `:type:` 417 - `_name` - set to `name` to specify a remote called `name:` 418 - `_root` - sets the root of the remote - may be empty 419 420 One of `_name` or `type` should normally be set. If the `local` 421 backend is desired then `type` should be set to `local`. If `_root` 422 isn't specified then it defaults to the root of the remote. 423 424 For example this JSON is equivalent to `remote:/tmp` 425 426 ``` 427 { 428 "_name": "remote", 429 "_path": "/tmp" 430 } 431 ``` 432 433 And this is equivalent to `:sftp,host='example.com':/tmp` 434 435 ``` 436 { 437 "type": "sftp", 438 "host": "example.com", 439 "_path": "/tmp" 440 } 441 ``` 442 443 And this is equivalent to `/tmp/dir` 444 445 ``` 446 { 447 type = "local", 448 _ path = "/tmp/dir" 449 } 450 ``` 451 452 ## Supported commands 453 {{< rem autogenerated start "- run make rcdocs - don't edit here" >}} 454 ### backend/command: Runs a backend command. {#backend-command} 455 456 This takes the following parameters: 457 458 - command - a string with the command name 459 - fs - a remote name string e.g. "drive:" 460 - arg - a list of arguments for the backend command 461 - opt - a map of string to string of options 462 463 Returns: 464 465 - result - result from the backend command 466 467 Example: 468 469 rclone rc backend/command command=noop fs=. -o echo=yes -o blue -a path1 -a path2 470 471 Returns 472 473 ``` 474 { 475 "result": { 476 "arg": [ 477 "path1", 478 "path2" 479 ], 480 "name": "noop", 481 "opt": { 482 "blue": "", 483 "echo": "yes" 484 } 485 } 486 } 487 ``` 488 489 Note that this is the direct equivalent of using this "backend" 490 command: 491 492 rclone backend noop . -o echo=yes -o blue path1 path2 493 494 Note that arguments must be preceded by the "-a" flag 495 496 See the [backend](/commands/rclone_backend/) command for more information. 497 498 **Authentication is required for this call.** 499 500 ### cache/expire: Purge a remote from cache {#cache-expire} 501 502 Purge a remote from the cache backend. Supports either a directory or a file. 503 Params: 504 - remote = path to remote (required) 505 - withData = true/false to delete cached data (chunks) as well (optional) 506 507 Eg 508 509 rclone rc cache/expire remote=path/to/sub/folder/ 510 rclone rc cache/expire remote=/ withData=true 511 512 ### cache/fetch: Fetch file chunks {#cache-fetch} 513 514 Ensure the specified file chunks are cached on disk. 515 516 The chunks= parameter specifies the file chunks to check. 517 It takes a comma separated list of array slice indices. 518 The slice indices are similar to Python slices: start[:end] 519 520 start is the 0 based chunk number from the beginning of the file 521 to fetch inclusive. end is 0 based chunk number from the beginning 522 of the file to fetch exclusive. 523 Both values can be negative, in which case they count from the back 524 of the file. The value "-5:" represents the last 5 chunks of a file. 525 526 Some valid examples are: 527 ":5,-5:" -> the first and last five chunks 528 "0,-2" -> the first and the second last chunk 529 "0:10" -> the first ten chunks 530 531 Any parameter with a key that starts with "file" can be used to 532 specify files to fetch, e.g. 533 534 rclone rc cache/fetch chunks=0 file=hello file2=home/goodbye 535 536 File names will automatically be encrypted when the a crypt remote 537 is used on top of the cache. 538 539 ### cache/stats: Get cache stats {#cache-stats} 540 541 Show statistics for the cache remote. 542 543 ### config/create: create the config for a remote. {#config-create} 544 545 This takes the following parameters: 546 547 - name - name of remote 548 - parameters - a map of \{ "key": "value" \} pairs 549 - type - type of the new remote 550 - opt - a dictionary of options to control the configuration 551 - obscure - declare passwords are plain and need obscuring 552 - noObscure - declare passwords are already obscured and don't need obscuring 553 - nonInteractive - don't interact with a user, return questions 554 - continue - continue the config process with an answer 555 - all - ask all the config questions not just the post config ones 556 - state - state to restart with - used with continue 557 - result - result to restart with - used with continue 558 559 560 See the [config create](/commands/rclone_config_create/) command for more information on the above. 561 562 **Authentication is required for this call.** 563 564 ### config/delete: Delete a remote in the config file. {#config-delete} 565 566 Parameters: 567 568 - name - name of remote to delete 569 570 See the [config delete](/commands/rclone_config_delete/) command for more information on the above. 571 572 **Authentication is required for this call.** 573 574 ### config/dump: Dumps the config file. {#config-dump} 575 576 Returns a JSON object: 577 - key: value 578 579 Where keys are remote names and values are the config parameters. 580 581 See the [config dump](/commands/rclone_config_dump/) command for more information on the above. 582 583 **Authentication is required for this call.** 584 585 ### config/get: Get a remote in the config file. {#config-get} 586 587 Parameters: 588 589 - name - name of remote to get 590 591 See the [config dump](/commands/rclone_config_dump/) command for more information on the above. 592 593 **Authentication is required for this call.** 594 595 ### config/listremotes: Lists the remotes in the config file and defined in environment variables. {#config-listremotes} 596 597 Returns 598 - remotes - array of remote names 599 600 See the [listremotes](/commands/rclone_listremotes/) command for more information on the above. 601 602 **Authentication is required for this call.** 603 604 ### config/password: password the config for a remote. {#config-password} 605 606 This takes the following parameters: 607 608 - name - name of remote 609 - parameters - a map of \{ "key": "value" \} pairs 610 611 612 See the [config password](/commands/rclone_config_password/) command for more information on the above. 613 614 **Authentication is required for this call.** 615 616 ### config/paths: Reads the config file path and other important paths. {#config-paths} 617 618 Returns a JSON object with the following keys: 619 620 - config: path to config file 621 - cache: path to root of cache directory 622 - temp: path to root of temporary directory 623 624 Eg 625 626 { 627 "cache": "/home/USER/.cache/rclone", 628 "config": "/home/USER/.rclone.conf", 629 "temp": "/tmp" 630 } 631 632 See the [config paths](/commands/rclone_config_paths/) command for more information on the above. 633 634 **Authentication is required for this call.** 635 636 ### config/providers: Shows how providers are configured in the config file. {#config-providers} 637 638 Returns a JSON object: 639 - providers - array of objects 640 641 See the [config providers](/commands/rclone_config_providers/) command for more information on the above. 642 643 **Authentication is required for this call.** 644 645 ### config/setpath: Set the path of the config file {#config-setpath} 646 647 Parameters: 648 649 - path - path to the config file to use 650 651 **Authentication is required for this call.** 652 653 ### config/update: update the config for a remote. {#config-update} 654 655 This takes the following parameters: 656 657 - name - name of remote 658 - parameters - a map of \{ "key": "value" \} pairs 659 - opt - a dictionary of options to control the configuration 660 - obscure - declare passwords are plain and need obscuring 661 - noObscure - declare passwords are already obscured and don't need obscuring 662 - nonInteractive - don't interact with a user, return questions 663 - continue - continue the config process with an answer 664 - all - ask all the config questions not just the post config ones 665 - state - state to restart with - used with continue 666 - result - result to restart with - used with continue 667 668 669 See the [config update](/commands/rclone_config_update/) command for more information on the above. 670 671 **Authentication is required for this call.** 672 673 ### core/bwlimit: Set the bandwidth limit. {#core-bwlimit} 674 675 This sets the bandwidth limit to the string passed in. This should be 676 a single bandwidth limit entry or a pair of upload:download bandwidth. 677 678 Eg 679 680 rclone rc core/bwlimit rate=off 681 { 682 "bytesPerSecond": -1, 683 "bytesPerSecondTx": -1, 684 "bytesPerSecondRx": -1, 685 "rate": "off" 686 } 687 rclone rc core/bwlimit rate=1M 688 { 689 "bytesPerSecond": 1048576, 690 "bytesPerSecondTx": 1048576, 691 "bytesPerSecondRx": 1048576, 692 "rate": "1M" 693 } 694 rclone rc core/bwlimit rate=1M:100k 695 { 696 "bytesPerSecond": 1048576, 697 "bytesPerSecondTx": 1048576, 698 "bytesPerSecondRx": 131072, 699 "rate": "1M" 700 } 701 702 703 If the rate parameter is not supplied then the bandwidth is queried 704 705 rclone rc core/bwlimit 706 { 707 "bytesPerSecond": 1048576, 708 "bytesPerSecondTx": 1048576, 709 "bytesPerSecondRx": 1048576, 710 "rate": "1M" 711 } 712 713 The format of the parameter is exactly the same as passed to --bwlimit 714 except only one bandwidth may be specified. 715 716 In either case "rate" is returned as a human-readable string, and 717 "bytesPerSecond" is returned as a number. 718 719 ### core/command: Run a rclone terminal command over rc. {#core-command} 720 721 This takes the following parameters: 722 723 - command - a string with the command name. 724 - arg - a list of arguments for the backend command. 725 - opt - a map of string to string of options. 726 - returnType - one of ("COMBINED_OUTPUT", "STREAM", "STREAM_ONLY_STDOUT", "STREAM_ONLY_STDERR"). 727 - Defaults to "COMBINED_OUTPUT" if not set. 728 - The STREAM returnTypes will write the output to the body of the HTTP message. 729 - The COMBINED_OUTPUT will write the output to the "result" parameter. 730 731 Returns: 732 733 - result - result from the backend command. 734 - Only set when using returnType "COMBINED_OUTPUT". 735 - error - set if rclone exits with an error code. 736 - returnType - one of ("COMBINED_OUTPUT", "STREAM", "STREAM_ONLY_STDOUT", "STREAM_ONLY_STDERR"). 737 738 Example: 739 740 rclone rc core/command command=ls -a mydrive:/ -o max-depth=1 741 rclone rc core/command -a ls -a mydrive:/ -o max-depth=1 742 743 Returns: 744 745 ``` 746 { 747 "error": false, 748 "result": "<Raw command line output>" 749 } 750 751 OR 752 { 753 "error": true, 754 "result": "<Raw command line output>" 755 } 756 757 ``` 758 759 **Authentication is required for this call.** 760 761 ### core/du: Returns disk usage of a locally attached disk. {#core-du} 762 763 This returns the disk usage for the local directory passed in as dir. 764 765 If the directory is not passed in, it defaults to the directory 766 pointed to by --cache-dir. 767 768 - dir - string (optional) 769 770 Returns: 771 772 ``` 773 { 774 "dir": "/", 775 "info": { 776 "Available": 361769115648, 777 "Free": 361785892864, 778 "Total": 982141468672 779 } 780 } 781 ``` 782 783 ### core/gc: Runs a garbage collection. {#core-gc} 784 785 This tells the go runtime to do a garbage collection run. It isn't 786 necessary to call this normally, but it can be useful for debugging 787 memory problems. 788 789 ### core/group-list: Returns list of stats. {#core-group-list} 790 791 This returns list of stats groups currently in memory. 792 793 Returns the following values: 794 ``` 795 { 796 "groups": an array of group names: 797 [ 798 "group1", 799 "group2", 800 ... 801 ] 802 } 803 ``` 804 805 ### core/memstats: Returns the memory statistics {#core-memstats} 806 807 This returns the memory statistics of the running program. What the values mean 808 are explained in the go docs: https://golang.org/pkg/runtime/#MemStats 809 810 The most interesting values for most people are: 811 812 - HeapAlloc - this is the amount of memory rclone is actually using 813 - HeapSys - this is the amount of memory rclone has obtained from the OS 814 - Sys - this is the total amount of memory requested from the OS 815 - It is virtual memory so may include unused memory 816 817 ### core/obscure: Obscures a string passed in. {#core-obscure} 818 819 Pass a clear string and rclone will obscure it for the config file: 820 - clear - string 821 822 Returns: 823 - obscured - string 824 825 ### core/pid: Return PID of current process {#core-pid} 826 827 This returns PID of current process. 828 Useful for stopping rclone process. 829 830 ### core/quit: Terminates the app. {#core-quit} 831 832 (Optional) Pass an exit code to be used for terminating the app: 833 - exitCode - int 834 835 ### core/stats: Returns stats about current transfers. {#core-stats} 836 837 This returns all available stats: 838 839 rclone rc core/stats 840 841 If group is not provided then summed up stats for all groups will be 842 returned. 843 844 Parameters 845 846 - group - name of the stats group (string) 847 848 Returns the following values: 849 850 ``` 851 { 852 "bytes": total transferred bytes since the start of the group, 853 "checks": number of files checked, 854 "deletes" : number of files deleted, 855 "elapsedTime": time in floating point seconds since rclone was started, 856 "errors": number of errors, 857 "eta": estimated time in seconds until the group completes, 858 "fatalError": boolean whether there has been at least one fatal error, 859 "lastError": last error string, 860 "renames" : number of files renamed, 861 "retryError": boolean showing whether there has been at least one non-NoRetryError, 862 "serverSideCopies": number of server side copies done, 863 "serverSideCopyBytes": number bytes server side copied, 864 "serverSideMoves": number of server side moves done, 865 "serverSideMoveBytes": number bytes server side moved, 866 "speed": average speed in bytes per second since start of the group, 867 "totalBytes": total number of bytes in the group, 868 "totalChecks": total number of checks in the group, 869 "totalTransfers": total number of transfers in the group, 870 "transferTime" : total time spent on running jobs, 871 "transfers": number of transferred files, 872 "transferring": an array of currently active file transfers: 873 [ 874 { 875 "bytes": total transferred bytes for this file, 876 "eta": estimated time in seconds until file transfer completion 877 "name": name of the file, 878 "percentage": progress of the file transfer in percent, 879 "speed": average speed over the whole transfer in bytes per second, 880 "speedAvg": current speed in bytes per second as an exponentially weighted moving average, 881 "size": size of the file in bytes 882 } 883 ], 884 "checking": an array of names of currently active file checks 885 [] 886 } 887 ``` 888 Values for "transferring", "checking" and "lastError" are only assigned if data is available. 889 The value for "eta" is null if an eta cannot be determined. 890 891 ### core/stats-delete: Delete stats group. {#core-stats-delete} 892 893 This deletes entire stats group. 894 895 Parameters 896 897 - group - name of the stats group (string) 898 899 ### core/stats-reset: Reset stats. {#core-stats-reset} 900 901 This clears counters, errors and finished transfers for all stats or specific 902 stats group if group is provided. 903 904 Parameters 905 906 - group - name of the stats group (string) 907 908 ### core/transferred: Returns stats about completed transfers. {#core-transferred} 909 910 This returns stats about completed transfers: 911 912 rclone rc core/transferred 913 914 If group is not provided then completed transfers for all groups will be 915 returned. 916 917 Note only the last 100 completed transfers are returned. 918 919 Parameters 920 921 - group - name of the stats group (string) 922 923 Returns the following values: 924 ``` 925 { 926 "transferred": an array of completed transfers (including failed ones): 927 [ 928 { 929 "name": name of the file, 930 "size": size of the file in bytes, 931 "bytes": total transferred bytes for this file, 932 "checked": if the transfer is only checked (skipped, deleted), 933 "timestamp": integer representing millisecond unix epoch, 934 "error": string description of the error (empty if successful), 935 "jobid": id of the job that this transfer belongs to 936 } 937 ] 938 } 939 ``` 940 941 ### core/version: Shows the current version of rclone and the go runtime. {#core-version} 942 943 This shows the current version of go and the go runtime: 944 945 - version - rclone version, e.g. "v1.53.0" 946 - decomposed - version number as [major, minor, patch] 947 - isGit - boolean - true if this was compiled from the git version 948 - isBeta - boolean - true if this is a beta version 949 - os - OS in use as according to Go 950 - arch - cpu architecture in use according to Go 951 - goVersion - version of Go runtime in use 952 - linking - type of rclone executable (static or dynamic) 953 - goTags - space separated build tags or "none" 954 955 ### debug/set-block-profile-rate: Set runtime.SetBlockProfileRate for blocking profiling. {#debug-set-block-profile-rate} 956 957 SetBlockProfileRate controls the fraction of goroutine blocking events 958 that are reported in the blocking profile. The profiler aims to sample 959 an average of one blocking event per rate nanoseconds spent blocked. 960 961 To include every blocking event in the profile, pass rate = 1. To turn 962 off profiling entirely, pass rate <= 0. 963 964 After calling this you can use this to see the blocking profile: 965 966 go tool pprof http://localhost:5572/debug/pprof/block 967 968 Parameters: 969 970 - rate - int 971 972 ### debug/set-gc-percent: Call runtime/debug.SetGCPercent for setting the garbage collection target percentage. {#debug-set-gc-percent} 973 974 SetGCPercent sets the garbage collection target percentage: a collection is triggered 975 when the ratio of freshly allocated data to live data remaining after the previous collection 976 reaches this percentage. SetGCPercent returns the previous setting. The initial setting is the 977 value of the GOGC environment variable at startup, or 100 if the variable is not set. 978 979 This setting may be effectively reduced in order to maintain a memory limit. 980 A negative percentage effectively disables garbage collection, unless the memory limit is reached. 981 982 See https://pkg.go.dev/runtime/debug#SetMemoryLimit for more details. 983 984 Parameters: 985 986 - gc-percent - int 987 988 ### debug/set-mutex-profile-fraction: Set runtime.SetMutexProfileFraction for mutex profiling. {#debug-set-mutex-profile-fraction} 989 990 SetMutexProfileFraction controls the fraction of mutex contention 991 events that are reported in the mutex profile. On average 1/rate 992 events are reported. The previous rate is returned. 993 994 To turn off profiling entirely, pass rate 0. To just read the current 995 rate, pass rate < 0. (For n>1 the details of sampling may change.) 996 997 Once this is set you can look use this to profile the mutex contention: 998 999 go tool pprof http://localhost:5572/debug/pprof/mutex 1000 1001 Parameters: 1002 1003 - rate - int 1004 1005 Results: 1006 1007 - previousRate - int 1008 1009 ### debug/set-soft-memory-limit: Call runtime/debug.SetMemoryLimit for setting a soft memory limit for the runtime. {#debug-set-soft-memory-limit} 1010 1011 SetMemoryLimit provides the runtime with a soft memory limit. 1012 1013 The runtime undertakes several processes to try to respect this memory limit, including 1014 adjustments to the frequency of garbage collections and returning memory to the underlying 1015 system more aggressively. This limit will be respected even if GOGC=off (or, if SetGCPercent(-1) is executed). 1016 1017 The input limit is provided as bytes, and includes all memory mapped, managed, and not 1018 released by the Go runtime. Notably, it does not account for space used by the Go binary 1019 and memory external to Go, such as memory managed by the underlying system on behalf of 1020 the process, or memory managed by non-Go code inside the same process. 1021 Examples of excluded memory sources include: OS kernel memory held on behalf of the process, 1022 memory allocated by C code, and memory mapped by syscall.Mmap (because it is not managed by the Go runtime). 1023 1024 A zero limit or a limit that's lower than the amount of memory used by the Go runtime may cause 1025 the garbage collector to run nearly continuously. However, the application may still make progress. 1026 1027 The memory limit is always respected by the Go runtime, so to effectively disable this behavior, 1028 set the limit very high. math.MaxInt64 is the canonical value for disabling the limit, but values 1029 much greater than the available memory on the underlying system work just as well. 1030 1031 See https://go.dev/doc/gc-guide for a detailed guide explaining the soft memory limit in more detail, 1032 as well as a variety of common use-cases and scenarios. 1033 1034 SetMemoryLimit returns the previously set memory limit. A negative input does not adjust the limit, 1035 and allows for retrieval of the currently set memory limit. 1036 1037 Parameters: 1038 1039 - mem-limit - int 1040 1041 ### fscache/clear: Clear the Fs cache. {#fscache-clear} 1042 1043 This clears the fs cache. This is where remotes created from backends 1044 are cached for a short while to make repeated rc calls more efficient. 1045 1046 If you change the parameters of a backend then you may want to call 1047 this to clear an existing remote out of the cache before re-creating 1048 it. 1049 1050 **Authentication is required for this call.** 1051 1052 ### fscache/entries: Returns the number of entries in the fs cache. {#fscache-entries} 1053 1054 This returns the number of entries in the fs cache. 1055 1056 Returns 1057 - entries - number of items in the cache 1058 1059 **Authentication is required for this call.** 1060 1061 ### job/list: Lists the IDs of the running jobs {#job-list} 1062 1063 Parameters: None. 1064 1065 Results: 1066 1067 - executeId - string id of rclone executing (change after restart) 1068 - jobids - array of integer job ids (starting at 1 on each restart) 1069 1070 ### job/status: Reads the status of the job ID {#job-status} 1071 1072 Parameters: 1073 1074 - jobid - id of the job (integer). 1075 1076 Results: 1077 1078 - finished - boolean 1079 - duration - time in seconds that the job ran for 1080 - endTime - time the job finished (e.g. "2018-10-26T18:50:20.528746884+01:00") 1081 - error - error from the job or empty string for no error 1082 - finished - boolean whether the job has finished or not 1083 - id - as passed in above 1084 - startTime - time the job started (e.g. "2018-10-26T18:50:20.528336039+01:00") 1085 - success - boolean - true for success false otherwise 1086 - output - output of the job as would have been returned if called synchronously 1087 - progress - output of the progress related to the underlying job 1088 1089 ### job/stop: Stop the running job {#job-stop} 1090 1091 Parameters: 1092 1093 - jobid - id of the job (integer). 1094 1095 ### job/stopgroup: Stop all running jobs in a group {#job-stopgroup} 1096 1097 Parameters: 1098 1099 - group - name of the group (string). 1100 1101 ### mount/listmounts: Show current mount points {#mount-listmounts} 1102 1103 This shows currently mounted points, which can be used for performing an unmount. 1104 1105 This takes no parameters and returns 1106 1107 - mountPoints: list of current mount points 1108 1109 Eg 1110 1111 rclone rc mount/listmounts 1112 1113 **Authentication is required for this call.** 1114 1115 ### mount/mount: Create a new mount point {#mount-mount} 1116 1117 rclone allows Linux, FreeBSD, macOS and Windows to mount any of 1118 Rclone's cloud storage systems as a file system with FUSE. 1119 1120 If no mountType is provided, the priority is given as follows: 1. mount 2.cmount 3.mount2 1121 1122 This takes the following parameters: 1123 1124 - fs - a remote path to be mounted (required) 1125 - mountPoint: valid path on the local machine (required) 1126 - mountType: one of the values (mount, cmount, mount2) specifies the mount implementation to use 1127 - mountOpt: a JSON object with Mount options in. 1128 - vfsOpt: a JSON object with VFS options in. 1129 1130 Example: 1131 1132 rclone rc mount/mount fs=mydrive: mountPoint=/home/<user>/mountPoint 1133 rclone rc mount/mount fs=mydrive: mountPoint=/home/<user>/mountPoint mountType=mount 1134 rclone rc mount/mount fs=TestDrive: mountPoint=/mnt/tmp vfsOpt='{"CacheMode": 2}' mountOpt='{"AllowOther": true}' 1135 1136 The vfsOpt are as described in options/get and can be seen in the the 1137 "vfs" section when running and the mountOpt can be seen in the "mount" section: 1138 1139 rclone rc options/get 1140 1141 **Authentication is required for this call.** 1142 1143 ### mount/types: Show all possible mount types {#mount-types} 1144 1145 This shows all possible mount types and returns them as a list. 1146 1147 This takes no parameters and returns 1148 1149 - mountTypes: list of mount types 1150 1151 The mount types are strings like "mount", "mount2", "cmount" and can 1152 be passed to mount/mount as the mountType parameter. 1153 1154 Eg 1155 1156 rclone rc mount/types 1157 1158 **Authentication is required for this call.** 1159 1160 ### mount/unmount: Unmount selected active mount {#mount-unmount} 1161 1162 rclone allows Linux, FreeBSD, macOS and Windows to 1163 mount any of Rclone's cloud storage systems as a file system with 1164 FUSE. 1165 1166 This takes the following parameters: 1167 1168 - mountPoint: valid path on the local machine where the mount was created (required) 1169 1170 Example: 1171 1172 rclone rc mount/unmount mountPoint=/home/<user>/mountPoint 1173 1174 **Authentication is required for this call.** 1175 1176 ### mount/unmountall: Unmount all active mounts {#mount-unmountall} 1177 1178 rclone allows Linux, FreeBSD, macOS and Windows to 1179 mount any of Rclone's cloud storage systems as a file system with 1180 FUSE. 1181 1182 This takes no parameters and returns error if unmount does not succeed. 1183 1184 Eg 1185 1186 rclone rc mount/unmountall 1187 1188 **Authentication is required for this call.** 1189 1190 ### operations/about: Return the space used on the remote {#operations-about} 1191 1192 This takes the following parameters: 1193 1194 - fs - a remote name string e.g. "drive:" 1195 1196 The result is as returned from rclone about --json 1197 1198 See the [about](/commands/rclone_about/) command for more information on the above. 1199 1200 **Authentication is required for this call.** 1201 1202 ### operations/check: check the source and destination are the same {#operations-check} 1203 1204 Checks the files in the source and destination match. It compares 1205 sizes and hashes and logs a report of files that don't 1206 match. It doesn't alter the source or destination. 1207 1208 This takes the following parameters: 1209 1210 - srcFs - a remote name string e.g. "drive:" for the source, "/" for local filesystem 1211 - dstFs - a remote name string e.g. "drive2:" for the destination, "/" for local filesystem 1212 - download - check by downloading rather than with hash 1213 - checkFileHash - treat checkFileFs:checkFileRemote as a SUM file with hashes of given type 1214 - checkFileFs - treat checkFileFs:checkFileRemote as a SUM file with hashes of given type 1215 - checkFileRemote - treat checkFileFs:checkFileRemote as a SUM file with hashes of given type 1216 - oneWay - check one way only, source files must exist on remote 1217 - combined - make a combined report of changes (default false) 1218 - missingOnSrc - report all files missing from the source (default true) 1219 - missingOnDst - report all files missing from the destination (default true) 1220 - match - report all matching files (default false) 1221 - differ - report all non-matching files (default true) 1222 - error - report all files with errors (hashing or reading) (default true) 1223 1224 If you supply the download flag, it will download the data from 1225 both remotes and check them against each other on the fly. This can 1226 be useful for remotes that don't support hashes or if you really want 1227 to check all the data. 1228 1229 If you supply the size-only global flag, it will only compare the sizes not 1230 the hashes as well. Use this for a quick check. 1231 1232 If you supply the checkFileHash option with a valid hash name, the 1233 checkFileFs:checkFileRemote must point to a text file in the SUM 1234 format. This treats the checksum file as the source and dstFs as the 1235 destination. Note that srcFs is not used and should not be supplied in 1236 this case. 1237 1238 Returns: 1239 1240 - success - true if no error, false otherwise 1241 - status - textual summary of check, OK or text string 1242 - hashType - hash used in check, may be missing 1243 - combined - array of strings of combined report of changes 1244 - missingOnSrc - array of strings of all files missing from the source 1245 - missingOnDst - array of strings of all files missing from the destination 1246 - match - array of strings of all matching files 1247 - differ - array of strings of all non-matching files 1248 - error - array of strings of all files with errors (hashing or reading) 1249 1250 **Authentication is required for this call.** 1251 1252 ### operations/cleanup: Remove trashed files in the remote or path {#operations-cleanup} 1253 1254 This takes the following parameters: 1255 1256 - fs - a remote name string e.g. "drive:" 1257 1258 See the [cleanup](/commands/rclone_cleanup/) command for more information on the above. 1259 1260 **Authentication is required for this call.** 1261 1262 ### operations/copyfile: Copy a file from source remote to destination remote {#operations-copyfile} 1263 1264 This takes the following parameters: 1265 1266 - srcFs - a remote name string e.g. "drive:" for the source, "/" for local filesystem 1267 - srcRemote - a path within that remote e.g. "file.txt" for the source 1268 - dstFs - a remote name string e.g. "drive2:" for the destination, "/" for local filesystem 1269 - dstRemote - a path within that remote e.g. "file2.txt" for the destination 1270 1271 **Authentication is required for this call.** 1272 1273 ### operations/copyurl: Copy the URL to the object {#operations-copyurl} 1274 1275 This takes the following parameters: 1276 1277 - fs - a remote name string e.g. "drive:" 1278 - remote - a path within that remote e.g. "dir" 1279 - url - string, URL to read from 1280 - autoFilename - boolean, set to true to retrieve destination file name from url 1281 1282 See the [copyurl](/commands/rclone_copyurl/) command for more information on the above. 1283 1284 **Authentication is required for this call.** 1285 1286 ### operations/delete: Remove files in the path {#operations-delete} 1287 1288 This takes the following parameters: 1289 1290 - fs - a remote name string e.g. "drive:" 1291 1292 See the [delete](/commands/rclone_delete/) command for more information on the above. 1293 1294 **Authentication is required for this call.** 1295 1296 ### operations/deletefile: Remove the single file pointed to {#operations-deletefile} 1297 1298 This takes the following parameters: 1299 1300 - fs - a remote name string e.g. "drive:" 1301 - remote - a path within that remote e.g. "dir" 1302 1303 See the [deletefile](/commands/rclone_deletefile/) command for more information on the above. 1304 1305 **Authentication is required for this call.** 1306 1307 ### operations/fsinfo: Return information about the remote {#operations-fsinfo} 1308 1309 This takes the following parameters: 1310 1311 - fs - a remote name string e.g. "drive:" 1312 1313 This returns info about the remote passed in; 1314 1315 ``` 1316 { 1317 // optional features and whether they are available or not 1318 "Features": { 1319 "About": true, 1320 "BucketBased": false, 1321 "BucketBasedRootOK": false, 1322 "CanHaveEmptyDirectories": true, 1323 "CaseInsensitive": false, 1324 "ChangeNotify": false, 1325 "CleanUp": false, 1326 "Command": true, 1327 "Copy": false, 1328 "DirCacheFlush": false, 1329 "DirMove": true, 1330 "Disconnect": false, 1331 "DuplicateFiles": false, 1332 "GetTier": false, 1333 "IsLocal": true, 1334 "ListR": false, 1335 "MergeDirs": false, 1336 "MetadataInfo": true, 1337 "Move": true, 1338 "OpenWriterAt": true, 1339 "PublicLink": false, 1340 "Purge": true, 1341 "PutStream": true, 1342 "PutUnchecked": false, 1343 "ReadMetadata": true, 1344 "ReadMimeType": false, 1345 "ServerSideAcrossConfigs": false, 1346 "SetTier": false, 1347 "SetWrapper": false, 1348 "Shutdown": false, 1349 "SlowHash": true, 1350 "SlowModTime": false, 1351 "UnWrap": false, 1352 "UserInfo": false, 1353 "UserMetadata": true, 1354 "WrapFs": false, 1355 "WriteMetadata": true, 1356 "WriteMimeType": false 1357 }, 1358 // Names of hashes available 1359 "Hashes": [ 1360 "md5", 1361 "sha1", 1362 "whirlpool", 1363 "crc32", 1364 "sha256", 1365 "dropbox", 1366 "mailru", 1367 "quickxor" 1368 ], 1369 "Name": "local", // Name as created 1370 "Precision": 1, // Precision of timestamps in ns 1371 "Root": "/", // Path as created 1372 "String": "Local file system at /", // how the remote will appear in logs 1373 // Information about the system metadata for this backend 1374 "MetadataInfo": { 1375 "System": { 1376 "atime": { 1377 "Help": "Time of last access", 1378 "Type": "RFC 3339", 1379 "Example": "2006-01-02T15:04:05.999999999Z07:00" 1380 }, 1381 "btime": { 1382 "Help": "Time of file birth (creation)", 1383 "Type": "RFC 3339", 1384 "Example": "2006-01-02T15:04:05.999999999Z07:00" 1385 }, 1386 "gid": { 1387 "Help": "Group ID of owner", 1388 "Type": "decimal number", 1389 "Example": "500" 1390 }, 1391 "mode": { 1392 "Help": "File type and mode", 1393 "Type": "octal, unix style", 1394 "Example": "0100664" 1395 }, 1396 "mtime": { 1397 "Help": "Time of last modification", 1398 "Type": "RFC 3339", 1399 "Example": "2006-01-02T15:04:05.999999999Z07:00" 1400 }, 1401 "rdev": { 1402 "Help": "Device ID (if special file)", 1403 "Type": "hexadecimal", 1404 "Example": "1abc" 1405 }, 1406 "uid": { 1407 "Help": "User ID of owner", 1408 "Type": "decimal number", 1409 "Example": "500" 1410 } 1411 }, 1412 "Help": "Textual help string\n" 1413 } 1414 } 1415 ``` 1416 1417 This command does not have a command line equivalent so use this instead: 1418 1419 rclone rc --loopback operations/fsinfo fs=remote: 1420 1421 ### operations/hashsum: Produces a hashsum file for all the objects in the path. {#operations-hashsum} 1422 1423 Produces a hash file for all the objects in the path using the hash 1424 named. The output is in the same format as the standard 1425 md5sum/sha1sum tool. 1426 1427 This takes the following parameters: 1428 1429 - fs - a remote name string e.g. "drive:" for the source, "/" for local filesystem 1430 - this can point to a file and just that file will be returned in the listing. 1431 - hashType - type of hash to be used 1432 - download - check by downloading rather than with hash (boolean) 1433 - base64 - output the hashes in base64 rather than hex (boolean) 1434 1435 If you supply the download flag, it will download the data from the 1436 remote and create the hash on the fly. This can be useful for remotes 1437 that don't support the given hash or if you really want to check all 1438 the data. 1439 1440 Note that if you wish to supply a checkfile to check hashes against 1441 the current files then you should use operations/check instead of 1442 operations/hashsum. 1443 1444 Returns: 1445 1446 - hashsum - array of strings of the hashes 1447 - hashType - type of hash used 1448 1449 Example: 1450 1451 $ rclone rc --loopback operations/hashsum fs=bin hashType=MD5 download=true base64=true 1452 { 1453 "hashType": "md5", 1454 "hashsum": [ 1455 "WTSVLpuiXyJO_kGzJerRLg== backend-versions.sh", 1456 "v1b_OlWCJO9LtNq3EIKkNQ== bisect-go-rclone.sh", 1457 "VHbmHzHh4taXzgag8BAIKQ== bisect-rclone.sh", 1458 ] 1459 } 1460 1461 See the [hashsum](/commands/rclone_hashsum/) command for more information on the above. 1462 1463 **Authentication is required for this call.** 1464 1465 ### operations/list: List the given remote and path in JSON format {#operations-list} 1466 1467 This takes the following parameters: 1468 1469 - fs - a remote name string e.g. "drive:" 1470 - remote - a path within that remote e.g. "dir" 1471 - opt - a dictionary of options to control the listing (optional) 1472 - recurse - If set recurse directories 1473 - noModTime - If set return modification time 1474 - showEncrypted - If set show decrypted names 1475 - showOrigIDs - If set show the IDs for each item if known 1476 - showHash - If set return a dictionary of hashes 1477 - noMimeType - If set don't show mime types 1478 - dirsOnly - If set only show directories 1479 - filesOnly - If set only show files 1480 - metadata - If set return metadata of objects also 1481 - hashTypes - array of strings of hash types to show if showHash set 1482 1483 Returns: 1484 1485 - list 1486 - This is an array of objects as described in the lsjson command 1487 1488 See the [lsjson](/commands/rclone_lsjson/) command for more information on the above and examples. 1489 1490 **Authentication is required for this call.** 1491 1492 ### operations/mkdir: Make a destination directory or container {#operations-mkdir} 1493 1494 This takes the following parameters: 1495 1496 - fs - a remote name string e.g. "drive:" 1497 - remote - a path within that remote e.g. "dir" 1498 1499 See the [mkdir](/commands/rclone_mkdir/) command for more information on the above. 1500 1501 **Authentication is required for this call.** 1502 1503 ### operations/movefile: Move a file from source remote to destination remote {#operations-movefile} 1504 1505 This takes the following parameters: 1506 1507 - srcFs - a remote name string e.g. "drive:" for the source, "/" for local filesystem 1508 - srcRemote - a path within that remote e.g. "file.txt" for the source 1509 - dstFs - a remote name string e.g. "drive2:" for the destination, "/" for local filesystem 1510 - dstRemote - a path within that remote e.g. "file2.txt" for the destination 1511 1512 **Authentication is required for this call.** 1513 1514 ### operations/publiclink: Create or retrieve a public link to the given file or folder. {#operations-publiclink} 1515 1516 This takes the following parameters: 1517 1518 - fs - a remote name string e.g. "drive:" 1519 - remote - a path within that remote e.g. "dir" 1520 - unlink - boolean - if set removes the link rather than adding it (optional) 1521 - expire - string - the expiry time of the link e.g. "1d" (optional) 1522 1523 Returns: 1524 1525 - url - URL of the resource 1526 1527 See the [link](/commands/rclone_link/) command for more information on the above. 1528 1529 **Authentication is required for this call.** 1530 1531 ### operations/purge: Remove a directory or container and all of its contents {#operations-purge} 1532 1533 This takes the following parameters: 1534 1535 - fs - a remote name string e.g. "drive:" 1536 - remote - a path within that remote e.g. "dir" 1537 1538 See the [purge](/commands/rclone_purge/) command for more information on the above. 1539 1540 **Authentication is required for this call.** 1541 1542 ### operations/rmdir: Remove an empty directory or container {#operations-rmdir} 1543 1544 This takes the following parameters: 1545 1546 - fs - a remote name string e.g. "drive:" 1547 - remote - a path within that remote e.g. "dir" 1548 1549 See the [rmdir](/commands/rclone_rmdir/) command for more information on the above. 1550 1551 **Authentication is required for this call.** 1552 1553 ### operations/rmdirs: Remove all the empty directories in the path {#operations-rmdirs} 1554 1555 This takes the following parameters: 1556 1557 - fs - a remote name string e.g. "drive:" 1558 - remote - a path within that remote e.g. "dir" 1559 - leaveRoot - boolean, set to true not to delete the root 1560 1561 See the [rmdirs](/commands/rclone_rmdirs/) command for more information on the above. 1562 1563 **Authentication is required for this call.** 1564 1565 ### operations/settier: Changes storage tier or class on all files in the path {#operations-settier} 1566 1567 This takes the following parameters: 1568 1569 - fs - a remote name string e.g. "drive:" 1570 1571 See the [settier](/commands/rclone_settier/) command for more information on the above. 1572 1573 **Authentication is required for this call.** 1574 1575 ### operations/settierfile: Changes storage tier or class on the single file pointed to {#operations-settierfile} 1576 1577 This takes the following parameters: 1578 1579 - fs - a remote name string e.g. "drive:" 1580 - remote - a path within that remote e.g. "dir" 1581 1582 See the [settierfile](/commands/rclone_settierfile/) command for more information on the above. 1583 1584 **Authentication is required for this call.** 1585 1586 ### operations/size: Count the number of bytes and files in remote {#operations-size} 1587 1588 This takes the following parameters: 1589 1590 - fs - a remote name string e.g. "drive:path/to/dir" 1591 1592 Returns: 1593 1594 - count - number of files 1595 - bytes - number of bytes in those files 1596 1597 See the [size](/commands/rclone_size/) command for more information on the above. 1598 1599 **Authentication is required for this call.** 1600 1601 ### operations/stat: Give information about the supplied file or directory {#operations-stat} 1602 1603 This takes the following parameters 1604 1605 - fs - a remote name string eg "drive:" 1606 - remote - a path within that remote eg "dir" 1607 - opt - a dictionary of options to control the listing (optional) 1608 - see operations/list for the options 1609 1610 The result is 1611 1612 - item - an object as described in the lsjson command. Will be null if not found. 1613 1614 Note that if you are only interested in files then it is much more 1615 efficient to set the filesOnly flag in the options. 1616 1617 See the [lsjson](/commands/rclone_lsjson/) command for more information on the above and examples. 1618 1619 **Authentication is required for this call.** 1620 1621 ### operations/uploadfile: Upload file using multiform/form-data {#operations-uploadfile} 1622 1623 This takes the following parameters: 1624 1625 - fs - a remote name string e.g. "drive:" 1626 - remote - a path within that remote e.g. "dir" 1627 - each part in body represents a file to be uploaded 1628 1629 See the [uploadfile](/commands/rclone_uploadfile/) command for more information on the above. 1630 1631 **Authentication is required for this call.** 1632 1633 ### options/blocks: List all the option blocks {#options-blocks} 1634 1635 Returns: 1636 - options - a list of the options block names 1637 1638 ### options/get: Get all the global options {#options-get} 1639 1640 Returns an object where keys are option block names and values are an 1641 object with the current option values in. 1642 1643 Note that these are the global options which are unaffected by use of 1644 the _config and _filter parameters. If you wish to read the parameters 1645 set in _config then use options/config and for _filter use options/filter. 1646 1647 This shows the internal names of the option within rclone which should 1648 map to the external options very easily with a few exceptions. 1649 1650 ### options/local: Get the currently active config for this call {#options-local} 1651 1652 Returns an object with the keys "config" and "filter". 1653 The "config" key contains the local config and the "filter" key contains 1654 the local filters. 1655 1656 Note that these are the local options specific to this rc call. If 1657 _config was not supplied then they will be the global options. 1658 Likewise with "_filter". 1659 1660 This call is mostly useful for seeing if _config and _filter passing 1661 is working. 1662 1663 This shows the internal names of the option within rclone which should 1664 map to the external options very easily with a few exceptions. 1665 1666 ### options/set: Set an option {#options-set} 1667 1668 Parameters: 1669 1670 - option block name containing an object with 1671 - key: value 1672 1673 Repeated as often as required. 1674 1675 Only supply the options you wish to change. If an option is unknown 1676 it will be silently ignored. Not all options will have an effect when 1677 changed like this. 1678 1679 For example: 1680 1681 This sets DEBUG level logs (-vv) (these can be set by number or string) 1682 1683 rclone rc options/set --json '{"main": {"LogLevel": "DEBUG"}}' 1684 rclone rc options/set --json '{"main": {"LogLevel": 8}}' 1685 1686 And this sets INFO level logs (-v) 1687 1688 rclone rc options/set --json '{"main": {"LogLevel": "INFO"}}' 1689 1690 And this sets NOTICE level logs (normal without -v) 1691 1692 rclone rc options/set --json '{"main": {"LogLevel": "NOTICE"}}' 1693 1694 ### pluginsctl/addPlugin: Add a plugin using url {#pluginsctl-addPlugin} 1695 1696 Used for adding a plugin to the webgui. 1697 1698 This takes the following parameters: 1699 1700 - url - http url of the github repo where the plugin is hosted (http://github.com/artpar/artpar-webui-react). 1701 1702 Example: 1703 1704 rclone rc pluginsctl/addPlugin 1705 1706 **Authentication is required for this call.** 1707 1708 ### pluginsctl/getPluginsForType: Get plugins with type criteria {#pluginsctl-getPluginsForType} 1709 1710 This shows all possible plugins by a mime type. 1711 1712 This takes the following parameters: 1713 1714 - type - supported mime type by a loaded plugin e.g. (video/mp4, audio/mp3). 1715 - pluginType - filter plugins based on their type e.g. (DASHBOARD, FILE_HANDLER, TERMINAL). 1716 1717 Returns: 1718 1719 - loadedPlugins - list of current production plugins. 1720 - testPlugins - list of temporarily loaded development plugins, usually running on a different server. 1721 1722 Example: 1723 1724 rclone rc pluginsctl/getPluginsForType type=video/mp4 1725 1726 **Authentication is required for this call.** 1727 1728 ### pluginsctl/listPlugins: Get the list of currently loaded plugins {#pluginsctl-listPlugins} 1729 1730 This allows you to get the currently enabled plugins and their details. 1731 1732 This takes no parameters and returns: 1733 1734 - loadedPlugins - list of current production plugins. 1735 - testPlugins - list of temporarily loaded development plugins, usually running on a different server. 1736 1737 E.g. 1738 1739 rclone rc pluginsctl/listPlugins 1740 1741 **Authentication is required for this call.** 1742 1743 ### pluginsctl/listTestPlugins: Show currently loaded test plugins {#pluginsctl-listTestPlugins} 1744 1745 Allows listing of test plugins with the rclone.test set to true in package.json of the plugin. 1746 1747 This takes no parameters and returns: 1748 1749 - loadedTestPlugins - list of currently available test plugins. 1750 1751 E.g. 1752 1753 rclone rc pluginsctl/listTestPlugins 1754 1755 **Authentication is required for this call.** 1756 1757 ### pluginsctl/removePlugin: Remove a loaded plugin {#pluginsctl-removePlugin} 1758 1759 This allows you to remove a plugin using it's name. 1760 1761 This takes parameters: 1762 1763 - name - name of the plugin in the format `author`/`plugin_name`. 1764 1765 E.g. 1766 1767 rclone rc pluginsctl/removePlugin name=rclone/video-plugin 1768 1769 **Authentication is required for this call.** 1770 1771 ### pluginsctl/removeTestPlugin: Remove a test plugin {#pluginsctl-removeTestPlugin} 1772 1773 This allows you to remove a plugin using it's name. 1774 1775 This takes the following parameters: 1776 1777 - name - name of the plugin in the format `author`/`plugin_name`. 1778 1779 Example: 1780 1781 rclone rc pluginsctl/removeTestPlugin name=artpar/artpar-webui-react 1782 1783 **Authentication is required for this call.** 1784 1785 ### rc/error: This returns an error {#rc-error} 1786 1787 This returns an error with the input as part of its error string. 1788 Useful for testing error handling. 1789 1790 ### rc/list: List all the registered remote control commands {#rc-list} 1791 1792 This lists all the registered remote control commands as a JSON map in 1793 the commands response. 1794 1795 ### rc/noop: Echo the input to the output parameters {#rc-noop} 1796 1797 This echoes the input parameters to the output parameters for testing 1798 purposes. It can be used to check that rclone is still alive and to 1799 check that parameter passing is working properly. 1800 1801 ### rc/noopauth: Echo the input to the output parameters requiring auth {#rc-noopauth} 1802 1803 This echoes the input parameters to the output parameters for testing 1804 purposes. It can be used to check that rclone is still alive and to 1805 check that parameter passing is working properly. 1806 1807 **Authentication is required for this call.** 1808 1809 ### sync/bisync: Perform bidirectional synchronization between two paths. {#sync-bisync} 1810 1811 This takes the following parameters 1812 1813 - path1 - a remote directory string e.g. `drive:path1` 1814 - path2 - a remote directory string e.g. `drive:path2` 1815 - dryRun - dry-run mode 1816 - resync - performs the resync run 1817 - checkAccess - abort if RCLONE_TEST files are not found on both filesystems 1818 - checkFilename - file name for checkAccess (default: RCLONE_TEST) 1819 - maxDelete - abort sync if percentage of deleted files is above 1820 this threshold (default: 50) 1821 - force - Bypass maxDelete safety check and run the sync 1822 - checkSync - `true` by default, `false` disables comparison of final listings, 1823 `only` will skip sync, only compare listings from the last run 1824 - createEmptySrcDirs - Sync creation and deletion of empty directories. 1825 (Not compatible with --remove-empty-dirs) 1826 - removeEmptyDirs - remove empty directories at the final cleanup step 1827 - filtersFile - read filtering patterns from a file 1828 - ignoreListingChecksum - Do not use checksums for listings 1829 - resilient - Allow future runs to retry after certain less-serious errors, instead of requiring resync. 1830 Use at your own risk! 1831 - workdir - server directory for history files (default: `~/.cache/rclone/bisync`) 1832 - backupdir1 - --backup-dir for Path1. Must be a non-overlapping path on the same remote. 1833 - backupdir2 - --backup-dir for Path2. Must be a non-overlapping path on the same remote. 1834 - noCleanup - retain working files 1835 1836 See [bisync command help](https://rclone.org/commands/rclone_bisync/) 1837 and [full bisync description](https://rclone.org/bisync/) 1838 for more information. 1839 1840 **Authentication is required for this call.** 1841 1842 ### sync/copy: copy a directory from source remote to destination remote {#sync-copy} 1843 1844 This takes the following parameters: 1845 1846 - srcFs - a remote name string e.g. "drive:src" for the source 1847 - dstFs - a remote name string e.g. "drive:dst" for the destination 1848 - createEmptySrcDirs - create empty src directories on destination if set 1849 1850 1851 See the [copy](/commands/rclone_copy/) command for more information on the above. 1852 1853 **Authentication is required for this call.** 1854 1855 ### sync/move: move a directory from source remote to destination remote {#sync-move} 1856 1857 This takes the following parameters: 1858 1859 - srcFs - a remote name string e.g. "drive:src" for the source 1860 - dstFs - a remote name string e.g. "drive:dst" for the destination 1861 - createEmptySrcDirs - create empty src directories on destination if set 1862 - deleteEmptySrcDirs - delete empty src directories if set 1863 1864 1865 See the [move](/commands/rclone_move/) command for more information on the above. 1866 1867 **Authentication is required for this call.** 1868 1869 ### sync/sync: sync a directory from source remote to destination remote {#sync-sync} 1870 1871 This takes the following parameters: 1872 1873 - srcFs - a remote name string e.g. "drive:src" for the source 1874 - dstFs - a remote name string e.g. "drive:dst" for the destination 1875 - createEmptySrcDirs - create empty src directories on destination if set 1876 1877 1878 See the [sync](/commands/rclone_sync/) command for more information on the above. 1879 1880 **Authentication is required for this call.** 1881 1882 ### vfs/forget: Forget files or directories in the directory cache. {#vfs-forget} 1883 1884 This forgets the paths in the directory cache causing them to be 1885 re-read from the remote when needed. 1886 1887 If no paths are passed in then it will forget all the paths in the 1888 directory cache. 1889 1890 rclone rc vfs/forget 1891 1892 Otherwise pass files or dirs in as file=path or dir=path. Any 1893 parameter key starting with file will forget that file and any 1894 starting with dir will forget that dir, e.g. 1895 1896 rclone rc vfs/forget file=hello file2=goodbye dir=home/junk 1897 1898 This command takes an "fs" parameter. If this parameter is not 1899 supplied and if there is only one VFS in use then that VFS will be 1900 used. If there is more than one VFS in use then the "fs" parameter 1901 must be supplied. 1902 1903 ### vfs/list: List active VFSes. {#vfs-list} 1904 1905 This lists the active VFSes. 1906 1907 It returns a list under the key "vfses" where the values are the VFS 1908 names that could be passed to the other VFS commands in the "fs" 1909 parameter. 1910 1911 ### vfs/poll-interval: Get the status or update the value of the poll-interval option. {#vfs-poll-interval} 1912 1913 Without any parameter given this returns the current status of the 1914 poll-interval setting. 1915 1916 When the interval=duration parameter is set, the poll-interval value 1917 is updated and the polling function is notified. 1918 Setting interval=0 disables poll-interval. 1919 1920 rclone rc vfs/poll-interval interval=5m 1921 1922 The timeout=duration parameter can be used to specify a time to wait 1923 for the current poll function to apply the new value. 1924 If timeout is less or equal 0, which is the default, wait indefinitely. 1925 1926 The new poll-interval value will only be active when the timeout is 1927 not reached. 1928 1929 If poll-interval is updated or disabled temporarily, some changes 1930 might not get picked up by the polling function, depending on the 1931 used remote. 1932 1933 This command takes an "fs" parameter. If this parameter is not 1934 supplied and if there is only one VFS in use then that VFS will be 1935 used. If there is more than one VFS in use then the "fs" parameter 1936 must be supplied. 1937 1938 ### vfs/refresh: Refresh the directory cache. {#vfs-refresh} 1939 1940 This reads the directories for the specified paths and freshens the 1941 directory cache. 1942 1943 If no paths are passed in then it will refresh the root directory. 1944 1945 rclone rc vfs/refresh 1946 1947 Otherwise pass directories in as dir=path. Any parameter key 1948 starting with dir will refresh that directory, e.g. 1949 1950 rclone rc vfs/refresh dir=home/junk dir2=data/misc 1951 1952 If the parameter recursive=true is given the whole directory tree 1953 will get refreshed. This refresh will use --fast-list if enabled. 1954 1955 This command takes an "fs" parameter. If this parameter is not 1956 supplied and if there is only one VFS in use then that VFS will be 1957 used. If there is more than one VFS in use then the "fs" parameter 1958 must be supplied. 1959 1960 ### vfs/stats: Stats for a VFS. {#vfs-stats} 1961 1962 This returns stats for the selected VFS. 1963 1964 { 1965 // Status of the disk cache - only present if --vfs-cache-mode > off 1966 "diskCache": { 1967 "bytesUsed": 0, 1968 "erroredFiles": 0, 1969 "files": 0, 1970 "hashType": 1, 1971 "outOfSpace": false, 1972 "path": "/home/user/.cache/rclone/vfs/local/mnt/a", 1973 "pathMeta": "/home/user/.cache/rclone/vfsMeta/local/mnt/a", 1974 "uploadsInProgress": 0, 1975 "uploadsQueued": 0 1976 }, 1977 "fs": "/mnt/a", 1978 "inUse": 1, 1979 // Status of the in memory metadata cache 1980 "metadataCache": { 1981 "dirs": 1, 1982 "files": 0 1983 }, 1984 // Options as returned by options/get 1985 "opt": { 1986 "CacheMaxAge": 3600000000000, 1987 // ... 1988 "WriteWait": 1000000000 1989 } 1990 } 1991 1992 1993 This command takes an "fs" parameter. If this parameter is not 1994 supplied and if there is only one VFS in use then that VFS will be 1995 used. If there is more than one VFS in use then the "fs" parameter 1996 must be supplied. 1997 1998 {{< rem autogenerated stop >}} 1999 2000 ## Accessing the remote control via HTTP {#api-http} 2001 2002 Rclone implements a simple HTTP based protocol. 2003 2004 Each endpoint takes an JSON object and returns a JSON object or an 2005 error. The JSON objects are essentially a map of string names to 2006 values. 2007 2008 All calls must made using POST. 2009 2010 The input objects can be supplied using URL parameters, POST 2011 parameters or by supplying "Content-Type: application/json" and a JSON 2012 blob in the body. There are examples of these below using `curl`. 2013 2014 The response will be a JSON blob in the body of the response. This is 2015 formatted to be reasonably human-readable. 2016 2017 ### Error returns 2018 2019 If an error occurs then there will be an HTTP error status (e.g. 500) 2020 and the body of the response will contain a JSON encoded error object, 2021 e.g. 2022 2023 ``` 2024 { 2025 "error": "Expecting string value for key \"remote\" (was float64)", 2026 "input": { 2027 "fs": "/tmp", 2028 "remote": 3 2029 }, 2030 "status": 400 2031 "path": "operations/rmdir", 2032 } 2033 ``` 2034 2035 The keys in the error response are 2036 - error - error string 2037 - input - the input parameters to the call 2038 - status - the HTTP status code 2039 - path - the path of the call 2040 2041 ### CORS 2042 2043 The sever implements basic CORS support and allows all origins for that. 2044 The response to a preflight OPTIONS request will echo the requested "Access-Control-Request-Headers" back. 2045 2046 ### Using POST with URL parameters only 2047 2048 ``` 2049 curl -X POST 'http://localhost:5572/rc/noop?potato=1&sausage=2' 2050 ``` 2051 2052 Response 2053 2054 ``` 2055 { 2056 "potato": "1", 2057 "sausage": "2" 2058 } 2059 ``` 2060 2061 Here is what an error response looks like: 2062 2063 ``` 2064 curl -X POST 'http://localhost:5572/rc/error?potato=1&sausage=2' 2065 ``` 2066 2067 ``` 2068 { 2069 "error": "arbitrary error on input map[potato:1 sausage:2]", 2070 "input": { 2071 "potato": "1", 2072 "sausage": "2" 2073 } 2074 } 2075 ``` 2076 2077 Note that curl doesn't return errors to the shell unless you use the `-f` option 2078 2079 ``` 2080 $ curl -f -X POST 'http://localhost:5572/rc/error?potato=1&sausage=2' 2081 curl: (22) The requested URL returned error: 400 Bad Request 2082 $ echo $? 2083 22 2084 ``` 2085 2086 ### Using POST with a form 2087 2088 ``` 2089 curl --data "potato=1" --data "sausage=2" http://localhost:5572/rc/noop 2090 ``` 2091 2092 Response 2093 2094 ``` 2095 { 2096 "potato": "1", 2097 "sausage": "2" 2098 } 2099 ``` 2100 2101 Note that you can combine these with URL parameters too with the POST 2102 parameters taking precedence. 2103 2104 ``` 2105 curl --data "potato=1" --data "sausage=2" "http://localhost:5572/rc/noop?rutabaga=3&sausage=4" 2106 ``` 2107 2108 Response 2109 2110 ``` 2111 { 2112 "potato": "1", 2113 "rutabaga": "3", 2114 "sausage": "4" 2115 } 2116 2117 ``` 2118 2119 ### Using POST with a JSON blob 2120 2121 ``` 2122 curl -H "Content-Type: application/json" -X POST -d '{"potato":2,"sausage":1}' http://localhost:5572/rc/noop 2123 ``` 2124 2125 response 2126 2127 ``` 2128 { 2129 "password": "xyz", 2130 "username": "xyz" 2131 } 2132 ``` 2133 2134 This can be combined with URL parameters too if required. The JSON 2135 blob takes precedence. 2136 2137 ``` 2138 curl -H "Content-Type: application/json" -X POST -d '{"potato":2,"sausage":1}' 'http://localhost:5572/rc/noop?rutabaga=3&potato=4' 2139 ``` 2140 2141 ``` 2142 { 2143 "potato": 2, 2144 "rutabaga": "3", 2145 "sausage": 1 2146 } 2147 ``` 2148 2149 ## Debugging rclone with pprof ## 2150 2151 If you use the `--rc` flag this will also enable the use of the go 2152 profiling tools on the same port. 2153 2154 To use these, first [install go](https://golang.org/doc/install). 2155 2156 ### Debugging memory use 2157 2158 To profile rclone's memory use you can run: 2159 2160 go tool pprof -web http://localhost:5572/debug/pprof/heap 2161 2162 This should open a page in your browser showing what is using what 2163 memory. 2164 2165 You can also use the `-text` flag to produce a textual summary 2166 2167 ``` 2168 $ go tool pprof -text http://localhost:5572/debug/pprof/heap 2169 Showing nodes accounting for 1537.03kB, 100% of 1537.03kB total 2170 flat flat% sum% cum cum% 2171 1024.03kB 66.62% 66.62% 1024.03kB 66.62% github.com/artpar/artpar/vendor/golang.org/x/net/http2/hpack.addDecoderNode 2172 513kB 33.38% 100% 513kB 33.38% net/http.newBufioWriterSize 2173 0 0% 100% 1024.03kB 66.62% github.com/artpar/artpar/cmd/all.init 2174 0 0% 100% 1024.03kB 66.62% github.com/artpar/artpar/cmd/serve.init 2175 0 0% 100% 1024.03kB 66.62% github.com/artpar/artpar/cmd/serve/restic.init 2176 0 0% 100% 1024.03kB 66.62% github.com/artpar/artpar/vendor/golang.org/x/net/http2.init 2177 0 0% 100% 1024.03kB 66.62% github.com/artpar/artpar/vendor/golang.org/x/net/http2/hpack.init 2178 0 0% 100% 1024.03kB 66.62% github.com/artpar/artpar/vendor/golang.org/x/net/http2/hpack.init.0 2179 0 0% 100% 1024.03kB 66.62% main.init 2180 0 0% 100% 513kB 33.38% net/http.(*conn).readRequest 2181 0 0% 100% 513kB 33.38% net/http.(*conn).serve 2182 0 0% 100% 1024.03kB 66.62% runtime.main 2183 ``` 2184 2185 ### Debugging go routine leaks 2186 2187 Memory leaks are most often caused by go routine leaks keeping memory 2188 alive which should have been garbage collected. 2189 2190 See all active go routines using 2191 2192 curl http://localhost:5572/debug/pprof/goroutine?debug=1 2193 2194 Or go to http://localhost:5572/debug/pprof/goroutine?debug=1 in your browser. 2195 2196 ### Other profiles to look at 2197 2198 You can see a summary of profiles available at http://localhost:5572/debug/pprof/ 2199 2200 Here is how to use some of them: 2201 2202 - Memory: `go tool pprof http://localhost:5572/debug/pprof/heap` 2203 - Go routines: `curl http://localhost:5572/debug/pprof/goroutine?debug=1` 2204 - 30-second CPU profile: `go tool pprof http://localhost:5572/debug/pprof/profile` 2205 - 5-second execution trace: `wget http://localhost:5572/debug/pprof/trace?seconds=5` 2206 - Goroutine blocking profile 2207 - Enable first with: `rclone rc debug/set-block-profile-rate rate=1` ([docs](#debug-set-block-profile-rate)) 2208 - `go tool pprof http://localhost:5572/debug/pprof/block` 2209 - Contended mutexes: 2210 - Enable first with: `rclone rc debug/set-mutex-profile-fraction rate=1` ([docs](#debug-set-mutex-profile-fraction)) 2211 - `go tool pprof http://localhost:5572/debug/pprof/mutex` 2212 2213 See the [net/http/pprof docs](https://golang.org/pkg/net/http/pprof/) 2214 for more info on how to use the profiling and for a general overview 2215 see [the Go team's blog post on profiling go programs](https://blog.golang.org/profiling-go-programs). 2216 2217 The profiling hook is [zero overhead unless it is used](https://stackoverflow.com/q/26545159/164234). 2218