How to use Cella from other apps
Any app can back up files to your Google Cloud Storage Archive through Cella, list what's there and fetch it back. Choose the approach that fits your app.
| You're building… | Use | Effort |
|---|---|---|
| A web page that needs an upload button | Widget | 2 lines of HTML |
| A web or Node.js app with its own interface | JavaScript client | A few lines |
| Anything else: Python, PHP, Go, Swift, Kotlin, shell… | REST API | Plain HTTP |
| Scheduled backups of a folder on a server or laptop | Command-line tool | One command |
1. Get a key
- Sign in to Cella as admin and open Setup → API keys → Create a key for another app.
- Give it a name, such as "Photo app", and choose the access level:
- Backup: upload, list and download. Most apps need this.
- Read: list and download only.
- Admin: everything, including deleting and changing settings. Use it only for trusted server-side tools.
- Choose which archive the key can use, ideally just one.
- Optional, through the API: send
"ownFolder": true, "device": "Sarah's iPhone"withPOST /api/v1/keys. The key can then only usephotos/Sarah's iPhone/andfiles/Sarah's iPhone/. Photo uploads are always filed under that name, and everything else returns403. - Copy the key straight away. It starts with
cella_and is shown only once.
Browser apps on another website must also have their address allowed, for example https://myapp.example.com. Either set CELLA_ALLOWED_ORIGINS=https://myapp.example.com on the server (comma-separated for several), or send POST /api/v1/setup/settings with { "allowedOrigins": ["https://myapp.example.com"] } using an admin key. Server-side programs, mobile apps and scripts don't need this.
Throughout this guide, your Cella address is https://YOUR-CELLA.
2. The widget (no coding)
Add the script and the <cella-backup> tag anywhere on your page. It shows a button, the picker, a progress bar and the results, all in your page.
<script src="https://YOUR-CELLA/embed.js"></script>
<cella-backup
server="https://YOUR-CELLA"
api-key="cella_xxxxxxxx_yourBackupKey"
mode="photos"
device="My app">
</cella-backup>
Settings
| Attribute | What it does |
|---|---|
server | Your Cella address. |
api-key | A backup key (see step 1). |
bucket | Which archive to use. Optional; if you leave it out, the default archive is used. |
mode | photos: photos and videos, filed by the date taken and skipped if already archived.files: any files, stored under prefix.browse: lets people see and download what's archived. |
device | Name used in the folder path, for example photos/My app/2026/11/…. |
prefix | Folder for files mode, or the starting folder for browse mode. |
label | Button text. |
Show progress in your own interface
The widget sends events that your page can listen for:
const w = document.querySelector('cella-backup');
w.addEventListener('cella-progress', e => {
// e.detail = { done, total, uploaded, skipped, failed, bytesDone, bytesTotal, current }
myProgressBar.value = e.detail.bytesDone / e.detail.bytesTotal;
});
w.addEventListener('cella-file', e => console.log(e.detail.file.name, e.detail.status)); // uploaded | skipped | failed
w.addEventListener('cella-complete', e => alert(`${e.detail.uploaded} backed up`));
w.addEventListener('cella-error', e => console.error(e.detail.message));
// You can also hand it files yourself, e.g. from your own drag-and-drop area:
await w.backup(fileList);
| Event | When |
|---|---|
cella-ready | The widget has connected and is ready. |
cella-progress | Repeatedly while uploading. |
cella-file | Each time a file finishes, is skipped or fails. |
cella-complete | A backup run has finished, with totals. |
cella-download | Someone downloaded a file (browse mode). |
cella-error | Something went wrong. |
Match your app's look
cella-backup {
--cella-accent: #3b4cca; /* button and progress colour */
--cella-bg: #ffffff;
--cella-ink: #222222;
--cella-radius: 10px;
--cella-font: inherit;
}
cella-backup::part(button) { text-transform: uppercase; }
A complete page is in the repository at examples/widget.html.
3. The JavaScript client
Use this when your app has its own buttons and screens. It's the same upload engine the Cella app uses: resumable uploads, automatic retries, duplicate skipping and photo dates read from the photo. It works in browsers and in Node.js 18 and later.
In a web page
<script src="https://YOUR-CELLA/cella-client.js"></script>
<input type="file" id="pick" accept="image/*,video/*" multiple>
<script>
const cella = new CellaClient({
server: 'https://YOUR-CELLA',
apiKey: 'cella_xxxxxxxx_yourBackupKey'
});
document.getElementById('pick').onchange = async e => {
const result = await cella.backupPhotos(e.target.files, {
device: 'My app',
onProgress: p => console.log(Math.round(100 * p.bytesDone / p.bytesTotal) + '%')
});
console.log(result.uploaded, 'uploaded,', result.skipped, 'already safe,', result.failed, 'failed');
};
</script>
In Node.js
// Copy https://YOUR-CELLA/cella-client.js into your project
const fs = require('fs');
const CellaClient = require('./cella-client.js');
const cella = new CellaClient({ server: 'https://YOUR-CELLA', apiKey: process.env.CELLA_KEY });
cella.bucket = (await cella.me()).defaultBucket;
const blob = await fs.openAsBlob('report.pdf'); // Node 20+
await cella.uploadFile(blob, { name: 'reports/2026/report.pdf' });
A complete script is in the repository at examples/node_backup.js.
What it can do
| Method | What it does |
|---|---|
backupPhotos(files, { device, onProgress, onFile, concurrency }) | Back up photos and videos: skips ones already archived and files them as photos/<device>/<YYYY>/<MM>/. |
uploadFile(blob, { name, onProgress }) | Upload one file to any path. If the same name and size already exist, it is skipped. |
listObjects({ prefix, delimiter, pageToken }) | List files (items) and sub-folders (prefixes). |
thumbnailUrl(name), addThumbnail(file, name), CellaClient.makeThumbnail(file) | Show a thumbnail (as a local URL for <img>), or make and store one in the browser. backupPhotos does this automatically. |
stat(name) | Size, date, type and storage class of one file. |
usage({ prefix }) | Files, size and approximate monthly storage cost for a folder and each sub-folder (total, folders). |
downloadLink(name, { inline, ttlSeconds }) | A temporary URL that works without the key. Use it for <a href> links and to show or share a file. |
download(name) | The file's bytes, as a fetch Response. |
remove(name) | Delete a file (admin keys only). |
deletePreview({ file | prefix }), deleteFolder(prefix), deleteArchive(bucket) | Preview and permanently delete a folder or whole archive (admin keys only). |
transferPreview({ to, mode, file | prefix }), transfer({ to, mode, file | prefix }) | Copy or move (mode: 'move') to another archive, with costs first (admin keys only). |
pause() / resume() | Pause and resume uploads in progress. |
me(), listBuckets(), status() | Information about the key, the archives and the server. |
If a call fails, it throws a CellaClient.CellaError with .status (the HTTP code) and .message.
4. The REST API (any language)
Every request goes to https://YOUR-CELLA/api/v1/… and sends the key in a header:
X-Cella-Key: cella_xxxxxxxx_yourKey
Requests and responses are JSON unless you are sending or receiving file bytes. The full machine-readable description is at /api/v1/openapi.json, which you can import into Postman or Insomnia or use to generate a client.
Upload a file in one request
This is the simplest way, and fine for small files on a good connection. URL-encode the file's path, including the slashes (/ becomes %2F).
curl -X PUT \
-H "X-Cella-Key: $CELLA_KEY" \
-H "Content-Type: application/pdf" \
--data-binary @report.pdf \
"https://YOUR-CELLA/api/v1/buckets/my-archive/objects/reports%2F2026%2Freport.pdf"
List, download and share
# What's in a folder?
curl -H "X-Cella-Key: $CELLA_KEY" \
"https://YOUR-CELLA/api/v1/buckets/my-archive/objects?prefix=reports/&delimiter=/"
# → { "items": [ { "name", "size", "contentType", "storageClass", "updated", "md5" } ],
# "prefixes": [ "reports/2026/" ], "nextPageToken": null }
# Download
curl -H "X-Cella-Key: $CELLA_KEY" -o report.pdf \
"https://YOUR-CELLA/api/v1/buckets/my-archive/objects/reports%2F2026%2Freport.pdf"
# A link that works for 5 minutes without a key (good for apps and browsers)
curl -X POST -H "X-Cella-Key: $CELLA_KEY" -H "Content-Type: application/json" \
-d '{"name":"reports/2026/report.pdf","ttlSeconds":300}' \
"https://YOUR-CELLA/api/v1/buckets/my-archive/links"
# → { "url": "/api/v1/dl/…", "expiresInSeconds": 300 }
All endpoints
| Method and path | Purpose | Key needed |
|---|---|---|
GET /status | Version and whether Cella is set up | none |
GET /catalog | Storage classes, locations and backup plans | none |
POST /estimate | Rough cost estimate: { gb, restoresPerYear } | none |
GET /rates | Exchange rates per 1 USD for USD, EUR and GBP (European Central Bank daily rates). Costs from the API are in USD; multiply by a rate to convert | none |
GET /me | The calling key, its access and the default archive | read |
GET /buckets | Archives this key can use | read |
GET /buckets/{b}/objects | List: ?prefix= &delimiter=/ &pageToken= &maxResults= | read |
GET /buckets/{b}/objects/{name} | Download. Add ?stat=1 for details only, or ?inline=1 to view in a browser | read |
POST /buckets/{b}/links | Temporary download URL | read |
GET / PUT /buckets/{b}/thumbs/{name} | Get or store a file's JPEG thumbnail (kept in Standard storage, so viewing it has no retrieval fee). List with ?thumbs=1 to see which files have one | read / backup |
GET /buckets/{b}/usage?prefix= | Files, size and approximate monthly storage cost for a folder and each sub-folder. Worked out from file sizes only, so it costs no retrieval fees | read |
PUT /buckets/{b}/objects/{name} | Upload in one request | backup |
POST /uploads then PUT /uploads/{id} | Resumable upload, for large files and mobile (see section 5) | backup |
GET /buckets/{b}/download-preview?prefix= | Files, size and retrieval fee for downloading a folder | read |
POST /buckets/{b}/zip-links | One-use link (5 minutes) that downloads a folder as a ZIP: { "prefix": "photos/" } | read |
GET /buckets/{b}/search?q=&prefix= | Find files by any part of their path (all words must match), up to 500 | read |
GET /buckets/{b}/photos?prefix=&offset=&limit= | Photo timeline: photos and videos, newest month first, in pages | read |
POST /buckets/{b}/download-preview / zip-links with { "names": [...] } | Download chosen files as one ZIP | read |
POST /backups/log, GET /backups | Record a finished backup; when each phone last backed up | backup / read |
POST /buckets/{b}/shares, GET /shares, DELETE /shares/{id} | Family share links ({ "prefix" } or { "names" }, days 1-30) | admin |
GET /costs, POST /costs/alert | Monthly cost across archives, history and alert level | admin |
POST /uploads/{id}/finish | Check the stored file matches (size and CRC32C checksum) | backup |
GET /uploads/{id} | How much of an upload the server already has | backup |
POST /photos/check | Which photos are already archived | backup |
DELETE /buckets/{b}/objects/{name} | Delete a file (and its older versions) | admin |
GET /buckets/{b}/delete-preview, POST /buckets/{b}/delete-folder, DELETE /buckets/{b} | Preview and permanently delete a file, folder or whole archive (all versions), with a confirmation value | admin |
GET /buckets/{b}/transfer-preview, POST /buckets/{b}/transfer | Copy or move a file, folder or whole archive to another archive (and so another plan), inside Google Cloud, with a cost preview | admin |
POST /buckets, /keys, /setup/… | Create archives and keys, change settings | admin |
5. Large files and mobile apps: resumable uploads
For anything bigger than a few MB, or any upload over a mobile connection, send the file in pieces. If the connection drops, you ask Cella how much it has and carry on from there.
- Start:
POST /uploadswith the file's details.
For photos, sendPOST /api/v1/uploads { "name": "videos/holiday.mp4", "size": 734003200, "contentType": "video/mp4" } → { "uploadId": "5a74e2…", "chunkSize": 8388608, "received": 0 } → or { "skipped": true, "object": {…} } when the same file is already archived"kind": "photo", "filename": "IMG_1234.JPG", "lastModified": <ms timestamp of when it was taken>, "device": "My app"instead ofname. Cella then files it asphotos/My app/2026/11/IMG_1234.JPG. - Send pieces in order:
PUT /uploads/{uploadId}?offset=N, with the raw bytes fromNtoN + chunkSizeas the body (Content-Type: application/octet-stream). Every piece except the last must be exactlychunkSizebytes.
Always use the→ { "received": 8388608, "done": false } → … last piece … → { "received": 734003200, "done": true, "object": { "name": "videos/holiday.mp4", … } }receivedvalue from the reply as your nextoffset. - If something fails (timeout, no signal or app restarted): call
GET /uploads/{uploadId}. It returns{ "received": N }, and you resume fromoffset=N. Save theuploadIdif you want to resume after your app restarts. Upload sessions last about 6 days. - Confirm (recommended):
POST /uploads/{uploadId}/finishwith{ "crc32c": "<base64>" }, the CRC32C checksum of the whole file (the same form Google uses). Cella checks the stored file's size and checksum. A match returns{ "verified": true }. A mismatch returns422: the damaged copy has been removed where the archive allows it, so send the file again.
Faster: send straight to Google. Add "direct": true to POST /uploads. The reply then also has a directUrl, and you send the pieces there instead, with a Content-Range: bytes N-M/TOTAL header. Google replies 308 while there's more to send, and 200 at the end. The address only works for that one file. In a browser, it only accepts requests from the page that started the upload. If it fails, check GET /uploads/{uploadId}, then carry on with either route: both use the same upload. The JavaScript client does all of this for you, and falls back to sending through Cella if a network blocks Google.
Uploads are create-only: an upload never replaces a file that's already stored. If a file with the same name appears while you're uploading, the last piece is refused with 412.
If you send a piece at the wrong offset, Cella doesn't store it and replies { "resync": true, "received": N }. Just carry on from N.
6. Python example
This uses the standard library only. A complete version with retries is in the repository at examples/python_backup.py.
import json, os, urllib.request
SERVER, KEY = "https://YOUR-CELLA", os.environ["CELLA_KEY"]
def call(method, path, body=None, raw=None):
headers = {"X-Cella-Key": KEY}
data = json.dumps(body).encode() if body is not None else raw
headers["Content-Type"] = "application/json" if body is not None else "application/octet-stream"
req = urllib.request.Request(SERVER + "/api/v1" + path, data=data, method=method, headers=headers)
with urllib.request.urlopen(req) as res:
return json.loads(res.read() or b"null")
path = "holiday.mp4"
up = call("POST", "/uploads", {"name": "videos/" + path, "size": os.path.getsize(path)})
if not up.get("skipped"):
offset = 0
with open(path, "rb") as f:
while True:
f.seek(offset)
r = call("PUT", f"/uploads/{up['uploadId']}?offset={offset}", raw=f.read(up["chunkSize"]))
offset = r["received"]
if r["done"]:
print("stored", r["object"]["name"])
break
7. Command-line tool
The tool is bin/cella-backup.js in the repository and needs Node.js 18 or later. It's useful for cron jobs, NAS boxes and servers.
export CELLA_SERVER=https://YOUR-CELLA CELLA_KEY=cella_...
node bin/cella-backup.js ~/Documents # → files/<hostname>/Documents/…
node bin/cella-backup.js --prefix files/office-pc ~/Documents
node bin/cella-backup.js --photos --device "Camera SD" /media/DCIM # filed by date taken
node bin/cella-backup.js --dry-run ~/Documents # list what would be sent
# Every night at 02:30 (crontab -e)
30 2 * * * CELLA_SERVER=https://YOUR-CELLA CELLA_KEY=cella_... node /opt/cella/bin/cella-backup.js /srv/data
Files already archived with the same name and size are skipped, so repeat runs only send what's new or changed. The exit code is 0 when everything succeeds, 2 when some files failed and 1 for other errors.
8. Errors
Errors come back as { "error": "message", "status": 403 } with the matching HTTP status code.
| Code | Meaning | What to do |
|---|---|---|
| 400 | Something in the request is wrong | Read the message, for example a missing size or a bad name. |
| 401 | No key, or the key was revoked | Check the X-Cella-Key header. |
| 403 | The key isn't allowed to do this, or the file is locked by a retention policy | Use a key with more access, or the right archive. |
| 404 | No such file, archive or upload | Check the name. Remember to URL-encode slashes. |
| 409 | Cella isn't set up yet, or the archive name is taken | Finish setup, or pick another name. |
| 413 | Piece too large | Send exactly chunkSize bytes. |
| 429, 5xx, network errors | Temporary problem | Wait and retry. For uploads, check GET /uploads/{id} first. |
9. Security tips
- One key per app. If an app is lost or compromised, revoke just that key in Setup → API keys.
- Give the least access needed: a Backup key limited to one archive. Never put an admin key in an app or a web page.
- A key in a public web page can be read by anyone who views the page source. For public websites, call Cella from your own server and keep the key there.
- Keep keys in environment variables or a secrets store, not in source code you commit.
- Share files using
downloadLink/POST …/links. Those links expire, and they never expose your key. - Downloading from Archive storage has a retrieval fee per GB, so don't download files automatically (for example, to show previews).