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.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.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.Step 4: Create the item sharing link
- 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.
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.