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, supply the ID of the item and the ID of the vault where it's stored in place of item_id and vault_id in the example below.

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. To fetch the item sharing account policy, supply the the ID of the item and the ID of the vault where it's stored in place of item_id and vault_id in the example below.

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

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 function 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, supply their email address or domain in place of helloworld@agilebits.com in the example below.

You can now create an item sharing link using the item, policy, and validated recipients. The SDK will create your item share link based on the configuration settings in the ItemShareParams struct and, if applicable, will validate it against the item sharing policy set by your account owner or administrator.

You can now send shareLink to the person or people you want to share the item with.

tip

Learn how to view a shared item.

Item share parameters

The SDK provides an ItemShareParams struct that defines item sharing configuration options. If you have a 1Password Business account, these must respect the item sharing policy set by your account owner or administrator.

The item share parameters include several components that define key configuration options:

ParameterTypeDescription
ExpireAfterItemShareDurationHow long the item share link will remain accessible. Options include: OneHour, OneDay, SevenDays, FourteenDays, ThirtyDays. Not specifying this will default to the DefaultShareDuration in the account policy.
RecipientsValidRecipient[]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.
OnlyOneTimeboolWhether the item can only be viewed once or multiple times.

Was this page helpful?