Online Help Center > SendSafely APIs

com.sendsafely

Class SendSafely

The main SendSafely API. Use this API to create packages and append files and recipients.

SendSafely(Host, ApiKey, ApiSecret)
Constructor to create a new SendSafely object.
Return Type: N/A
Parameters:
NameTypeDescription
Host String The hostname you use to access SendSafely. Should be https://companyname.sendsafely.com or https://www.sendsafely.com
ApiKey String The API key for the user. A new API key can be generated on the user's Edit Profile page of the SendSafely web portal or using the generateAPIKey API method.
ApiSecret String The secret belonging to the API key.

SendSafely(Host, CredentialsManager)
Constructor to create a new SendSafely object.
Return Type: N/A
Parameters:
NameTypeDescription
Host String The hostname you use to access SendSafely. Should be https://companyname.sendsafely.com or https://www.sendsafely.com
CredentialsManager CredentialsManager Class implementing the CredentialsManager interface for managing the api key and api secret.

SendSafely(ConnectionManager, ApiKey, ApiSecret)
Constructor to create a new SendSafely object.
Return Type: N/A
Parameters:
NameTypeDescription
ConnectionManager ConnectionManager Class implementing the ConnectionManager interface for managing connections with the server.
ApiKey String The API key for the user. A new API key can be generated on the user's Edit Profile page of the SendSafely web portal or using the generateAPIKey API method.
ApiSecret String The secret belonging to the API key.

SendSafely(Host, ConnectionManager, CredentialsManager)
Constructor to create a new SendSafely object.
Return Type: N/A
Parameters:
NameTypeDescription
Host String The hostname you use to access SendSafely. Should be https://companyname.sendsafely.com or https://www.sendsafely.com
ConnectionManager ConnectionManager Class implementing the ConnectionManager interface for managing communication with the server.
CredentialsManager CredentialsManager Class implementing the CredentialsManager interface for managing the api key and api secret.

SendSafely(UploadManager)
Constructor to create a new SendSafely object.
Return Type: N/A
Parameters:
NameTypeDescription
UploadManager UploadManager Class implementing the UploadManager interface for handling file uploads to the server. The implementing class is also responsible for connection and credential management.

addContactGroupToPackage(PackageId, GroupId)
Add Contact Group as a recipient on a package.
Return Type: void
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the add the Contact Group operation.
GroupId String The unique id of the Contact Group to add to the package.

addDropzoneRecipient(Email)
Adds a recipient email address to the current user's Dropzone.
Return Type: void
Parameters:
NameTypeDescription
Email String The recipient email address added to the Dropzone.

addRecipient(PackageId, Email)
Adds a recipient to a given package.
Return Type: Recipient
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the add recipient operation.
Email String The recipient email to be added.

addRecipientPhonenumber(PackageId, RecipientId, Phonenumber, CountryCode)
Adds a phone number to a given recipient.
Return Type: void
Parameters:
NameTypeDescription
PackageId String The unique packageId that you are updating.
RecipientId String The recipientId to be updated.
Phonenumber String The phone number to associate with the recipient. Passing a phone number with a numeric country code prefix (i.e. +44), will effectively override the countryCode parameter.
CountryCode CountryCode The country code that belongs to the phone number.

addRecipients(PackageId, Emails)
Adds a list of recipients to a given package.
Return Type: List<Recipient>
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the add recipient operation.
Emails List The list of recipients to be added.

addUserToContactGroup(GroupId, UserEmail)
Add user email address to the specified Contact Group.
Return Type: String
Parameters:
NameTypeDescription
GroupId String The unique id of the Contact Group for the add user operation.
UserEmail String The email address to add to the Contact Group.

createContactGroup(GroupName)
Create a new Contact Group with the passed in group name. A Contact Group allows a user to define and manage a group of recipients at the group-level, rather than individually on each package. For more information about Contact Groups, refer to http://sendsafely.github.io/overview.htm
Return Type: String
Parameters:
NameTypeDescription
GroupName String The name of the new Contact Group.

createContactGroup(GroupName, IsEnterpriseGroup)
Create a new Enterprise Contact Group with the passed in group name. The method caller must be a SendSafely Enterprise Administrator, and the Contact Group it creates is available to all users in an organization. For more information on Contact Groups, refer to http://sendsafely.github.io/overview.htm
Return Type: String
Parameters:
NameTypeDescription
GroupName String The name of the new Contact Group.
IsEnterpriseGroup boolean A boolean flag for determining whether a Contact Group is an Enterprise Contact Group. If set to true, subsequent management operations of the Contact Group will require SendSafely Enterprise Administrator privileges, however the Contact Group can be added as a recipient to any package by any user in the organization.

