HTTP API

The routes under the SDKs: sign-in, the file tree, uploads, reads, versions and errors.

The tools and SDKs speak one JSON API. Use an SDK unless you are writing one: a file is stored as verified pieces with a manifest, sealed on your side when encryption is on, and the SDKs do that work.

Requests

curl https://api.phantomdisk.com/v1/account \
  -H "Authorization: Bearer $PHANTOMDISK_KEY" \
  -H "X-Drive: <drive id>"         # leave out for the main drive

File data never passes through this API. An upload or a read asks for short-lived links and the data goes straight to and from storage.

Routes a key can use

RouteWhat it does
GET /v1/accountWhether the key may write, storage used and allowed, encryption state
GET /v1/drivesThe drives the key can use
POST /v1/drivesA new drive (only a write key for every drive)
GET /v1/changes?after=<cursor>Changes to the tree since a cursor, in order. Start from 0 and keep the cursor it returns
GET /v1/changes/snapshotThe whole tree in pages, when the cursor is too old
POST /v1/changesUp to 100 operations: createFolder, copy, rename, move, trash, restore
POST /v1/uploadsStart an upload; then /uploads/{id}/urls for links and /uploads/{id}/complete to commit
POST /v1/files/{versionId}/read-urlsLinks to read a version’s pieces
GET /v1/files/{nodeId}/versionsA file’s versions
POST /v1/files/{nodeId}/versions/{versionId}/restoreMake an old version current
GET /v1/files/{nodeId}/at?at=<ms>The version that was current at a moment
POST /v1/rollback/preview, /v1/rollbackRoll a folder or the drive back to a moment
GET /v1/trash, POST /v1/trash/{id}/restoreRecently Deleted

Safe to retry

Every operation carries an id you make (opId, a UUID). Send the same one again and it is applied once: the answer is the original change.

Errors

{ "error": { "code": "QUOTA_EXCEEDED", "message": "Not enough storage left…", "details": {} } }
CodeMeaning
401 UNAUTHORIZEDThe key is unknown or was turned off
403 KEY_READ_ONLYA read key tried to write
403 KEY_FORBIDDENA key may not use this route (a permanent delete, account settings)
403 READ_ONLYThe plan has ended; the drive can be read, not written
403 QUOTA_EXCEEDEDNot enough storage left
404 NOT_FOUNDNo such item, or a drive the key may not use
409 ALREADY_EXISTSThe id is already used
429 RATE_LIMITEDToo many requests; details.retryAfter says how many seconds to wait