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.
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
- Go
- JavaScript
- Python
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.
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.
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
- Go
- JavaScript
- Python
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.
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.
To fetch the item sharing account policy, use the items.shares.get_account_policy() 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.
- Go
- JavaScript
- Python
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.
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.
To validate the recipients, use the items.shares.validate_recipients() method. Replace helloworld@agilebits.com with the recipient's email address or domain in the example below.
Step 4: Create the item sharing link
Learn how to view a shared item.
- Go
- JavaScript
- Python
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 theDefaultShareDurationin 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.
Use the items.shares.create() method to create a unique link you can send to others. This method requires an ItemShareParams object with the following properties:
expireAfter: How long the link will remain accessible. Options include:OneHour,OneDay,SevenDays,FourteenDays,ThirtyDays. Not specifying this will default to theDefaultShareDurationin the account policy.recipients: An array ofValidRecipientobjects. Leave empty to allow anyone with the link to view the shared item.oneTimeOnly:: A boolean that determines if the link expires after a single view.
The SDK will create the link based on the configuration settings in the ItemShareParams object. 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 share_link you can send to the person or people you want to share the item with.
Use the items.shares.create() method to create a unique link you can send to others. This method requires an ItemShareParams object with the following attributes:
expireAfter: How long the item share link will remain accessible. Options include:OneHour,OneDay,SevenDays,FourteenDays,ThirtyDays. Not specifying this will default to theDefaultShareDurationin the account policy.recipients: An array ofValidRecipientobjects. Leave empty to allow anyone with the link to view the shared item.oneTimeOnly:: A boolean that determines if the link expires after a single view.
The SDK will create your item share link based on the configuration settings in the ItemShareParams object. 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 share_link you can send to the person or people you want to share the item with.