createDirectory(PackageId, ParentDirectoryId, DirectoryName)
Creates a new directory in a Workspace. Only Workspace packages support directories.
Return Type: Directory
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the create directory operation.
ParentDirectoryId String The unique id of the created directory's parent directory. If creating a directory in the root directory of a Workspace, this will be the packageDirectoryId property of the Workspace Package object. Otherwise, this will be the directoryId property of the parent Directory object.
DirectoryName String The name of the new directory to be created.

createPackage()
Creates a new package for the purpose of sending files. A new package must be created before files or recipients can be added. For further information about the package flow, see http://sendsafely.github.io/overview.htm
Return Type: Package
Parameters: N/A

createPackage(IsWorkspace)
Creates a new package that represents a secure Workspace. A Workspace is a type of package that supports file collaboration features, such as directories and subdirectories, file versioning, role-based access control, and activity logging. A Workspace must be created before files, directories, or collaborators can be added. For further information about the package flow and Workspaces, refer to http://sendsafely.github.io/overview.htm
Return Type: Package
Parameters:
NameTypeDescription
IsWorkspace Boolean Flag declaring the package is a Workspace.

createPackageForUser(Email)
Creates a new package and assigns package owner to the user whose email address is passed as the method argument. The method caller must be a SendSafely Enterprise Administrator and in the same organization as the assigned package owner.
Return Type: Package
Parameters:
NameTypeDescription
Email String The email address of the package owner.

deleteContactGroup(GroupId)
Delete the Contact Group associated with the passed in group id.
Return Type: void
Parameters:
NameTypeDescription
GroupId String The unique id of the Contact Group to delete.

deleteDirectory(PackageId, DirectoryId)
Deletes a directory from a Workspace package.
Return Type: void
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the delete directory operation.
DirectoryId String The unique directory id of the directory to delete.

deleteFile(PackageId, DirectoryId, FileId)
Deletes a file from a Workspace package.
Return Type: void
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the delete file operation.
DirectoryId String The unique directory id of the directory containing the file to delete.
FileId String The unique file id of the file to delete.

deletePackage(PackageId)
Deletes a package with the given package id.
Return Type: void
Parameters:
NameTypeDescription
PackageId String The unique package id of the package to be deleted.

downloadFile(PackageId, FileId, KeyCode)
Downloads a file from the server and decrypts it.
Return Type: File
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the file download operation.
FileId String The unique file id of the file to download.
KeyCode String The keycode belonging to the package.

downloadFile(PackageId, FileId, KeyCode, Progress)
Downloads a file from the server and decrypts it.
Return Type: File
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the file download operation.
FileId String The unique file id of the file to download.
KeyCode String The keycode belonging to the package.
Progress ProgressInterface A progress callback object which can be used to report back progress on how the download is progressing.

getRecipientHistory(RecipientEmail)
Retrieves a list of packages where the passed in email address is a package recipient.
Return Type: List<RecipientHistory>
Parameters:
NameTypeDescription
RecipientEmail String The email address of the recipient.

downloadFile(PackageId, FileId, KeyCode, Progress, Password)
Downloads a file from the server and decrypts it.
Return Type: File
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the file download operation.
FileId String The unique file id of the file to download.
KeyCode String The keycode belonging to the package.
Progress ProgressInterface A progress callback object which can be used to report back progress on how the download is progressing.
Password String The password required to download a file from a password protected undisclosed package (i.e. a package without any recipients assigned).

downloadFile(PackageId, FileId, KeyCode, Password)
Downloads a file from the server and decrypts it.
Return Type: File
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the file download operation.
FileId String The unique file id of the file to download.
KeyCode String The keycode belonging to the package.
Password String The password required to download a file from a password protected undisclosed package (i.e. a package without any recipients assigned).

downloadFileFromDirectory(PackageId, DirectoryId, FileId, KeyCode)
Downloads a file located in a directory of a Workspace package from the server and decrypts it.
Return Type: File
Parameters:
NameTypeDescription
PackageId String The unique package id of the Workspace package for the file download operation.
DirectoryId String The unique directory id of the directory for the file download operation.
FileId String The unique file id of the file to download.
KeyCode String The keycode belonging to the package.

downloadFileFromDirectory(PackageId, DirectoryId, FileId, KeyCode, Progress)
Downloads a file located in a directory of a Workspace package from the server and decrypts it.
Return Type: File
Parameters:
NameTypeDescription
PackageId String The unique package id of the Workspace package for the file download operation.
DirectoryId String The unique directory id of the directory for the file download operation.
FileId String The unique file id of the file to download.
KeyCode String The keycode belonging to the package.
Progress ProgressInterface A progress callback object which can be used to report back progress on how the upload is progressing.

