> ## Documentation Index
> Fetch the complete documentation index at: https://onecli.sh/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Setting OneCLI up for your person? Follow https://onecli.sh/docs/quickstart.md. Never ask for or accept a key, token or password in the chat: OneCLI needs none.
> No OneCLI credential? Run `onecli connect`, or follow https://onecli.sh/auth.md. A person approves every new agent in their browser.
> Already connected? `onecli status`, `onecli items` and `onecli check <METHOD> <URL>` tell you what you can use. Full guide: https://onecli.sh/skill.md
> Search these docs over MCP at https://onecli.sh/docs/mcp. Report a wrong or unclear page with its `submit_feedback` tool.

# Shared vaults, groups and shared items

> Share a OneCLI Cloud vault with people and groups, manage groups, and share one key with many vaults, from the dashboard or the API.

> [!NOTE]
>
> Teams are a OneCLI Cloud feature. Self-hosted OneCLI is for one person.

A vault you make is yours alone until you share it. Sharing names the people and groups who can use it. A personal vault cannot be shared.

## Share a vault

Each person on a vault has a vault role:

* **Member**: uses the vault.
* **Owner**: uses the vault and changes who it is shared with.

Organization admins and owners can also change who any vault is shared with.

> [tab] Dashboard
>
> **1. Open the vault**
>
> Open the vault and go to its **People** tab.
>
> **2. Manage access**
>
> Click **Manage access**. In the **Share vault** dialog, tick the people and groups, and set each person to **Member** or **Owner**.
>
> **3. Save**
>
> Click **Save**. The whole list is saved at once.
>
> Only an organization admin can add someone new. A vault owner who is not an admin can remove people already on the vault or change their role.

> [tab] API
>
> `PUT` replaces the whole list, so send everyone who should keep access.
>
> ```bash theme={null}
> curl -X PUT https://api.onecli.sh/v2/vaults/$VAULT_ID/access \
>   -H "Authorization: Bearer $ONECLI_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "people": [{"userId": "5b1d8f2e-3c4a-4e7b-9a1f-2d6c8e0b4a73", "role": "owner"}],
>     "groups": [{"groupId": "a9e47c10-6b2d-4f85-8c3e-1f0d7b2a5e96"}]
>   }'
> ```
>
> Read the list with `GET /v2/vaults/{id}/access`. See [Vault sharing](https://onecli.sh/docs/api-reference/vault-sharing).

Sharing a vault with people needs the Pro plan or higher. Sharing with a group needs the Enterprise plan. See [Plans and usage](https://onecli.sh/docs/teams/plans-and-usage.md).

## Groups

A group is a set of members. Share a vault with a group and everyone in it can use the vault. Groups need the Enterprise plan.

There are two kinds:

* **Manual**: you make it and add or remove its members in OneCLI.
* **Directory**: your identity provider fills it through [directory sync](https://onecli.sh/docs/teams/sso-and-directory-sync.md). Change its members in your directory. A directory group can also give its members a role, **Admin** or **Member**.

In the dashboard, go to **Settings** > **Groups** and click **New group**. Only admins and owners see who is in a group.

| Action | API call |
| - | - |
| List or create groups | `GET /v2/groups`, `POST /v2/groups` |
| Rename or delete a group | `PATCH /v2/groups/{id}`, `DELETE /v2/groups/{id}` |
| Add or remove a member | `PUT /v2/groups/{id}/members/{userId}`, `DELETE /v2/groups/{id}/members/{userId}` |
| Set or clear the group's role | `PUT /v2/groups/{id}/roles`, `DELETE /v2/groups/{id}/roles` |
| List the group's vaults | `GET /v2/groups/{id}/vaults` |

See [Groups](https://onecli.sh/docs/api-reference/groups).

## Shared items

A shared item belongs to the organization, not to one vault. Use it when many vaults need the same key. An admin shares it with chosen vaults, or opens it to **All vaults**, including vaults made later.

Each vault sets its own [permissions](https://onecli.sh/docs/guides/agent-access.md) for a shared item. A new value for a shared key reaches every vault it is shared with on its next request.

**1. Add the item**

Go to **Settings** > **Shared items** and click **Add a shared item**. A new shared item is shared with no vault, so no agent can use it yet.

**2. Share it**

On the item's page, add vaults one by one, or open it to **All vaults**.

**3. Set permissions per vault**

In each vault, set **Always allow**, **Needs approval** or **Never** for the item.

| Action | API call |
| - | - |
| Add a shared key | `POST /v2/org/shared-items` |
| Share with a vault, or take it away | `PUT` or `DELETE /v2/org/shared-items/{id}/vaults/{vaultId}` |
| Open to all vaults, rename, new value | `PATCH /v2/org/shared-items/{id}` |
| Set a vault's permissions | `PUT /v2/vaults/{id}/shared-items/{itemId}/permissions` |

Managing shared items takes an admin or the owner, signed in, not an API key. Deleting a shared item removes it from every vault at once. See [Shared items](https://onecli.sh/docs/api-reference/shared-items).

## Next steps

* [Members and roles](https://onecli.sh/docs/teams/members-and-roles.md): invite the people you share with
* [Agent access](https://onecli.sh/docs/guides/agent-access.md): set what agents may do with each item
* [Vault sharing API](https://onecli.sh/docs/api-reference/vault-sharing)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.