# Sharing Commands

### Overview

This is the set of commands which we use related to sharing with user

1. [Share Record Command](/keeperpam/commander-sdk/keeper-commander-sdks/sdk-command-reference/sharing-commands/record-share-command.md#share-record-share-command)
2. [Share Folder Command](/keeperpam/commander-sdk/keeper-commander-sdks/sdk-command-reference/sharing-commands/shared-folder-commands.md#share-folder-command)
3. [One Time Share List Command](#one-time-share-list-command)
4. [One Time Share Create Command](#one-time-share-create-command)
5. [One Time Share Remove Command](#one-time-share-remove-command)

### One Time Share Create Command

This command can be used to create share-links of records in vault for sharing credentials or record information with a user externally. The link can be opened on one device/browser only and can be reopened only on that device/browser till the expiration of the link

<details>

<summary>DotNet CLI</summary>

**Command**: `one-time-share`

**Flags**:

* `--client` : One-Time Share action name `create` . This is a required positional argument at position 0 after the command.
* `--expire` : Expire share in **\[(m)inutes|(h)ours|(d)ays**. Only used with argument `create` .
* `--help` : Display this help screen.
* `--version` : Display version information.
* `value pos. 0` : This is a required KSM command that specifies the action to perform. It is a positional argument that must be placed at position 0 immediately after the command. Accepted values are:
  * **`create`** – To create a new one-time-share
* `value (pos. 1)` : Required. The Record UID or path to be shared. This is a positional argument placed at position 1 immediately after the command.

**Example:**

<pre class="language-csharp"><code class="lang-csharp"><strong>My Vault > one-time-share create record_uid --expire 2m
</strong>URL: https://keepersecurity.com:443/vault/share#asdfsadf
</code></pre>

</details>

<details>

<summary>DotNet SDK</summary>

**Function:**

```csharp
public static async Task<string> CreateExternalRecordShare(this VaultOnline vault, 
        string recordUid, 
        TimeSpan expireIn, 
        string shareName = null)
```

**Arguments:**

* `vault` : Used with the Vault Context.

```csharp
vault.CreateExternalRecordShare(record.Uid, TimeSpan expireIn)
```

* `recordUid` : Uid of the record which needs to be shared.
* `TimeSpan` : Object of the TimeSpan class used to set the expiration time of the record.
* `shareName` : Name of the one-time-share.

</details>

<details>

<summary>Power Commander</summary>

**Command**: `New-KeeperOneTimeShare`

**Aliases:** `kotsn`

**Flags**:

* `-Uid` : Uid of Record
* `-ExpireIn` : One Time Share expires time in minutes
* `-ExpireAt` : One Time Share expires time in date format
* `-ShareName` : One Time Share record name

**Example:**

```powershell
PS > New-KeeperOneTimeShare -Uid record_uid -ExpireIn 5 -ShareName "Example Share" 
https://keepersecurity.com:443/vault/share#qwertyuiopasdfghjklzxcvbnm
```

</details>

<details>

<summary>Python CLI</summary>

**Command:** `share-create`

**Parameters:**

* `record` : \<RECORD\_UID> or path of records for which share URL is to be created
* `-e, --expire` : Timeout period for the share-url. Link will not work after the duration has passed. Max period that can be set is 6 months or 182 days

**Options:**

* `--name` : Name of the share URL
* `--editable` : Allow user to edit the shared record
* `--output` : Destination for the share URL (Clipboard or console/standard output)

**Example:**

```sh
My Vault> share-create --name='share_record' -e=30d record_uid
https://keepersecurity.com/vault/share#asdfsdjkkadsfdasfasdf
```

</details>

<details>

<summary>Python SDK</summary>

**Command** :

```python
from keepersdk.vault import one_time_share
​
url = one_time_share.create_one_time_share(
            vault=vault,
            record_uid=record_uid,
            expiration_period=expiration_period,
            name=ots_name or None,
            is_editable=is_editable,
            is_self_destruct=is_self_destruct,
        )
```

</details>

### One Time Share List Command

This command is used to list the one-time-shares created for a record or folder. The command displays the record/folder UID, share name, share id, create date, access date and expiration date along with status of the link as generated, accessed or expired.

<details>

<summary>DotNet CLI</summary>

**Command**: `one-time-share`

**Action:**

This is a required KSM command that specifies the action to perform. It is a positional argument that must be placed at position 0 immediately after the command. Accepted values are:

* **`list`** – To display a list of one-time share URLs for the record.

**Flags**:

* `value pos. 1` : Required. The Record UID or path to be shared. This is a positional argument placed at position 1 immediately after the command.
* `--client` : One-Time Share action name `list`. This is a required positional argument at position 0 after the command.
* `--help` : Display this help screen.
* `--version` : Display version information.

**Example:**

```csharp
My Vault> one-time-share list record_uid  --client "Example Share" 
  #  Record UID              Record Title    Share Name   Generated          Opened             Expires          
---  ----------------------  -------------   -----------  -----------------  -----------------  -----------------    
  1  record_uid              Example Record  Share_name   8/28/2025 5:58 PM  8/28/2025 5:58 PM  8/28/2025 6:00 PM
```

</details>

<details>

<summary>DotNet SDK</summary>

**Function:**

```csharp
public static async Task<ExternalRecordShare[]> GetExernalRecordShares(
    this VaultOnline vault, 
    string recordUid
)
```

**Arguments:**

* `vault` : Used with the Vault Context.

```csharp
Vault.GetExernalRecordShares(record.Uid)
```

* `recordUid` : UID of the record for which the list of one-time shares should be displayed.

</details>

<details>

<summary>Power Commander</summary>

**Command**: `Get-KeeperOneTimeShare`

**Aliases:** `kotsg`

**Flags**:

* `-Uid` : Uid of Record

**Example:**

```powershell
PS > Get-KeeperOneTimeShare record_uid

RecordUid              RecordTitle   Owner Users Folders
---------              -----------   ----- ----- -------
record_uid             Example Record         1       1
```

</details>

<details>

<summary>Python CLI</summary>

**Command**: `share-list`

**Parameters:**

* `record` : \<UID> or path of record/folder

**Options**:

* `-v, --verbose` : Show the entire output if share id is long it gets trimmed.
* `-a, --all` : Show all one-time-share including expired
* `-R, --recursive` : Traverse recursively through subfolders
* `--format` : Output format - table, json, csv

**Example:**

```sh
My Vault> share-list record_uid --all

Record UID               Share Link Name    Share Link ID                                       Generated            Opened    Expires              Status
----------------------   -----------------  --------------------------------------------        -------------------  --------  -------------------  --------
record_uid                                  Share_link_uid                                      2025-08-06 16:54:11            2025-08-06 17:24:11  Expired
```

</details>

<details>

<summary>Python SDK</summary>

**Function** : `list_one_time_shares`

```python
from keepersdk.vault import one_time_share
​
shares: list[one_time_share.OneTimeShare] = one_time_share.list_one_time_shares(
                vault=vault,
                record_uid=record_uids[:1000],
                include_expired=True,
            )
```

</details>

### One Time Share Remove Command

This command is used to delete one time share links for a record or folder.

<details>

<summary>DotNet CLI</summary>

**Command**: `one-time-share`

**Flags**:

* `--client` : One-Time Share action name `delete`. This is a required positional argument at position 0 after the command.
* `--help` : Display this help screen.
* `--version` : Display version information.
* `value pos. 0` : This is a required KSM command that specifies the action to perform. It is a positional argument that must be placed at position 0 immediately after the command. Accepted values are:
  * **`delete`** – To remove an one-time-share
* `value pos. 1` : Required. The Record UID or path to be shared. This is a positional argument placed at position 1 immediately after the command.

**Example:**

```csharp
My Vault> one-time-share delete record_uid  --client "Example Share"  
```

</details>

<details>

<summary>DotNet SDK</summary>

**Function:**

```csharp
public static async Task DeleteExernalRecordShares(
    this VaultOnline vault, 
    string recordUid, 
    IEnumerable<string> clientId
)
```

**Arguments:**

* `VaultOnline` : Used with the Vault Context.

```csharp
var shares = (await context.Vault.GetExernalRecordShares(record.Uid))
Vault.DeleteExernalRecordShares(record.Uid, 
    shares.Select(x => x.ClientId))
```

* `ClientId` : Client ID of the shares of the record ID.

</details>

<details>

<summary>Power Commander</summary>

**Command**: `Remove-KeeperOneTimeShare`

**Aliases:** `kotsr`

**Flags**:

* `-Uid` : Uid of Record
* `-ShareName` : List of Shared Name

**Example:**

```powershell
PS > Remove-KeeperOneTimeShare -Uid record_uid  -ShareName "Example Share"                     
```

</details>

<details>

<summary>Python CLI</summary>

**Command**: `share-remove`

**Parameters**: **Required**

* `record` : UID or Path of the record or folder
* `share` : One-time share ID

**Example:**

```sh
My Vault> share-remove record_uid shared_link_uid
One-time share "share_link_uid" is removed from record "record_uid"
```

</details>

<details>

<summary>Python SDK</summary>

**Function** : `remove_one_time_share`

```python
from keepersdk.vault import one_time_share
​
one_time_share.remove_one_time_share(
            vault=vault,
            record_uid=record_uid,
            share_identifier=share_identifier, ## Share ID
        )
```

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/keeperpam/commander-sdk/keeper-commander-sdks/sdk-command-reference/sharing-commands.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
