Automations
MASV agent allows you to automate certain tasks to save time and support more robust workflows.
Creating an automation returns an automation_id, which can be used to query, update and delete the automation.
To list all automations, use the following request:
masv automation ls
curl -X GET http://localhost:8080/api/v1/automations
Portal Download Automations
Portal download automations are used to automatically download packages uploaded to portals.
There are currently 2 kinds of portal download automations,
Portal Download: polls a single portal for available packagesAll Portals Download: polls all portals associated with a giventeam_id
Portal Download
This automation automatically picks up new packages uploaded to the specified portal and queues them up as a new download. The downloads can be managed in the same way as other user-initiated downloads are handled, and they go through the same state transitions.
To create a portal download automation, use the following request:
masv automation add download \
--name "AUTOMATION_NAME" \
--subdomain "PORTAL_SUBDOMAIN"
--destination "DESTINATION_FOLDER" \
--create-package-folder=true \
--effective-time "2025-01-20 00:00:00" \
--enable=true \
--priority 1
Where:
create-package-folderindicates whether package contents should be placed straight into thedestination, or if they should be placed within dedicated package directories. Defaults to true.prioritythe transfer priority to assign to all created downloadsdestinationis the destination folder where all packages will be downloaded to.effective-timeis a string date/time in RFC333 format which indicates the start date/time after which uploaded packages will be downloaded. Setting it to a date/time in the past will cause the agent to download all packages uploaded after that point in the past until now, and subsequently, any future packages.enabledindicates whether the automation will be enabled immediately or not. Defaults to true.nameis a custom automation name.subdomainis the subdomain of the portal from which uploaded packages will be automatically downloaded. The portal has to be owned by the team of the signed-in user.
curl -H "Content-Type: application/json" -X POST \
http://localhost:8080/api/v1/automations/portal_download -d \
'{
"name": "AUTOMATION_NAME",
"portal_subdomain": "PORTAL_SUBDOMAIN",
"dst_folder": "DESTINATION_FOLDER",
"create_package_folder": true,
"effective_time": "2010-12-12T23:59:59-05:00",
"enabled": true,
"download_priority": 1,
}'
Where:
create_package_folderindicates whether package contents should be placed straight into the dst_folder, or if they should be placed within dedicated package directoriesdownload_prioritythe transfer priority to assign to all created downloadsdst_folderis the destination folder where all packages will be downloaded to.effective_timeis a string date/time in RFC333 format which indicates the start date/time after which uploaded packages will be downloaded. Setting it to a date/time in the past will cause the agent to download all packages uploaded after that point in the past until now, and subsequently, any future packages.enabledindicates whether the automation will be enabled immediately or notnameis a custom automation name.portal_subdomainis the subdomain of the portal from which uploaded packages will be automatically downloaded. The portal has to be owned by the team of the signed-in user.
To update a portal download automation, use the following request:
masv automation update download {automation_id} \
--name "NEW_AUTOMATION_NAME" --disable
The following Portal Download automation fields can be updated:
create-package-folderdestinationpriorityeffective-timeenablednamesubdomain
curl -H "Content-Type: application/json" -X PUT \
http://localhost:8080/api/v1/automations/portal_download/{automation_id} -d \
'{
"name": "NEW_AUTOMATION_NAME",
"enabled": false
}`
The following Portal Download automation fields can be updated:
create_package_folderdst_folderdownload_priorityeffective_timeenablednameportal_subdomain
All Portals Download
This automation polls all portals associated with the specified team_id for available packages. These packages are queued up as new downloads. The downloads can be managed in the same way as other user-initiated downloads are handled, and they go through the same state transitions.
To create an all portals download automation, use the following request:
masv automation add download \
--all \
--name "AUTOMATION_NAME" \
--team-id "TEAM_ID"
--create-package-folder=true \
--create-portal-subfolder=true \
--destination "DESTINATION" \
--effective-time "2025-01-20 00:00:00" \
--enable=true \
--priority 8
Where:
allindicates that this should be an all portals download automationcreate-portal-subfolderindicates whether package folders will be placed directly into thedestination, or if they should be placed within directories based off of the originating portal name.prioritythe transfer priority to assign to all created downloads.destinationis the destination folder where all packages will be downloaded to.effective-timeis a string date/time in RFC333 format which indicates the start date/time after which uploaded packages will be downloaded. Setting it to a date/time in the past will cause the agent to download all packages uploaded after that point in the past until now, and subsequently, any future packages.enabledindicates whether the automation will be enabled immediately or not.nameis a custom automation name.team-idis the Team ID to poll for portal packages. The signed-in user must belong to this team.
curl -H "Content-Type: application/json" -X POST \
http://localhost:8080/api/v1/automations/all_portals_download -d \
'{
"name": "AUTOMATION_NAME",
"team_id": "TEAM_ID",
"dst_folder": "DESTINATION_FOLDER",
"create_portal_subfolder": true,
"effective_time": "2010-12-12T23:59:59-05:00",
"enabled": true,
"download_priority": 3,
}'
Where:
create_portal_subfolderindicates whether package folders will be placed directly into thedst_folder, or if they should be placed within directories based off of the originating portal name.download_prioritythe transfer priority to assign to all created downloads.dst_folderis the destination folder where all packages will be downloaded to.effective_timeis a string date/time in RFC333 format which indicates the start date/time after which uploaded packages will be downloaded. Setting it to a date/time in the past will cause the agent to download all packages uploaded after that point in the past until now, and subsequently, any future packages.enabledindicates whether the automation will be enabled immediately or not.nameis a custom automation name.team_idis the Team ID to poll for portal packages. The signed-in user must belong to this team.
To update an all portals download automation, use the following request:
masv automation update download {automation_id} \
--name "NEW_AUTOMATION_NAME" --disable
The following All Portals Download automation fields can be updated:
create-portal-subfolderdestinationpriorityeffective-timeenablednameteam-id
curl -H "Content-Type: application/json" -X PUT \
http://localhost:8080/api/v1/automations/all_portals_download/{automation_id} -d \
'{
"name": "NEW_AUTOMATION_NAME",
"enabled": false
}`
The following All Portals Download automation fields can be updated:
create_portal_subfolderdst_folderdownload_priorityeffective_timeenablednameteam_id
Watch Folder automations
A watch folder is a type of upload automation that uploads subfolders within the watched directory. After a timeout has passed without detecting any file modifications, the subfolder is sent as a package, delivered according to the type of upload automation.
Attention
Top level files in the watch folder will be ignored. Ensure that the files you want delivered are properly placed in their appropriate package subfolder.
There are two types of watch folder automations:
- Send (Team) Upload: sends all subfolders within the watch folder to the configured recipient(s).
- Portal Upload: sends all subfolders to the configured portal.
Note
MASV Agent cannot upload to a Portal that requires metadata.
Send (Team) Upload
To create a Send automation, use the following request:
masv automation add upload email \
--name "AUTOMATION_NAME" \
--enable=true \
--path "PATH_TO_WATCH" \
--recipients '[email protected],[email protected]' \
--team-id "TEAM_ID" \
--timeout 5 \
--blacklist ".exe,.jpg" \
--delete-after 5 \
--delete-files-after-upload=true \
--download-limit 3 \
--download-password "PASSWORD" \
--message "PACKAGE_MESSAGE" \
--package_name_suffix "SUFFIX" \
--priority 1 \
--upload-loose-files=true
Where the following fields are required:
nameis the name of the automation, used for identification.enableis the enabled/disabled state of the automation.pathis the directory to be watched. After the timeout window of inactivity, subfolders within this path will be sent as packages.recipientsis an array of emails to send the packages to.team-idis the TeamID from which to send the package(s).timeoutis the filesystem inactivity timeout in minutes. If no changes are observed after this duration, the packages are sent.
And the following fields are optional:
blacklistis an array of glob patterns to ignore when scanning files in the watch folder.delete-after: Integer value, specifying the number of days to keep the package(s) in storage.delete-files-after-uploadis a boolean value, indicating whether to clean up the source package subfolder once the package upload has completed.download-limitis an override for the team's maximum downloads available for the sent package(s)download-password: Optional password that all downloaders must enter before being granted access to the package(s).messageis an optional message that will be sent to recipients along with the package(s).package-name-suffixis an optional suffix that is added as a suffix after the subfolder name, combining to form the name of the package(s).priorityis an integer value that is assigned as the transfer priority for all created uploadstag-idis a ID of an existing tag object that will be passed to all created uploads.tag-nameis a Name of an existing tag object that will be passed to all created uploads.unlimited-storageis a boolean value that forwards the flag to all created uploadsupload-loose-filesDetermines if the loose, top level files in the watch-folder will be uploaded as their own packages.
curl -H "Content-Type: application/json" -X POST \
http://localhost:8080/api/v1/automations/team_upload -d \
'{
"name":"send automation 1",
"path":"/path/to/watch/folder",
"timeout":5,
"enabled":true,
"team_id":"TEAM_ID",
"recipient_emails":["[email protected]"]
}'
Where the following fields are required:
nameis the name of the automation, used for identification.enabledis the enabled/disabled state of the automation.pathis the directory to be watched. After the timeout window of inactivity, subfolders within this path will be sent as packages.recipient_emailsis an array of emails to send the packages to.team_idis the TeamID from which to send the package(s).timeoutis the filesystem inactivity timeout in minutes. If no changes are observed after this duration, the packages are sent.
And the following fields are optional:
blacklistis an array of glob patterns to ignore when scanning files in the watch folder.delete_after: Integer value, specifying the number of days to keep the package(s) in storage.delete_files_after_uploadis a boolean value, indicating whether to clean up the source package subfolder once the package upload has completed.download_limitis an override for the team's maximum downloads available for the sent package(s)download_password: Optional password that all downloaders must enter before being granted access to the package(s).messageis an optional message that will be sent to recipients along with the package(s).package_name_suffixis an optional suffix that is added as a suffix after the subfolder name, combining to form the name of the package(s).send_loose_filesis a boolean value that, if true, directs the automation to send individual top level loose files in the watch folder as individual packages.tagis a tag object of the form{"name":"my_tag_name","id":"my_tag_id"}that will be passed to all created uploads.unlimited storageis a boolean value that forwards the flag to all created uploadsupload_priorityis an integer value that is assigned as the transfer priority for all created uploads
To update a Send automation, use the following request:
masv automation update upload email {automation_id} \
--name "NEW_AUTOMATION_NAME" --disable
The following Send automation fields can be updated:
blacklistdelete-afterdelete-files-after-uploaddownload-limitdownload-passwordenablemessagenamepathpackage-name-suffixpriorityrecipientsteam-idtimeouttag-idtag-nameunlimited-storageupload-loose-files
curl -H "Content-Type: application/json" -X PUT \
http://localhost:8080/api/v1/automations/team_upload/{automation_id} -d \
'{"name":"name2"}'
The following Send automation fields can be updated:
blacklistdelete_afterdelete_files_after_uploaddownload_limitdownload_passwordenabledmessagenamepathpackage_name_suffixrecipient_emailssend_loose_filesteam_idtimeouttagunlimited_storageupload_priority
Portal Upload
To create a Portal Upload automation, use the following request:
masv automation add upload portal \
--enable=true \
--name "AUTOMATION_NAME" \
--path "PATH_TO_WATCH" \
--subdomain "PORTAL_SUBDOMAIN" \
--sender "[email protected]" \
--timeout 5 \
--blacklist ".exe,.jpg" \
--delete-files-after-upload=true \
--message "PACKAGE MESSAGE" \
--package-name-suffix "SUFFIX" \
--password "PASSWORD" \
--priority 3 \
--upload-loose-files=true
Where the following fields are required:
enableis the enabled/disabled state of the automation.nameis the name of the automation, used for identification.pathis the directory to be watched. After the timeout window of inactivity, subfolders within this path will be sent as packages.subdomainis the portal subdomain of the portal the package(s) will be sent to.senderis the sender email that the recipient will see when they receive the package(s).timeoutis the filesystem inactivity timeout in minutes. If no changes are observed after this duration, the packages are sent.
And the following fields are optional:
blacklistis an array of glob patterns to ignore when scanning files in the watch folder.delete-files-after-uploadis a boolean value indicating whether or not to clean up the source subfolder once the package upload has completed.messageis an optional message that will be sent along with the package(s).package-name-suffixis an optional suffix that is added as a suffix after the subfolder name, combining to form the name of the package(s).passwordis the password required to upload to the configured portal. If the portal requires no password, leave this blank.priorityis an integer value that is assigned as the transfer priority for all created uploads.upload-loose-filesis a boolean value that, if true, directs the automation to send individual top level loose files in the watch folder as individual packages.
curl -H "Content-Type: application/json" -X POST \
http://localhost:8080/api/v1/automations/portal_upload -d \
'{
"name":"portal upload automation 1",
"path":"/path/to/watch/folder",
"timeout":5,
"enabled":true,
"portal_subdomain":"PORTAL_SUBDOMAIN",
"sender_email":"[email protected]"
}'
Where the following fields are required:
enabledis the enabled/disabled state of the automation.nameis the name of the automation, used for identification.pathis the directory to be watched. After the timeout window of inactivity, subfolders within this path will be sent as packages.portal_subdomainis the portal subdomain of the portal the package(s) will be sent to.sender_emailis the sender email that the recipient will see when they receive the package(s).timeoutis the filesystem inactivity timeout in minutes. If no changes are observed after this duration, the packages are sent.
And the following fields are optional:
blacklistis an array of glob patterns to ignore when scanning files in the watch folder.delete_files_after_uploadis a boolean value indicating whether or not to clean up the source subfolder once the package upload has completed.messageis an optional message that will be sent along with the package(s).package_name_suffixis an optional suffix that is added as a suffix after the subfolder name, combining to form the name of the package(s).portal_passwordis the password required to upload to the configured portal. If the portal requires no password, leave this blank.send_loose_filesis a boolean value that, if true, directs the automation to send individual top level loose files in the watch folder as individual packages.upload_priorityis an integer value that is assigned as the transfer priority for all created uploads.
To update a Portal Upload automation, use the following request:
masv automation update upload portal {automation_id} \
--name "NEW_AUTOMATION_NAME" --disable
The following portal upload automation fields can be updated:
blacklistdelete-files-after-uploadenablemessagenamepackage-name-suffixpathpasswordprioritysubdomainsendertimeoutupload_loose_files
curl -H "Content-Type: application/json" -X PUT \
http://localhost:8080/api/v1/automations/team_upload/{automation_id} -d \
'{"name":"name2"}'
The following portal upload automation fields can be updated:
blacklistdelete_files_after_uploadenabledmessagenamepackage_name_suffixpathportal_passwordportal_subdomainsend_loose_filessender_emailtimeoutupload_priority
Stream Upload Automations
A stream upload automation is used to upload growing files to the desired recipient. Each stream automation has a path to a stream folder, where the automation will scan for new files to stream. After a timeout has passed without detecting any file size changes, the growing file upload is finalized.
Attention
Stream Upload automations will only work with supported file formats and codecs that append to the end of a given file. File chunk modifications that are made to already streamed chunks will not be synced with the resulting package.
Attention
Any directories within the stream folder will be ignored. Ensure that the growing files you want delivered are properly placed directly in the stream folder.
There are two types of watch folder automations:
- Send (Team): sends the growing files within the stream folder to the configured recipient(s).
- Portal Upload: sends the growing files to the configured portal.
Note
MASV Agent cannot upload a stream to a Portal that requires metadata.
Send (Team) Stream
To create a Send Stream automation, use the following request:
masv automation add upload email \
--name "AUTOMATION_NAME" \
--enable=true \
--path "PATH_TO_WATCH" \
--recipients '[email protected],[email protected]' \
--team-id "TEAM_ID" \
--timeout 5 \
--whitelist=".txt,.doc" \
--delete-after 3 \
--download-limit 77 \
--download-password "PASSWORD" \
--message "PACKAGE MESSAGE" \
--priority 3 \
--growing-files
Where the following fields are required:
nameis the name of the automation, used for identification.enableis the enabled/disabled state of the automation.pathis the directory to be watched. Uploads will be created immediately after a new top-level files are detected within the stream directory.recipientsis an array of emails to send the packages to.team-idis the TeamID from which to send the package(s).timeoutis the filesystem inactivity timeout in seconds. If no changes are observed after this duration, any ongoing stream is finalized.
And the following fields are optional:
whitelistis an array of glob patterns to stream. If empty, all files will be streamed.delete-after: Integer value, specifying the number of days to keep the package(s) in storage.download-limitis an override for the team's maximum downloads available for the sent package(s)download-password: Optional password that all downloaders must enter before being granted access to the package(s).messageis an optional message that will be sent to recipients along with the package(s).priorityis an integer value that is assigned as the transfer priority for all created uploadstag-idis a ID of an existing tag object that will be passed to all created uploads.tag-nameis a Name of an existing tag object that will be passed to all created uploads.unlimited-storageis a boolean value that forwards the flag to all created uploads
curl -H "Content-Type: application/json" -X POST \
http://localhost:8080/api/v1/automations/team_stream -d \
'{
"name":"team stream automation 1",
"team_id":"TEAM_ID",
"path":"/path/to/stream/folder",
"timeout":60,
"recipient_emails":["[email protected]"],
"enabled":true,
"delete_after":1,
"whitelist":["*.mxf"]
}'
Where the following fields are required:
nameis the name of the automation, used for identification.enabledis the enabled/disabled state of the automation.pathis the directory to be watched. Uploads will be created immediately after a new top-level files are detected within the stream directory.recipient_emailsis an array of emails to send the packages to.team_idis the TeamID from which to send the package(s).timeoutis the filesystem inactivity timeout in seconds. If no changes are observed after this duration, any ongoing stream is finalized.
And the following fields are optional:
whitelistis an array of glob patterns to stream. If empty, all files will be streamed.delete_after: Integer value, specifying the number of days to keep the package(s) in storage.download_limitis an override for the team's maximum downloads available for the sent package(s)download_password: Optional password that all downloaders must enter before being granted access to the package(s).messageis an optional message that will be sent to recipients along with the package(s).tagis a tag object of the form{"name":"my_tag_name","id":"my_tag_id"}that will be passed to all created uploads.unlimited storageis a boolean value that forwards the flag to all created uploadsupload_priorityis an integer value that is assigned as the transfer priority for all created uploads
To update a Send (Team) stream automation, use the following request:
masv automation update upload team {automation_id} \
--name "NEW_AUTOMATION_NAME" --disable
The following Send (Team) stream automation fields can be updated:
whitelistdelete-afterdownload-limitdownload-passwordenablemessagenamepathpriorityrecipientsteam-idtimeouttag-idtag-nameunlimited-storage
curl -H "Content-Type: application/json" -X PUT \
http://localhost:8080/api/v1/automations/team_stream/{automation_id} -d \
'{"name":"team stream automation 2"}'
The following Send (Team) stream automation fields can be updated:
whitelistdelete_afterdownload_limitdownload_passwordenabledmessagenamepathrecipient_emailsteam_idtimeouttagunlimited_storageupload_priority
Portal Stream
To create a Portal Stream automation, use the following request:
masv-srv automation add upload portal \
--whitelist ".txt,.jpg" \
--enable=true \
--message "MESSAGE" \
--name "AUTOMATION NAME" \
--password "PASSWORD" \
--path "PATH_TO_WATCH" \
--priority 1 \
--sender "[email protected]" \
--subdomain "SUBDOMAIN" \
--timeout 5 \
--growing-files
Where the following fields are required:
enableis the enabled/disabled state of the automation.nameis the name of the automation, used for identification.pathis the directory to be watched. Uploads will be created immediately after a new top-level files are detected within the stream directory.subdomainis the portal subdomain of the portal the package(s) will be sent to.senderis the sender email that the recipient will see when they receive the package(s).timeoutis the filesystem inactivity timeout in seconds. If no changes are observed after this duration, the ongoing stream is finalized.
And the following fields are optional:
whitelistis an array of glob patterns to stream. If empty, all files will be streamed.messageis an optional message that will be sent along with the package(s).passwordis the password required to upload to the configured portal. If the portal requires no password, leave this blank.priorityis an integer value that is assigned as the transfer priority for all created uploads.
curl -H "Content-Type: application/json" -X POST \
http://localhost:8080/api/v1/automations/portal_stream -d \
'{
"name":"portal stream automation 1",
"path":"/path/to/stream/folder",
"timeout":60,
"enabled":true,
"portal_subdomain":"PORTAL_SUBDOMAIN",
"sender_email":"[email protected]"
}'
Where the following fields are required:
enabledis the enabled/disabled state of the automation.nameis the name of the automation, used for identification.pathis the directory to be watched. Uploads will be created immediately after a new top-level files are detected within the stream directory.portal_subdomainis the portal subdomain of the portal the package(s) will be sent to.sender_emailis the sender email that the recipient will see when they receive the package(s).timeoutis the filesystem inactivity timeout in seconds. If no changes are observed after this duration, the ongoing stream is finalized.
And the following fields are optional:
whitelistis an array of glob patterns to stream. If empty, all files will be streamed.messageis an optional message that will be sent along with the package(s).portal_passwordis the password required to upload to the configured portal. If the portal requires no password, leave this blank.upload_priorityis an integer value that is assigned as the transfer priority for all created uploads.
To update a Portal Stream automation, use the following request:
masv automation update upload portal {automation_id} \
--name "NEW_AUTOMATION_NAME" --disable
The following Send (Team) stream automation fields can be updated:
whitelistenablemessagenamepathpasswordprioritysubdomainsendertimeout
curl -H "Content-Type: application/json" -X PUT \
http://localhost:8080/api/v1/automations/team_stream/{automation_id} -d \
'{"name":"name2"}'
The following Send (Team) stream automation fields can be updated:
whitelistenabledmessagenamepathportal_passwordportal_subdomainsender_emailtimeoutupload_priority
Removing Automations
To delete any type of automation with the CLI, use the following request:
masv automation rm {automation-id}
Using the REST API, different endpoints need to be used to correctly delete automations.
curl -X DELETE http://localhost:8080/api/v1/automations/portal_download/{automation_id}
curl -X DELETE http://localhost:8080/api/v1/automations/all_portals_download/{automation_id}
curl -X DELETE http://localhost:8080/api/v1/automations/team_upload/{automation_id}
curl -X DELETE http://localhost:8080/api/v1/automations/portal_upload/{automation_id}
curl -X DELETE http://localhost:8080/api/v1/automations/team_stream/{automation_id}
curl -X DELETE http://localhost:8080/api/v1/automations/portal_stream/{automation_id}
Export & Import
Automation can be exported to a base64 string, which can then be imported by the transfer-agent or desktop-app. This can be used to share automations between transfer-agents or desktop-apps, or duplicate automations if need be.
When using the CLI, any automation can be exported with the same request
masv automation export {automation_id}
When using the REST API, use one of the following requests depending on the automation type:
curl http://localhost:8080/api/v1/automations/portal_download/{automation_id}/export
curl http://localhost:8080/api/v1/automations/portal_upload/{automation_id}/export
curl http://localhost:8080/api/v1/automations/team_upload/{automation_id}/export
curl http://localhost:8080/api/v1/automations/team_stream/{automation_id}/export
curl http://localhost:8080/api/v1/automations/portal_stream/{automation_id}/export
The response for this request will be a json payload, with a single data field.
{"data":"base64_data"}
This data field can then be used with the import automation endpoint
masv automation import 'base64_data'
curl -H "Content-Type: application/json" -X POST \
http://localhost:8080/api/v1/automations/import -d \
'{"data":"base64_data"}'