Skip to content

Download files with the MASV API

View as Markdown

Download files directly from MASV’s private cloud infrastructure.

MASV makes the following downloads available:

  • Each individual file that was uploaded as part of the package.
  • A zip file for Microsoft Windows and Linux platforms.
  • A zip file for macOS platforms.
loop [For each file] Get link info (link ID + secret) Package ID + package token List files in Package File list (IDs, names, sizes) Get download URL (file ID) Pre-signed download URL Download file (GET) File data Client MASV API Cloud Storage
Diagram source
sequenceDiagram
participant Client
participant API as MASV API
participant Storage as Cloud Storage
Client->>API: Get link info (link ID + secret)
API-->>Client: Package ID + package token
Client->>API: List files in Package
API-->>Client: File list (IDs, names, sizes)
loop For each file
Client->>API: Get download URL (file ID)
API-->>Client: Pre-signed download URL
Client->>Storage: Download file (GET)
Storage-->>Client: File data
end

The package link information can be obtained from the recipient’s email. The package information requires the link_id and secret. See the Links page for more details.

MethodRoute
GET/links/{link_id}
NameTypeRequiredDescription
X-Link-PasswordStringNoSender-supplied password associated with the package
NameTypeRequiredDescription
secretStringYesSecret token associated with the download link
Terminal window
curl -H "X-Link-Password: $PACKAGE_PASSWORD" \
-X GET "https://api.massive.app/v1/links/$LINK_ID?secret=$SECRET"

After a successful request, this endpoint returns 200 OK:

{
"branding": {
"primary_color": "#1DD4CA"
},
"expiry": "2019-02-13T21:33:50.944Z",
"id": "01D2TMG9F5GHMHX8RWZ453VA35",
"name": "MASV Package",
"package_id": "01D2TMG9F0J6JD5SJ55NY27MXJ",
"package_size": 28176354,
"package_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"recipient_email": "someoneelse@masv.io",
"sender_email": "someone@masv.io"
}

Step 2: Obtain file listing for the package

Section titled “Step 2: Obtain file listing for the package”
MethodRoute
GET/packages/{package_id}/files
NameTypeRequiredDescription
X-Package-TokenStringYesPackage token
NameTypeRequiredDescription
package_idStringYesPackage ID obtained from step 1
Terminal window
curl -H "X-Package-Token: $PACKAGE_TOKEN" \
-X GET "https://api.massive.app/v1/packages/$PACKAGE_ID/files"

After a successful request, this endpoint returns 200 OK:

[
{
"id": "01D2TMGA09VHKVW6G3MJH2EP57",
"kind": "file",
"last_modified": "0001-01-01T00:00:00.000Z",
"name": "Hawaii_4_27Retina_L.jpg",
"size": 14914472,
"virus_detected": false
},
{
"id": "01D2TMGZMRZNDWD3852NNASF4D",
"kind": "zip_windows",
"last_modified": "2019-02-03T21:34:13.655Z",
"name": "windows.zip",
"virus_detected": false
},
{
"id": "01D2TMGZMSGYSXFB7MV5V9ZM0X",
"kind": "zip_mac",
"last_modified": "2019-02-03T21:34:13.657Z",
"name": "mac.zip",
"virus_detected": false
}
]
Section titled “Step 3: Obtain download links for the files”

Direct file download URLs are short-lived and not intended for sharing or publishing. They are designed to be used immediately following the request. Use the package download URL (https://get.massive.io/{link_id}?secret={secret}) for sharing, which is active until the package expires or is deleted.

If you are building a custom download page, call the MASV API to get the download URL on demand when the user starts the download. You can include an optional expiry parameter to request a specific time for the URL to become inactive, but this cannot exceed the earliest of the authenticated link expiry time or 7 days.

MethodRoute
GET/packages/{package_id}/files/{file_id}/download
NameTypeRequiredDescription
X-Package-TokenStringYesPackage token
NameTypeRequiredDescription
package_idStringYesPackage ID obtained from step 1
file_idStringYesFile ID obtained from step 2
expiryDate-timeNoOptional custom expiry time for the download URL. Format: ISO 8601
Terminal window
curl -H "X-Package-Token: $PACKAGE_TOKEN" \
-X GET "https://api.massive.app/v1/packages/$PACKAGE_ID/files/$FILE_ID/download"

After a successful request, this endpoint returns 200 OK:

{
"method": "GET",
"url": "https://masv3-storage-stag-wdc.s3-accelerate.amazonaws.com/..."
}

Use the method and url from the previous step to download the file:

Terminal window
curl -X $METHOD "$URL" > /path/to/target/file