Skip to main content

Share items using 1Password SDKs

You can use 1Password SDKs to securely share a copy of a 1Password item with anyone, even if they don't have a 1Password account.

When you share an item, you'll get a unique link that you can send to others. You can choose when the link expires and who it's available to: anyone with the link, or only people with specific email addresses or email domains. You can also choose whether you want the link to be viewable only once, or multiple times.

tip

Make sure to add the Share items permission when creating your service account token to share items using the SDKs.

Step 1: Retrieve the 1Password item you want to share

To retrieve the item you want to share, use the Items().Get() method with the unique identifiers (IDs) for the item and the vault where the item is stored.

Step 2: Fetch the item sharing account policy

The item sharing account policy contains the allowed share settings that your account admin or owner has set.

For individual and family accounts, these settings default to:

  • Unlimited views
  • All recipient types allowed
  • All share types allowed
  • Maximum share duration of 30 days
  • Default share duration of 7 days

To fetch the item sharing account policy, use the Items().Shares().GetAccountPolicy() method with the unique identifiers (IDs) for the item and the vault where the item is stored.

Step 3: (Optional) Validate the recipients

You can validate recipients to make sure that the people you want to share the link with are allowed to receive it, based on your account policy or sharing parameters.

This step is only required if the item sharing link is limited to specific email addresses or domains. If the share link is accessible to anyone with the link, you can skip validating the recipients.

To validate the recipients, use the Items().Shares().ValidateRecipients() method. Replace helloworld@agilebits.com with the recipient's email address or domain in the example below.

tip

Learn how to view a shared item.

Use the Items().Shares().Create() method to create a unique link you can send to others. This method requires an ItemShareParams struct with the following fields:

  • ExpireAfter: How long the item link will remain accessible. Options include: OneHour, OneDay, SevenDays, FourteenDays, ThirtyDays. Not specifying this will default to the DefaultShareDuration in the account policy.
  • Recipients: The validated recipients of an item share, obtained through the recipient validation function. Leaving this parameter empty will allow everyone with the link to see the item.
  • OneTimeOnly: A boolean that determines if the link expires after one view.

The SDK will create the link based on the configuration settings in the ItemShareParams struct. If you have a 1Password Business account, it will also validate the settings against the item sharing policy set by your account owner or administrator.

The SDK returns a shareLink you can send to the person or people you want to share the item with.

Was this page helpful?