Docs Developers Sign in ← Site
Docs / Guides

Automated backups

A common use of the Storage API: push a nightly backup and rely on CloudBox's failover mirroring to keep it safe.

A nightly database backup

#!/usr/bin/env bash
set -euo pipefail
STAMP=$(date +%F_%H%M)
pg_dump "$DATABASE_URL" | gzip > /tmp/db.sql.gz

curl -fsS -X PUT "https://app.cloudbox.biz/api/v1/objects/backups/$STAMP/db.sql.gz" \
  -H "Authorization: Bearer $CLOUDBOX_SECRET" \
  --data-binary @/tmp/db.sql.gz
rm -f /tmp/db.sql.gz

Schedule it with cron or a systemd timer. Each object is written to every healthy storage node, so a single node failure never loses your backup.

Listing & restoring

# list what you've stored
curl "https://app.cloudbox.biz/api/v1/objects?prefix=backups" \
  -H "Authorization: Bearer $CLOUDBOX_SECRET"

# restore a specific dump
curl "https://app.cloudbox.biz/api/v1/objects/backups/2026-07-19_0300/db.sql.gz" \
  -H "Authorization: Bearer $CLOUDBOX_SECRET" -o restore.sql.gz
NoteObjects are capped at 256 MB each. For larger archives, split into parts (e.g. db.sql.gz.part-001) or contact us about the large-file transfer API.