Skip to content

Receive files

Receiving files takes two steps: list the available files, then download each file through the linkURL returned in the listing.

AreaListingDownload
MainGET /download/listGET /download/file (through linkURL)
BackupGET /download/list/backupGET /download/file/backup (through linkURL)

List the files

curl -s -G \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  --data-urlencode 'page=0' \
  "$API_BASE/download/list"

For the backup area, use /download/list/backup with the same parameters.

The response returns the files in files:

{
  "status": 0,
  "description": "<description returned by the API>",
  "apiver": "v2 (9.0.1)",
  "user": "USER",
  "files": [
    {
      "id": 1,
      "name": "document.pdf",
      "length": 12345,
      "modified": 1760000000000,
      "linkURL": "https://api.example.com/directlink/v2/download/file?..."
    }
  ],
  "page_next": "1",
  "time": "<date and time>"
}
FieldDescription
files[].idIdentifier of the file in the listing.
files[].nameFile name.
files[].lengthSize, in bytes.
files[].modifiedModification date, in milliseconds since 1970-01-01 UTC.
files[].linkURLSigned link to download the file.
page_nextIndex of the next page.

When there are no files, files can be empty.

Download the file

Use the linkURL of the chosen file, unchanged, with the same token used in the listing:

export FILE_URL='<linkURL returned by the listing>'
curl -L --fail \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  --output ./downloaded-document.pdf "$FILE_URL"

The same command works for the main area and for the backup area: the link already points to the correct route.

Pagination

The page parameter selects the results page, starting at 0. Missing or invalid values are treated as 0. To go through the list, repeat the call with the page_next value until files is empty.

Best practices

  • The download responds with the binary content of the file. Save it to disk; do not try to parse it as JSON.
  • The download requires the linkURL from the listing and the credential of the same user who made the listing. The link alone does not give access to the file. Do not build the /download/file parameters manually.
  • linkURL is a limited-use credential: do not expose it in logs or support tickets.
  • Use curl --fail (or check the HTTP status in your client) so you do not save an error page as if it were the file.

Full contract in Reference: Transfers.

Check integrity

When the sender provided the hash at upload, the download returns the expected SHA-256 in the X-STCPDIRECTLINK-HASH header. Compare it with the hash of the saved file, for example with sha256sum.