encryptAndUploadFile(PackageId, KeyCode, File)
Encrypt and upload a new file. The file will be encrypted before being uploaded to the server. The function will block until the file is uploaded.
Return Type: File
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the file upload operation.
KeyCode String The keycode belonging to the package.
File FileManager A FileManager object representing the file to encrypt and upload. This can not be a folder of files on the local file system.

encryptAndUploadFile(PackageId, KeyCode, File, Progress)
Encrypt and upload a new file. The file will be encrypted before being uploaded to the server. The function will block until the file is uploaded.
Return Type: File
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the file upload operation.
KeyCode String The keycode belonging to the package.
File FileManager A FileManager object representing the file to encrypt and upload. This is a single file on your local file system, and can not be a folder.
Progress ProgressInterface A progress callback object which can be used to report back progress on how the upload is progressing.

deleteTempPackage(PackageId)
Deletes a temporary package, which is a package that has not yet been finalized.
Return Type: void
Parameters:
NameTypeDescription
PackageId String The unique package id of the package to be deleted.

getReceivedPackages()
Retrieves a list of all active packages received for the given API User.
Return Type: List<PackageReference>
Parameters: N/A

encryptAndUploadFileInDirectory(PackageId, DirectoryId, KeyCode, File)
Encrypt and upload a new file to a directory in a Workspace package. The file will be encrypted before being uploaded to the server. The function will block until the file is uploaded.
Return Type: File
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the file upload operation.
DirectoryId String The unique directory id of the directory for the file upload operation.
KeyCode String The keycode belonging to the package.
File FileManager A FileManager object representing the file to encrypt and upload. This is a single file on your local file system, and can not be a folder.

encryptAndUploadFileInDirectory(PackageId, DirectoryId, KeyCode, File, Progress)
Encrypt and upload a new file to a directory in a Workspace package. The file will be encrypted before being uploaded to the server. the function will block until the file is uploaded.
Return Type: File
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the file upload operation.
DirectoryId String The unique directory id of the directory for the file upload operation.
KeyCode String The keycode belonging to the package.
File FileManager A FileManager object representing the file to encrypt and upload. This is a single file on your local file system, and can not be a folder.
Progress ProgressInterface A progress callback object which can be used to report back progress on how the upload is progressing.

encryptAndUploadMessage(PackageId, KeyCode, Message)
Encrypt and upload a message. The message will be encrypted before being uploaded to the server.
Return Type: void
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the message upload operation.
KeyCode String The keycode belonging to the package.
Message String The message string to encrypt and upload.

finalizePackage(PackageId, Keycode)
Finalizes the package so it can be delivered to the recipients.
Return Type: PackageURL
Parameters:
NameTypeDescription
PackageId String The unique package id of the package to be finalized.
Keycode String The keycode belonging to the package.

finalizePackage(PackageId, Keycode, Notify)
Finalizes the package so it can be delivered to the recipients.
Return Type: PackageURL
Parameters:
NameTypeDescription
PackageId String The unique package id of the package to be finalized.
Keycode String The keycode belonging to the package.
Notify boolean A boolean flag indicating whether SendSafely should send the secure link to the package recipients

finalizeUndisclosedPackage(PackageId, Keycode)
Finalizes an undisclosed package, which is a package without recipients. Anyone with access to the link can access the package.
Return Type: PackageURL
Parameters:
NameTypeDescription
PackageId String The unique package id of the package to be finalized.
Keycode String The keycode belonging to the package.

finalizeUndisclosedPackage(PackageId, Password, Keycode)
Finalizes an undisclosed package, which is a package without recipients, and protects it with a password. Anyone with access to the link will also be required to supply the password to access the package.
Return Type: PackageURL
Parameters:
NameTypeDescription
PackageId String The unique package id of the package to be finalized.
Password String A password that will be required to access the contents of the package.
Keycode String The keycode belonging to the package.

generateAPIKey(Host, Email, Password, KeyDescription)
Generates a new SendSafely API key and secret for the provided SendSafely user name and password. This key and secret can be used to authenticate to the SendSafely API. If the current user has Two-Step Authentication enabled, a TwoFactorAuthException exception will be returned to the client that includes a validation token. Additionally, a verification code will be sent via SMS message to the user's mobile number. Both the validation token and verification code will be needed in a follow-up call to the generateKey2FA API method in order to complete the authentication process and receive an API key and secret.
Return Type: DefaultCredentials
Parameters:
NameTypeDescription
Host String The hostname you use to access SendSafely. Should be https://companyname.sendsafely.com or https://www.sendsafely.com
Email String Email address of the user required for authenticating to SendSafely.
Password String Password of the user required for authenticating to SendSafely.
KeyDescription String User defined description of the generated API key.

