# Keep a folder out of search

`POST https://api.mailmasker.org/api/v1/drive/folders/:id/private`

Stop everything in a folder turning up in search results, or let it show again.

- Who can use it: Any signed-in account
- Area: Drive
- Answers 200 OK when it works
- Page: https://developer.mailmasker.org/drive-folder-private

Covers everything inside the folder, however deep. As with a file, nothing is hidden or deleted; it all just stops coming back from a search, from the next indexing pass on.

## Parameters

| Name | In | Required | What it is | Example |
|---|---|---|---|---|
| `id` | path | yes | The folder's id. | `7` |
| `private` | query | no | 0 (or false, no, off) to let search find it again. Leave it out, or send 1, to make it private. |  |

## Good to know

- Turning it off lifts only this folder's own setting. Anything still under another private folder, or marked private itself, stays out of search.
- A folder that isn't yours, or is in Trash, answers 404.

## Examples

cURL:

```bash
curl -s -X POST 'https://api.mailmasker.org/api/v1/drive/folders/7/private' \
  -H "Authorization: Bearer $TOKEN"
```

Perl:

```perl
use Mojo::Base -strict;
use Mojo::UserAgent;

my $ua  = Mojo::UserAgent->new;
my $res = $ua->post('https://api.mailmasker.org/api/v1/drive/folders/7/private',
    { Authorization => "Bearer $ENV{TOKEN}" })->result;
die $res->code, ' ', ($res->json('/error') // $res->message), "\n" unless $res->is_success;
print $res->body, "\n";
```

homelab-cli:

```bash
homelab-cli drive private 7 --folder
```

## Response

200 OK:

```json
{
  "id": 7,
  "name": "Taxes",
  "kind": "folder",
  "private": true,
  "notice": "Marked private. It stops appearing in search on the next index pass; it is not hidden, deleted or unindexed."
}
```
