Nightly exports over SFTP
Many systems, like ERPs, photo studios and old reporting tools, can only push files over SFTP. Point them at drop.media and each export becomes a private file that deletes itself.
-
Create a key for the system
On the API page, create a key with only
files:write, named after the system (say, "ERP exports"). That key is its SFTP password. Or add the system's public SSH key on the SFTP page instead. -
Point the export at a folder
The folder name sets the options: here, private, and deleted after 30 days.
Hoststring sftp.drop.media, port 22Usernamestring acmeRemote folderstring private/expires-30d/Or from a cron job:
# every night at 02:00 0 2 * * * rsync -av /var/exports/ acme@sftp.drop.media:private/expires-30d/ -
Check it worked
The folder empties as files are stored, which is how you know they're in. A file that can't be stored fails the transfer with the reason, and shows up as an
sftp.upload_failedevent in Logs. -
Do something with each export
Add a
file.createdwebhook to load each export into your warehouse, or list the night's files from a script:$ curl "https://drop.media/api/v1/files?search=sales-export&per_page=50" \ -H "Authorization: Bearer YOUR_API_KEY"
Notes
- Use a different folder per kind of export if they need different expiry:
expires-7d/for daily snapshots,expires-365d/for month-end. - Each file must fit the plan's file size limit. Very large files are better sent with direct uploads on Pro.