generateKey2FA(Host, ValidationToken, SmsCode, KeyDescription)
Generates a new SendSafely API key and secret for a user that has Two-Step Authentication enabled. This key and secret can be used to authenticate to the SendSafely API.
Return Type: DefaultCredentials
Parameters:
NameTypeDescription
Host String The hostname you use to access SendSafely. Should be https://companyname.sendsafely.com or https://www.sendsafely.com
ValidationToken String The validation token returned from a call to generateAPIKey() by a Two-Step Authentication enabled user.
SmsCode String The SMS verification code received from a call to generateAPIKey() by a Two-Step Authentication enabled user.
KeyDescription String User defined description of the generated API key.

getActivePackages()
Get all active packages for the current user.
Return Type: List<PackageReference>
Parameters: N/A

getActivityLog(PackageId, RowIndex)
Retrieves activity log records for a Workspace package. The method supports returning up to 10 records at a time. The caller must be the owner of the Workspace, assigned to the manager role within the Workspace, or an enterprise administrator.
Return Type: List<ActivityLogEntry>
Parameters:
NameTypeDescription
PackageId String The unique package id of the Workspace package for the get activity log operation.
RowIndex int Integer representing the index of the first activity log record to retrieve.

getArchivedPackages()
Get all archived packages for the current user.
Return Type: List<PackageReference>
Parameters: N/A

getContactGroups()
Retrieve the list of available Contact Groups for the current user profile, including all email addresses associated with each Contact Group.
Return Type: List<ContactGroup>
Parameters: N/A

getDirectory(PackageId, DirectoryId)
Retrieves meta data about a directory in a Workspace package.
Return Type: Directory
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the target directory.
DirectoryId String The unique directory id of the target directory.

getDropzoneRecipient()
Gets all recipients assigned to the current user's Dropzone.
Return Type: List<String>
Parameters: N/A

getEnterpriseContactGroups()
Retrieve the list of available Contact Groups in the user's organization, including all email addresses associated with each Contact Group.
Return Type: List<ContactGroup>
Parameters: N/A

getEnterpriseInfo()
Retrieves information about the organization the user belongs to.
Return Type: EnterpriseInfo
Parameters: N/A

generateKeyPair(Description)
Generates a new RSA Key pair used to encrypt keycodes. The private key as well as an identifier associating the public Key is returned to the user. The public key is uploaded and stored on the SendSafely servers.
Return Type: Privatekey
Parameters:
NameTypeDescription
Description String The description used for generating the key pair.

getKeycode(PackageId, PrivateKey)
Downloads and decrypts a keycode from the server for a given packageId and RSA Key pair.
Return Type: String
Parameters:
NameTypeDescription
PackageId String The package id for the keycode.
PrivateKey Privatekey The private key associated with the RSA Key pair used to encrypt the package keycode.

revokePublicKey(PublicKeyId)
Revokes a public key from the server. Only call this if the private key has been deleted and should not be used anymore.
Return Type: void
Parameters:
NameTypeDescription
PublicKeyId String The public key id to revoke.

getFileInformation(PackageId, FileId, DirectoryId)
Retrieves meta data about a file in a Workspace package.
Return Type: FileInfo
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the get file information operation.
FileId String The unique file id of the target file.
DirectoryId String The unique directory id of the directory containing the target file.

getOrganizationPackages(FromDate, ToDate, Sender, Status, Recipient, FileName)
Returns packages in the current user's organization based on provided search criteria. The search defaults to returning all packages up to the current date and time, if a specific value is not passed for each search criteria. A maximum of 100 records will be returned per method call. The calling user must be a SendSafely Enterprise Administrator.
Return Type: PackageSearchResults
Parameters:
NameTypeDescription
FromDate Date Date and time to search for packages with a package timestamp that is greater than or equal to the specified value.
ToDate Date Date and time to search for packages with a package timestamp that is less than or equal to the specified value.
Sender String Email address to search for packages with a matching package sender email address. A valid email address must be provided.
Status PackageStatus PackageStatus enum value to search for packages with a matching package status.
Recipient String Email address to search for packages with a matching recipient email address. A valid email address must be provided.
FileName String Name of a file to search for packages with a matching file name.

