# How to accept the shared directory with the command line?

**URL:** https://forum.syncthing.net/t/how-to-accept-the-shared-directory-with-the-command-line/18612
**Category:** General
**Created:** [June 27, 2022, 3:01am UTC](https://forum.syncthing.net/t/how-to-accept-the-shared-directory-with-the-command-line/18612 "2022-06-27T03:01:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![syncthing0](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/s/958977/32.png) [@syncthing0](https://forum.syncthing.net/u/syncthing0)
#### Post date: [June 27, 2022, 3:01am UTC](https://forum.syncthing.net/t/how-to-accept-the-shared-directory-with-the-command-line/18612/1 "2022-06-27T03:01:56Z")

</div>

I can use the syncthing cli config folders \* devices add-device-id \* to share my directory, but how do I use the command line accept folder on the receiving device?

---

<div class="post-metadata">

### Author: ![acolomb](https://forum.syncthing.net/user_avatar/forum.syncthing.net/acolomb/32/11343_2.png) [@acolomb](https://forum.syncthing.net/u/acolomb)
#### Post date: [June 27, 2022, 3:57am UTC](https://forum.syncthing.net/t/how-to-accept-the-shared-directory-with-the-command-line/18612/2 "2022-06-27T03:57:53Z")

</div>

Hi there!

You basically need to get the details from the “pending folder” entry as JSON and post a configuration change accordingly. It depends on whether the folder is already added on the “receiver” as you call it, and the inviting device just needs to be added to the list of shared device IDs, or you need to set up the shared folder at all with a new path to sync?

The `jq` command line tool will be helpful to transform the JSON data. This previous topic may be of interest:

> [@How to use REST API to accept new folders](https://forum.syncthing.net/t/how-to-use-rest-api-to-accept-new-folders/17489/9):
>
> After a bit of fiddling with the jq tool: jq --arg l "My Label" --arg p /path/to/folder \ '{ id: . | keys[], label: $l, path: $p, devices: .[].offeredBy | keys | map({ deviceID: . }) }'\ \<\<EOF { "kmmgl-nygfm": { "offeredBy": { "Z2M6GO2-455NXSO-CQLJVBB-IIG5MPA-ERT636W-LUK3GUC-MUSIBP6-6UIVQQF": { "time": "2021-10-20T18:18:40Z", "label": "syncthing-restAPI", "receiveEncrypted": false, "remoteEncrypted": false } } } } EOF { "id": "kmmgl-n…

Hope that helps. Let me know if you get stuck.

---

<div class="post-metadata">

### Author: ![syncthing0](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/s/958977/32.png) [@syncthing0](https://forum.syncthing.net/u/syncthing0)
#### Post date: [June 27, 2022, 8:15am UTC](https://forum.syncthing.net/t/how-to-accept-the-shared-directory-with-the-command-line/18612/3 "2022-06-27T08:15:50Z")

</div>

Thank you, it would be better if you can accept it with cli.

---

<div class="post-metadata">

### Author: ![acolomb](https://forum.syncthing.net/user_avatar/forum.syncthing.net/acolomb/32/11343_2.png) [@acolomb](https://forum.syncthing.net/u/acolomb)
#### Post date: [June 27, 2022, 5:35pm UTC](https://forum.syncthing.net/t/how-to-accept-the-shared-directory-with-the-command-line/18612/4 "2022-06-27T17:35:25Z")

</div>

Sure would be nice to have it accessible without fiddling around JSON data. But on the other hand, some details must be provided such as the folder path at a minimum and you need to select which invitation should be accepted if there are several. It would be another syntax to learn if we packed all those into a cli command. So far the decision was to stick with JSON, which is both easy to read and write, and pretty standard so there are tools available.

I think a PR adding an appropriate command would have a chance of getting accepted, but so far nobody has found it important enough to try. Most people are probably happy with the Web GUI or ready to dive in and handle the API themselves.
