Skip to content

Quickstart

This walkthrough takes you from the first call to uploading and downloading a file, using an OAuth token obtained with a user and password.

Important

Use a test user. Do not reuse production credentials in test environments.

Prerequisites:

  • the Riversoft® STCP DirectLink host of your environment, provided by the service administrator;
  • a user and password with upload and download permission;
  • curl installed.

Set the base URL

export API_BASE='https://api.example.com/directlink/v2'

Replace api.example.com with the host of your environment.

Check availability

curl -i "$API_BASE/healthcheck"

A 200 response indicates that the API is reachable:

{
  "status": "ok",
  "service": "STCPDirectLink",
  "timestamp": "2026-10-16T19:29:23Z",
  "uptime_seconds": 86400
}

Get an access token

read -r -p 'User: ' API_USER
read -r -s -p 'Password: ' API_PASSWORD; printf '\n'

curl -s \
  --data-urlencode 'grant_type=password' \
  --data-urlencode "username=$API_USER" \
  --data-urlencode "password=$API_PASSWORD" \
  "$API_BASE/oauth2/token"

Copy the access_token value from the response into a variable:

export ACCESS_TOKEN='<access_token received>'

Send a file

curl -i \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  -F 'file=@./document.pdf' \
  "$API_BASE/upload"

The 200 response returns the transfer data, such as id, destination, and length.

List the available files

curl -s \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  "$API_BASE/download/list"

Each item in files has a linkURL, the signed link to download that file.

Download a file

export FILE_URL='<linkURL of the chosen file>'
curl -L --fail --output ./downloaded-document.pdf "$FILE_URL"

End the session

curl -i -X POST \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  "$API_BASE/auth/logout"

Expected result: the uploaded file appears at the destination configured for the user, and the file chosen from the listing is saved to ./downloaded-document.pdf.

Note

Operations depend on the rules configured for the user. If any step returns 403, see Access rules and Troubleshooting.

Next steps