getPackageInformation(PackageId)
Fetch the latest package meta data about a specific package given the unique package id.
Return Type: Package
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the get package information operation.

getPackageInformationFromLink(Link)
Fetch the latest package meta data about a specific package given a secure link of type String.
Return Type: Package
Parameters:
NameTypeDescription
Link String String representing the secure link for which package information is to be fetched.

getPackageInformationFromLink(Link)
Fetch the latest package meta data about a specific package given the secure link of type java.net.URL.
Return Type: Package
Parameters:
NameTypeDescription
Link URL java.net.URL object representing the secure link for which package information is to be fetched.

getPackageLink(PackageId, KeyCode)
Returns a secure link for accessing a package. This method is intended for generating a shareable link for a Workspace package, however non-Workspace packages are also supported. Packages with a temporary or deleted PackageState are not supported by this method.
Return Type: String
Parameters:
NameTypeDescription
PackageId String The unique package id of the package to generate the secure link.
KeyCode String The keycode belonging to the package.

getPackageMessage(SecureLink)
Downloads a message from the specified secure link and decrypts it.
Return Type: String
Parameters:
NameTypeDescription
SecureLink String String representing the secure link for which the message is to be downloaded.

getRecipient(PackageId, RecipientId)
Gets a recipient from a given package.
Return Type: Recipient
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the get recipient operation.
RecipientId String The unique recipient id of the recipient to be retrieved.

getUserInformation()
Gets information about the current logged in user.
Return Type: UserInformation
Parameters: N/A

moveDirectory(PackageId, SourceDirectoryId, TargetDirectoryId)
Moves a directory to the specified destination directory in a Workspace package.
Return Type: void
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the move directory operation.
SourceDirectoryId String The unique directory id of the directory to move.
TargetDirectoryId String The unique directory id of the destination directory.

moveFile(PackageId, FileId, TargetDirectoryId)
Moves a file to the specified destination directory in a Workspace package.
Return Type: void
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the move file operation.
FileId String The unique file id of the file to move.
TargetDirectoryId String The unique directory id of the destination directory.

parseLinksFromText(Text)
Parses out SendSafely links from a String of text.
Return Type: List<String>
Parameters:
NameTypeDescription
Text String The text to parse out links from.

removeContactGroupFromPackage(PackageId, GroupId)
Remove a Contact Group from a package.
Return Type: void
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the remove the Contact Group operation.
GroupId String The unique id of the Contact Group to remove from the package.

removeDropzoneRecipient(Email)
Deletes a recipient email address from the current user's Dropzone.
Return Type: void
Parameters:
NameTypeDescription
Email String The recipient email address to delete from the Dropzone.

removeRecipient(PackageId, RecipientId)
Removes a recipient from a given package.
Return Type: void
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the remove recipient operation.
RecipientId String The unique recipient id of the recipient to remove from the package.

removeUserFromContactGroup(GroupId, UserId)
Remove user email address from the specified Contact Group.
Return Type: void
Parameters:
NameTypeDescription
GroupId String The unique id of the Contact Group for the remove user operation.
UserId String The unique id of the user whose email address is to be removed from the Contact Group.

renameDirectory(PackageId, DirectoryId, DirectoryName)
Renames a directory to the specified directory name in a Workspace package.
Return Type: void
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the rename directory operation.
DirectoryId String The unique directory id of the directory to rename.
DirectoryName String The new name of the directory.

updatePackageDescriptor(PackageId, PackageDescriptor)
Updates the package descriptor. For a Workspaces package, this method can be used to change the name of the Workspace.
Return Type: void
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the descriptor update operation.
PackageDescriptor String The string value to update the package descriptor to.

updatePackageLife(PackageId, Life)
Update the package life. Setting the life to 0 means the package will not expire.
Return Type: void
Parameters:
NameTypeDescription
PackageId String The unique package id of the package for the update package life operation.
Life int The new package life. Setting this parameter to 0 means the package will not expire.

updateRecipientRole(PackageId, RecipientId, Role)
Used to update the role of a Workspace package recipient (i.e. Workspace collaborator).
Return Type: void
Parameters:
NameTypeDescription
PackageId String The unique package id of the Workspace package for the update role operation.
RecipientId String The unique recipient id for the Workspace collaborator whose role is to be updated.
Role String String representing the role for the update role operation. Supported values are VIEWER, CONTRIBUTOR, MANAGER, and OWNER.

verifyCredentials()
Verifies a user's API key and secret. This method is typically called when a new user uses the API for the first time.
Return Type: String
Parameters: N/A

verifyVersion()
Verifies the current version of the SendSafely API against the server.
Return Type: Version
Parameters: N/A