API reference: the account service
Chapter 9 of 14 · Contents
The account service at https:/ signs people in by email, keeps companies, members, devices,
albums, shares and notifications, and passes the company key between devices without ever seeing it. This chapter lists
every route it serves: method, path, who may call it, the request body, the answer with a real example, and the errors.
Each route ends with a box generated from the code: its auth scheme, headers, every field with its type, every status code with the exact error messages, and the same call in curl, Python (standard library), Swift (URLSession) and C# (HttpClient). The whole API as one OpenAPI 3 file, for code generators and tools: openapi.yaml (generated from the service's code with every release of this manual).
Overview#
The account service is the one central server of Space Backup. Backups themselves never go through it: they travel
between your devices directly or through Space Relay. The service only knows who is who and what
each device may do. The apps (Windows, macOS, Linux, iPhone and iPad) use the JSON API described here; the web pages at
/account/ (the sign-in page, the admin page and the member's page) are served by the same service.
| Base URL | https:/ |
| JSON API | everything under https:/ |
| Web pages and forms | everything else under https:/ |
| Transport | HTTPS only (HTTP/1.1 or HTTP/2) |
| Request bodies | Content-, UTF-8 (the web forms: application/) |
| Answers | JSON with camelCase field names; 204 No Content has no body |
| Times | ISO 8601 in UTC with offset, for example "2026- |
| Body size | at most 1 MB per request (PUT /api/devices/state: 12 MB) |
In this chapter every path is written from /account: POST /api/signin/start means
POST https:/, and GET /admin means https:/.
Note: The apps let you point them at another account service for testing: the setting
account-url, or the environment variableSPACEBACKUP_ACCOUNT_URL. The paths stay the same.
Versioning and the X-SpaceBackup-Version header#
There is no version number in the paths. The API grows only by adding routes and fields: a client must ignore
fields it does not know, and a field that is absent or null means "not set". Fields marked optional below are
left out of the answer entirely when they have no value (they are not sent as null).
Every app sends its own version with each call:
X-SpaceBackup-Version: 1.8.2
The service does not refuse any version. It records the value (up to 40 characters) as the calling device's app version, which owners and admins see in the device lists (Devices). Send it on every call made with a device token; it is ignored on web-session calls.
A phone also sends its time zone, so the morning push comes at 08:00 its time:
X-SpaceBackup-TimeZone: America/Chicago
An IANA name, or a UTC offset (-05:00, +0530, or minutes, -300). The service keeps the latest one per device; a
value it cannot read is ignored. PUT devices/push takes the same as tz.
GET /api/health#
Whether the service is up: the apps' probe. It reads no database and calls nothing else, so it is cheap to call often.
- Auth: none.
- Response: 204, no body.
GET /api/health · from openapi.yaml (getHealth)
| Auth | none |
|---|---|
| 204 | No body |
curl
# answers 204
curl -sS -X GET 'https://spacebackup.net/account/api/health'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/health",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 204
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/health")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/health");
using var res = await http.SendAsync(req); // answers 204
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Ids#
Ids are a prefix plus 16 random lower-case base-32 characters (a–z, 2–7). Treat them as opaque strings.
| Prefix | What | Example |
|---|---|---|
c_ | company | c_k3xq7m2pa9fz4w8r |
m_ | member (one email's membership of one company) | m_7hd2kq9wz3xa5npe |
d_ | device registered in a company | d_4f2a7cqm3xk9wz2b |
gd_ | guest device (someone in no company) | gd_n5c7xq2m4ka9pz3w |
r_ | sign-in request | r_2mxq7k4a9fz3wn5c |
gr_ | group of people (plus the fixed id coworkers) | gr_q8w3zx5m2ka7np4c |
al_ | album | al_x7k2mq9pa4zw3n5c |
sh_ | share of a device's backups | sh_m3k9xq2a7pz4wn5c |
inv_ | album invitation | inv_c4n7zq2m9xa3kw5p |
k_ | company-key delivery (a sealed box in a device's mailbox) | k_a9zq3m7xk2pw4n5c |
kq_ | device waiting for the company key | kq_w2m7zx4qa9k3pn5c |
kr_ | company-key recovery request | kr_p4xq9m2ka7zw3n5c |
dr_ | data-key (restore) request | dr_z3k7xq2ma9pw4n5c |
p_ | relay credit purchase | p_q7m2xk9a4zw3pn5c |
pt_ + token | peer ticket | pt_Yk3… |
at_ + token | album ticket | at_Q9x… |
ar_ + token | album relay ticket | ar_M2c… |
Notification ids are plain increasing integers.
How each route is described#
Each route below has:
- Auth: who may call it.
- none: no credentials.
- signed in: any valid bearer token (a device token, or a guest's device token); the caller need not be in a company.
- active member: a bearer token whose email is an active member of a company (not
pending, not removed). - registered device: an active member's token that has a registered, not removed device in that company
(
POST /was called with this token).api/ devices/ register - owner/admin: the caller is the company's
owneror anadmin(and active). - web session + CSRF: the admin page's session cookie, together with the header
X-CSRF-Token(see Web sessions and CSRF). Only the few routes that say so accept it; all others need a bearer token.
- Request: the JSON body (or query string). Fields with
?are optional. - Response: the status and body, with an example.
- Errors: status → meaning. The body of every error is
{"error": "<plain sentence>"}, sometimes with extra fields (see Errors and limits). The general ones (401 not signed in, 400 for JSON that does not parse, 413 for a body over the limit) apply to every route and are not repeated.
Authentication#
The service has no passwords. A person proves they own an email address by a link or a 6-digit code mailed to it, and the device that asked gets a token. There are two kinds of session:
| Device token | Web session | |
|---|---|---|
| Who | an app on a computer, phone or tablet | a browser on the account pages |
| How it is sent | Authorization: Bearer <token> | the cookie sa_session |
| Lifetime | no expiry; revoked when the device or its member is removed | 12 hours since the last use |
| Used for | every /api/… route | the pages and their forms; five /api/… routes (with CSRF) |
Device tokens#
A device token is 32 random bytes, base64url (43 characters). The service keeps only its SHA-256 hash, so a copy of the service's database signs nobody in. Send it on every API call:
GET /account/api/me HTTP/1.1
Host: spacebackup.net
Authorization: Bearer Yk3Qm9xP2aZ7wC4nV8bT1rL6sD0fH5jK9eG3uI7oA2c
X-SpaceBackup-Version: 1.8.2
- A token belongs to an email, not to a company: the same token keeps working when that email joins, leaves or changes company. The caller's company and role are looked up at every call.
- After
POST /the token is also tied to that device. Calls that act "as this device" (key handover, data keys, device state, push token, album tickets) use that link.api/ devices/ register - The token stops working (401) when the device is removed, when its member is removed from the company, or when the same session is signed out. There is no refresh: sign in again.
- An unknown or revoked token answers 401
{"error": "not signed in (token unknown or revoked)"}; no header at all answers 401{"error": "not signed in"}.
Web sessions and CSRF#
The web pages sign in with the same email flow; the browser then holds these cookies (all HttpOnly, Secure,
SameSite=Lax, Path=/account):
| Cookie | What | Lifetime |
|---|---|---|
sa_session | the web session token | 12 hours idle |
sa_signin | a sign-in in progress: its request id and the browser's secret | 15 minutes |
sa_csrf | the CSRF token of this browser | session |
Every form on the pages carries a hidden field csrf with the value of sa_csrf (a "double submit": a foreign site can
neither read the cookie nor post with it). A missing or wrong csrf answers 403 ("This form has expired. Go back,
reload the page and try again.").
Five JSON routes accept the web session instead of a bearer token, so the admin page can call them from script. They
need the header X-CSRF-Token with the sa_csrf value; without it they answer 403
{"error": "missing CSRF token"}:
POST /api/ members/ {id}/ name GET /api/key-releaseandPOST /api/ key- release/ {id}/ approve POST /api/ key- recovery/ {id}/ cancel POST /api/assistant, in developer mode only (the admin page's Developers box)
The waiting page's POST /signin/poll uses the same header.
The passwordless sign-in flow#
- The app makes a random secret (for example 32 random bytes, base64) and keeps it in memory. It computes
secretHash= base64 of the SHA-256 of the UTF-8 bytes of the secret string exactly as it will send it later. POST /api/signin/startwith the email, a device name andsecretHash. The answer is arequestId, valid 15 minutes.- The service mails the person a link (
…/) and a **6-digit code** (subject "Space Backup sign-in code: 123456"). The mail says which device asked and when.account/ signin/ confirm?r= <requestId>& t= <link token> - Either:
- the person types the code into the app, which sends it with
POST /api/signin/code; or - the person clicks the link. The page asks "Sign in <device name>?" and has a button (a POST, so mail scanners that
open links do not use it up). Meanwhile the app calls
POST /api/signin/pollevery 2 seconds.
- the person types the code into the app, which sends it with
- Once the request is approved and the secret matches, the answer carries the token and the session. It is handed out once.
Only the holder of the secret gets the token, wherever the link was clicked: someone who forwards or intercepts the mail cannot sign in with it on another device. A right code also works after the link was confirmed.
# 1-2: start (bash, curl and openssl)
SECRET=$(openssl rand -base64 32)
HASH=$(printf %s "$SECRET" | openssl dgst -sha256 -binary | base64)
curl -s https://spacebackup.net/account/api/signin/start \
-H 'Content-Type: application/json' \
-d "{\"email\":\"anna@acme.com\",\"deviceName\":\"ANNA-PC\",\"secretHash\":\"$HASH\"}"
# {"requestId":"r_2mxq7k4a9fz3wn5c","expiresAt":"2026-10-18T09:27:00.481+00:00"}
# 4: the code from the mail
curl -s https://spacebackup.net/account/api/signin/code \
-H 'Content-Type: application/json' \
-d "{\"requestId\":\"r_2mxq7k4a9fz3wn5c\",\"secret\":\"$SECRET\",\"code\":\"481920\"}"
# {"status":"approved","token":"Yk3Qm9…","email":"anna@acme.com","memberId":null,"deviceId":null,"company":null}
After signing in, an app usually calls, in order: GET /api/me, POST /api/company/join (to land in a company),
POST / (to tie the token to this device), then GET /api/sync every 60 seconds. See
Sign in by email link and Join a company for
what the person sees.
Common objects#
These shapes come back from many routes. The route sections refer to them by name.
Session#
Who the caller is, and their company.
{
"email": "anna@acme.com",
"memberId": "m_7hd2kq9wz3xa5npe",
"deviceId": "d_4f2a7cqm3xk9wz2b",
"company": {
"id": "c_k3xq7m2pa9fz4w8r",
"name": "Acme",
"role": "owner",
"status": "active",
"keyVersion": 3,
"rotationNeeded": false,
"autoJoin": false,
"domain": "acme.com",
"faces": true
},
"name": "Anna Smith",
"firstName": "Anna",
"lastName": "Smith",
"languages": ["ru", "en"],
"born": {"born": "1996-05"},
"picture": "960d1ddd3dc6d59f"
}
| Field | Meaning |
|---|---|
email | the signed-in email, lower-case |
memberId | the membership id; null while the email belongs to no company |
deviceId | the device this token is tied to; null until POST / |
company | the Company below; null while the email belongs to no company |
name, firstName, lastName | the caller's display name in the company and its parts; "" when none (or in no company) |
languages (2026-11-05) | the caller's own languages, in their order, the first the apps' interface language (the apps use the first one they have words for, else the device's language); [] when none picked, or not an active member. Set with PUT /api/me/settings; the same list as GET /api/me/settings. Absent from an older service: [] |
born | optional, the caller's own birth as they gave it (PUT /api/me): {"born": "1996-05-14"} (or "1996-05", "1996"), or {"age": 30, "on": "2026- (an age on the day it was given). Absent when not given. Kept with the account (in a company or not) and private to the caller: no other session, member list or company view carries it |
picture | optional, the version of the caller's own picture (PUT /api/me/picture), also its ETag; absent when there is none. A new value: read GET /api/me/picture again |
created | optional, only in the answer of company/join when it made a new company: true |
keyMatched | optional, only from company/join: true when the sent keyProof is the company's current key proof |
moved | optional, only from company/join: {"from": "c_…"} when an invitation moved the caller out of a company of their own (that company was deleted) |
Company (inside a Session and in sync):
| Field | Meaning |
|---|---|
id, name | the company |
role | the caller's role: owner, admin or member |
status | the caller's status: active, or pending (waiting for an owner's or admin's approval) |
keyVersion | the company key's current version; 0 = no company key yet |
rotationNeeded | a device or member was removed: the next PC online that holds the key must make a new one |
autoJoin | anyone with an address at domain may join without an invitation |
domain | the company's mail domain (acme.com), or null (companies made from a personal address have none) |
faces | the company's PCs recognise faces in its photos (on its own computers, encrypted, never sent outside; docs/faces.md); true by default. New albums take it. Absent from an older service: true |
languages (2026-11-05) | the languages the company's PCs write keywords, descriptions and video moments in: the union of its active members' languages, English first, at most 5 (first picks before other picks, then by how many members read each, then in the codes' order); ["en","ru"] when no member picked any. Absent from an older service: ["en","ru"] |
An email belongs to at most one company at a time.
Member#
A row of the company's member list (owner/admin only).
{
"id": "m_9xk2qa7mz3wp4n5c",
"email": "bob@acme.com",
"name": "Bob Jones",
"firstName": "Bob",
"lastName": "Jones",
"role": "member",
"status": "active",
"invitedBy": "anna@acme.com",
"created": "2026-10-12T14:03:51.220+00:00",
"languages": ["de"]
}
status is active, invited (invited, not signed in yet) or pending (asked to join, waiting for approval); a
member answered by remove or deny shows removed. name, firstName, lastName are "" when not set.
invitedBy is null for someone who joined by themselves. languages (2026-11-05): the member's own languages
(me/settings), [] when none picked; the member sets them, an admin only reads them.
Person#
A colleague found by GET /api/people: `{"email": "bob@acme.com", "firstName": "Bob", "lastName": "Jones", "picture":
"960d1ddd3dc6d59f"}(names""when not set).picture`, optional: the version (ETag) of their own picture, read with
GET /api/people/picture; absent when they have none.
Group#
A private group of people to share with.
{"id": "gr_q8w3zx5m2ka7np4c", "name": "Design team", "members": ["bob@acme.com", "zoe@acme.com"], "hidden": false}
The automatic Coworkers group (only while the company has auto-join on) looks like this, with automatic:
{"id": "coworkers", "name": "Coworkers", "members": ["bob@acme.com", "zoe@acme.com"], "hidden": false, "automatic": "domain"}
Device#
A row of GET /api/devices.
{
"id": "d_4f2a7cqm3xk9wz2b",
"name": "ANNA-PC",
"email": "anna@acme.com",
"os": "Windows 11 Pro 23H2",
"version": "1.8.2",
"created": "2026-10-12T13:55:10.004+00:00",
"lastSeen": "2026-10-18T09:11:42.871+00:00",
"removed": false,
"keyVersion": 3,
"isMe": true,
"fingerprint": "3F2A-91C0",
"ownerName": "Anna Smith",
"label": "Anna's desk PC"
}
| Field | Meaning |
|---|---|
name | the machine name: also the device's top folder on the PCs that store its backups |
email | the device's member |
os, version | as the device registered them; version follows X-SpaceBackup-Version |
removed | true for a removed device (removed devices are listed last) |
keyVersion | the company-key version this device has acknowledged (0: none yet) |
isMe | this is the calling device |
fingerprint | the first 8 hex digits of the SHA-256 of the device's public key, as XXXX-XXXX |
ownerName | optional: the member's display name |
label | optional: the name its member gave it on their account page; only for showing, name does not change |
Album#
{
"id": "al_x7k2mq9pa4zw3n5c",
"name": "Las Vegas",
"ownerEmail": "anna@acme.com",
"mine": true,
"created": "2026-10-15T18:20:04.112+00:00",
"updated": "2026-10-17T21:02:45.930+00:00",
"itemCount": 42,
"destinations": [
{"device": "d_4f2a7cqm3xk9wz2b", "deviceName": "ANNA-PC", "dest": "e3b0c442", "label": "Backup disk"}
],
"members": [
{"email": "bob@acme.com", "since": "2026-10-15T18:25:00.000+00:00", "name": "Bob Jones", "canAdd": true, "shown": true},
{"email": "carol@example.org", "since": "2026-10-16T08:00:12.000+00:00", "name": "Carol White", "guest": true, "canAdd": false, "shown": false}
],
"ownerName": "Anna Smith",
"membersCanAdd": false,
"cover": null,
"faces": true,
"invited": [
{"email": "dave@example.net", "since": "2026-10-17T10:00:00.000+00:00", "state": "pending"},
{"email": "zoe@acme.com", "since": "2026-10-31T09:00:00.000+00:00", "state": "declined", "name": "Zoe Park",
"decided": "2026-10-31T09:30:00.000+00:00"}
],
"shown": true
}
| Field | Meaning |
|---|---|
mine | the caller owns it |
itemCount | the number of photos and videos, as last reported |
destinations | where the album's copies live: a destination (dest, its id on that PC) of a device of the company; label may be null |
members | the people it is shared with, by email. Listed to the owner and admins only; anyone else gets []. name is optional (their display name). guest: true (optional) marks someone outside the company who accepted an invitation; a guest's name is shown to the owner only. canAdd: this person may add their own photos and remove what they added: their own setting (shares/can-add), else the album's membersCanAdd; always false for a guest. shown: false when this person turned the album off (POST /api/albums/{id}/show); they are still a member |
ownerName | optional: the owner's display name |
membersCanAdd | the members may add their own photos and remove what they added. To a member of the album it is their own canAdd (so a phone or PC that knows nothing of per-person settings still does the right thing); to the owner and admins, the album-wide switch |
cover | the item id the owner chose as cover, or null (the newest item) |
faces | faces are recognised in the album's photos; set when the album is made from the company's faces, then the owner's switch (POST /api/albums/{id}). Absent from an older service: true |
invited | people invited who have not accepted (owner and admins only): someone outside the company, or a member of it who turned off autoAcceptCompany. state: pending (not answered; it does not expire) or declined (they may still accept it; decided when). name optional, for a member of the company only (an outsider's name shows once they accept) |
shown | true, unless the caller is a member or guest of the album who turned it off (show): then keep it out of Photos, Recent and Albums, don't push its adds and don't download or cache anything of it; offer Turn on where the app lists the albums shared with you. For the owner: false when they hid their own album (same call), for them alone |
archived | the owner's Archived albums (Albums › Archived; archive, or a merge): when it was archived. To the owner alone; absent otherwise. An archived album stays in every list and keeps working; apps list it under Archived instead of with the albums, and the TV hides it |
mergedFrom | a merged album (merge): the ids of the two albums it was made of (Undo unarchives them and deletes this one). To the owner alone; absent otherwise |
public | optional: true for a device's Shared publicly album (made with {"public": true}), absent otherwise |
publicDevice | optional, with public: the name of the device that owns it, the only one that may album.put into it itself (10-api-peer.md) |
filter | the album's standing filter: new photos that match go into it by themselves; null when it has none |
Album brief (in sync): id, name, ownerEmail, ownerName?, mine, itemCount, created, updated,
destinations, membersCanAdd (to a member, their own canAdd), cover, public?, publicDevice?, filter, shown, faces
(a PC neither shows nor caches an album turned off for that member); no members.
Album filter#
An album's standing filter (iOS request #57; Albums that fill themselves): after each vision pass over a device's new items, the PCs holding that device's backups add the items that pass it.
{"words": "Create an album about night Chicago views",
"content": "view",
"night": true,
"place": {"name": "Chicago", "lat": 41.88, "lon": -87.63, "radiusKm": 18.5},
"kind": "all",
"timeFrom": 1140, "timeTo": 1440,
"machines": ["Vlads-iPhone"],
"since": "2026-10-22T15:05:00Z",
"active": true}
| Field | Meaning |
|---|---|
words | the user's own words (for showing; up to 500 characters) |
content | what the pictures must show, as read from the words (up to 200); null: no judgement of what they show |
night | true: taken at night (the analysis says night, or the sun was more than 4° below the horizon there and then and the picture is dark); null: any time |
day | true: taken in daytime (iOS request #62): the analysis says day, else the sun was above the horizon there and then and the picture is bright; one the analysis calls night is never day. Not together with night (400 filter.); null: any time |
place | a circle: lat, lon, radiusKm (above 0, at most 20000), name for showing; null: anywhere |
kind | all, photos or videos |
timeFrom, timeTo | a time of day in minutes after the photo's own local midnight (0-1440), from up to to, wrapping past midnight when from > to; both null: any time |
machines | the devices whose new items are judged (default: the calling device). Only the album owner's own devices add anything |
since | items first backed up from then on (default: now) |
active | false: paused (kept, nothing added) |
Share#
A device's backups shared with one person.
{
"id": "sh_m3k9xq2a7pz4wn5c",
"sourceDevice": "d_4f2a7cqm3xk9wz2b",
"sourceName": "ANNA-PC",
"ownerEmail": "anna@acme.com",
"recipientEmail": "bob@acme.com",
"sharedBy": "anna@acme.com",
"since": "2026-10-13T09:12:00.000+00:00",
"scope": "device"
}
scope is always device today (the whole device's backups).
Notification#
{
"id": 1842,
"time": "2026-10-18T08:40:11.500+00:00",
"kind": "album-added",
"title": "Las Vegas",
"body": "Bob Jones added 12 photos and videos",
"target": {"type": "album", "id": "al_x7k2mq9pa4zw3n5c"},
"read": false,
"quiet": false
}
kind is one of album-added, shared, key-waiting, device-joined, restore-approval, relay-credit,
invitation-accepted, remove-request (see Notifications & push). target (what a click opens)
is null or {type, id} with type one of album, device, share, invitation, key-release,
datakey-request (a restore request, for admins: the admin page), approval (a restore request for a device of yours:
Approvals, GET /api/me/approvals), relay (id: the company id), member, album-item (id:
<album id>|<item id>). quiet: the
person had this kind turned off when it came, so it was kept but not pushed or popped up. title and body are plain
words, ready to show.
Notification list: {"notifications": [Notification, …], "unread": 3, "latest": 1842}; latest is the newest id
in the inbox (0 when empty).
Error#
{"error": "only the company's owner or an admin may do this"}
Some errors add fields: attemptsLeft (a wrong sign-in code), keyVersion (the company's current key version, on key
conflicts), code (a machine-readable reason: invite_needed, name_invalid, name_taken, name_clash).
Sign-in#
The three calls of the sign-in flow. They need no token.
POST /api/signin/start#
Starts a sign-in and mails the link and the code.
- Auth: none.
- Request:
Field Type Rules emailstring a valid address (trimmed, lower-cased; at most 254 characters) deviceName?string shown in the mail and on the confirm page ("Sign in ANNA-PC?"); at most 100 characters; default "a device" secretHashstring base64 of a 32-byte SHA-256 of the secret {"email": "anna@acme.com", "deviceName": "ANNA-PC", "secretHash": "q1nN0w0yQm1pCk7n6Wl1fW6m4dH0Yk3x8bT1rL6sD0E="} - Response: 200
{"requestId": "r_2mxq7k4a9fz3wn5c", "expiresAt": "2026-10-18T09:27:00.481+00:00"} - Errors:
- 400 →
not a valid email address,secretHash must be base64 of a SHA-,256 deviceName is too long. - 429 →
too many sign-(per email: 5 per 15 minutes and 20 per day; per client IP: 30 per hour).in requests; try again later - 503 →
could not send the sign-(the request is dropped; start again).in mail; try again later
- 400 →
POST /api/signin/start · from openapi.yaml (postSigninStart)
| Auth | none |
|---|---|
| Body | application/json SignInStartRequestemail string|null · a valid address (trimmed, lower-cased; at most 254 characters)deviceName string|null · shown in the mail and on the confirm page ("Sign in ANNA-PC?"); at most 100 characters; default "a device"secretHash string|null · base64 of a 32-byte SHA-256 of the secret |
| 200 | OK → SignInStarted {requestId: string, expiresAt: string(date-time)} |
| 400 | not a valid email address, secretHash must be base64 of a SHA-256, deviceName is too long. -secretHash must be base64 of a SHA-256not a valid email address<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 429 | too many sign-in requests; try again later (per email: 5 per 15 minutes and 20 per day; per client IP: 30 per hour). -too many sign-in requests; try again later |
| 503 | could not send the sign-in mail; try again later (the request is dropped; start again)could not send the sign-in mail; try again later |
curl
# answers 200; errors 400, 429, 503
curl -sS -X POST 'https://spacebackup.net/account/api/signin/start' \
-H "Content-Type: application/json" \
--data '{"email":"anna@acme.com","deviceName":"ANNA-PC","secretHash":"q1nN0w0yQm1pCk7n6Wl1fW6m4dH0Yk3x8bT1rL6sD0E="}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/signin/start",
method="POST",
data=json.dumps({"email": "anna@acme.com", "deviceName": "ANNA-PC", "secretHash": "q1nN0w0yQm1pCk7n6Wl1fW6m4dH0Yk3x8bT1rL6sD0E="}).encode(),
headers={"Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 429, 503
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/signin/start")!)
req.httpMethod = "POST"
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"email":"anna@acme.com","deviceName":"ANNA-PC","secretHash":"q1nN0w0yQm1pCk7n6Wl1fW6m4dH0Yk3x8bT1rL6sD0E="}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 429, 503
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/signin/start");
req.Content = new StringContent("""{"email":"anna@acme.com","deviceName":"ANNA-PC","secretHash":"q1nN0w0yQm1pCk7n6Wl1fW6m4dH0Yk3x8bT1rL6sD0E="}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 429, 503
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/signin/code#
Redeems the 6-digit code from the mail.
- Auth: none (the
secretis the proof). - Request:
{"requestId": "r_. The code is trimmed.…", "secret": "<the secret>", "code": "481920"} - Response: 200, approved:
{ "status": "approved", "token": "Yk3Qm9xP2aZ7wC4nV8bT1rL6sD0fH5jK9eG3uI7oA2c", "email": "anna@acme.com", "memberId": "m_7hd2kq9wz3xa5npe", "deviceId": null, "company": {"id": "c_k3xq7m2pa9fz4w8r", "name": "Acme", "role": "owner", "status": "active", "keyVersion": 3, "rotationNeeded": false, "autoJoin": false, "domain": "acme.com"} }tokenis the new device token.memberIdandcompanyarenullwhile the email belongs to no company; the Session name fields are not included here (callGET /api/me). - Errors:
- 400 →
wrong code, with"attemptsLeft": 3. The 5th wrong code kills the request. - 404 →
no such sign-in request: an unknownrequestIdor a wrongsecret(the two cannot be told apart). - 410 →
this sign-,in was already used this sign-(after 15 minutes),in has expired; start again too many wrong codes; start again.
- 400 →
POST /api/signin/code · from openapi.yaml (postSigninCode)
| Auth | none |
|---|---|
| Body | application/json SignInCodeRequestrequestId string|nullsecret string|nullcode string|null |
| 200 | Approved: `token` is the new device token. `memberId` and `company` are `null` while the email belongs to no company |
| 400 | wrong code, with "attemptsLeft": 3. The 5th wrong code kills the request. -wrong code<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 404 | no such sign-in request: an unknown requestId **or a wrong secret** (the two cannot be told apart). -no such sign-in request |
| 410 | this sign-in was already used, this sign-in has expired; start again (after 15 minutes), too many wrong codes; start againthis sign-in was already usedthis sign-in has expired; start againtoo many wrong codes; start again |
curl
# answers 200; errors 400, 404, 410
curl -sS -X POST 'https://spacebackup.net/account/api/signin/code' \
-H "Content-Type: application/json" \
--data '{"requestId":"r_…","secret":"<the secret>","code":"481920"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/signin/code",
method="POST",
data=json.dumps({"requestId": "r_…", "secret": "<the secret>", "code": "481920"}).encode(),
headers={"Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 404, 410
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/signin/code")!)
req.httpMethod = "POST"
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"requestId":"r_…","secret":"<the secret>","code":"481920"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 404, 410
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/signin/code");
req.Content = new StringContent("""{"requestId":"r_…","secret":"<the secret>","code":"481920"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 404, 410
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/signin/poll#
Asks whether the mailed link was confirmed. Call it every 2 seconds while the person may click the link.
- Auth: none.
- Request:
{"requestId": "r_…", "secret": "<the secret>"} - Response: 200, either
{"status": "pending"}or the same approved answer asPOST /api/signin/code. - Errors: 404 →
no such sign-in request(an unknownrequestIdor a wrongsecret). 410 →this sign-,in was already used this sign-,in has expired; start again too many wrong codes; start again. Stop polling on either and start again.
POST /api/signin/poll · from openapi.yaml (postSigninPoll)
| Auth | none |
|---|---|
| Body | application/json SignInPollRequestrequestId string|nullsecret string|null |
| 200 | Either {...} or the same approved answer as `POST /api/signin/code` |
| 400 | Bad Requestwrong code<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 404 | no such sign-in request (an unknown requestId or a wrong secret)no such sign-in request |
| 410 | this sign-in was already used, this sign-in has expired; start again, too many wrong codes; start again. Stop polling on either and start againthis sign-in was already usedthis sign-in has expired; start againtoo many wrong codes; start again |
curl
# answers 200; errors 400, 404, 410
curl -sS -X POST 'https://spacebackup.net/account/api/signin/poll' \
-H "Content-Type: application/json" \
--data '{"requestId":"r_…","secret":"<the secret>"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/signin/poll",
method="POST",
data=json.dumps({"requestId": "r_…", "secret": "<the secret>"}).encode(),
headers={"Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 404, 410
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/signin/poll")!)
req.httpMethod = "POST"
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"requestId":"r_…","secret":"<the secret>"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 404, 410
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/signin/poll");
req.Content = new StringContent("""{"requestId":"r_…","secret":"<the secret>"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 404, 410
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Session & company#
GET /api/me#
The caller's Session.
- Auth: signed in (any token, in a company or not).
- Response: 200 Session.
GET /api/me · from openapi.yaml (getMe)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | Session → SessionView {email: string, memberId: string|null, deviceId: string|null, company: CompanyView|null, name: string, firstName: string, lastName: string, languages: string[], born?: BirthView|null, picture?: string|null, created?: boolean|null, keyMatched?: boolean|null, moved?: MovedFrom|null} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
curl
# answers 200; errors 401
curl -sS -X GET 'https://spacebackup.net/account/api/me' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/me",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/me")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/me");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");PUT /api/me#
Sets or clears the caller's own first and last name in their company, and/or their own birth (requests #121). The name is shown only inside the company (and to the owners of albums the caller accepted as a guest). The birth is the caller's alone: only their own Session reads it back (the apps' assistant uses it for "my photos when I was 30"); nobody in the company sees it.
- Auth: active member for the name; signed in (in a company or not) for a birth alone.
- Request: all fields optional; a request with neither
bornnoragesets the name as before, one with them leaves the name alone unless it names it too.- Name: either
{"firstName": "Anna", "lastName": "Smith"}(one left out counts as""), or{"name": "Anna Smith"}, split at its first space into first and last name. Both empty clears the name. Each part is trimmed, at most 40 characters (an emoji counts as one), no control characters or line/paragraph separators. A last name needs a first name; a first name alone is fine. - Birth:
{"born": "1996-05-14"},{"born": "1996-05"}or{"born": "1996"}(a real date, from 1900 to today), or{"age": 30, "on": "2026-: a whole age 0–130 on the day it was given (11- 04"} YYYY-MM-DD, not in the future; left out: today, UTC). One replaces the other.{"born": null}(or{"age": null}) clears it; left out, it is kept. "Today" runs a day ahead of UTC, for time zones east of it. - Nothing is written when any part is refused.
- Name: either
- Response: 200 Session (with the new
name,firstName,lastName,born). - Errors: 400 →
first name is too long (at most 40 characters),last name must not contain control characters,first name is required with a last name,born must be "YYYY", "YYYY-,MM" or "YYYY- MM- DD" born is not a real date,born is before 1900,born is in the future,age must be a whole number from 0 to 130,on must be a date, "YYYY-,MM- DD" on is in the future,age and on put the birth before 1900,give born or age, not both,on goes with age. 403 →not an active member of a company(a name). - Pushes: a changed birth sends
settingsto the caller's other devices (Changed pushes).
PUT /api/me · from openapi.yaml (putMe)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json MeRequestname string|nullfirstName string|nulllastName string|nullborn anyage anyon string|null |
| 200 | Session (with the new `name`, `firstName`, `lastName`, `born`) → SessionView {email: string, memberId: string|null, deviceId: string|null, company: CompanyView|null, name: string, firstName: string, lastName: string, languages: string[], born?: BirthView|null, picture?: string|null, created?: boolean|null, keyMatched?: boolean|null, moved?: MovedFrom|null} |
| 400 | first name is too long (at most 40 characters), last name must not contain control characters, first name is required with a last name, born must be "YYYY", "YYYY-MM" or "YYYY-MM-DD", born is not a real date, born is before 1900, born is in the future, age must be a whole number from 0 to 130, on must be a date, "YYYY-MM-DD", on is in the future, age and on put the birth before 1900, give born or age, not both, on goes with ageon goes with agefirst name is required with a last namegive born or age, not bothborn must be "YYYY", "YYYY-MM" or "YYYY-MM-DD"born is not a real dateborn is before 1900born is in the futureage must be a whole number from 0 to 130on must be a date, "YYYY-MM-DD"on is in the futureage and on put the birth before 1900bad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | not an active member of a company (a name)not an active member of a company |
curl
# answers 200; errors 400, 401, 403
curl -sS -X PUT 'https://spacebackup.net/account/api/me' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"firstName":"Anna","lastName":"Smith"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/me",
method="PUT",
data=json.dumps({"firstName": "Anna", "lastName": "Smith"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/me")!)
req.httpMethod = "PUT"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"firstName":"Anna","lastName":"Smith"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Put, "https://spacebackup.net/account/api/me");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"firstName":"Anna","lastName":"Smith"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");PUT /api/me/picture#
Sets the caller's own picture (requests #125), shown to them and to their colleagues (the active members of their company) next to their name. Kept with the account by email, like the birth, so it stays through a company change; only the current company's active members read it.
- Auth: signed in (any token, in a company or not).
- Request: the image itself as the body, not JSON:
Content-Type: image/jpegorimage/png, at most 512 KB (524288 bytes), and the bytes must be that kind of image (a JPEG startsFF D8 FF, a PNG with its 8-byte signature). The apps send a small square picture (512 × 512 px, JPEG, is plenty). The same picture again changes nothing. - Response: 200 Session (with the new
pictureversion). - Errors: 400 →
the picture is empty,the body is not a JPEG image,the body is not a PNG image. 413 →the picture is larger than 512 KB. 415 →the picture must be image/.jpeg or image/ png - Pushes:
picturesto every device of every active member of the caller's company (in no company: the caller's other devices), the device that set it left out (Changed pushes).curl -X PUT -H "Authorization: Bearer $TOKEN" -H "Content-Type: image/jpeg" \ --data-binary @me.jpg https://spacebackup.net/account/api/me/picture
PUT /api/me/picture · from openapi.yaml (putMePicture)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | Session (with the new `picture` version) → SessionView {email: string, memberId: string|null, deviceId: string|null, company: CompanyView|null, name: string, firstName: string, lastName: string, languages: string[], born?: BirthView|null, picture?: string|null, created?: boolean|null, keyMatched?: boolean|null, moved?: MovedFrom|null} |
| 400 | the picture is empty, the body is not a JPEG image, the body is not a PNG imagethe picture is empty |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 413 | the picture is larger than 512 KBthe picture is larger than <maxPicture> KB |
| 415 | the picture must be image/jpeg or image/pngthe picture must be image/jpeg or image/png |
curl
# answers 200; errors 400, 401, 413, 415
curl -sS -X PUT 'https://spacebackup.net/account/api/me/picture' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/me/picture",
method="PUT",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 413, 415
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/me/picture")!)
req.httpMethod = "PUT"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 413, 415
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Put, "https://spacebackup.net/account/api/me/picture");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 413, 415
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");DELETE /api/me/picture#
Removes the caller's own picture (none already: the same answer).
- Auth: signed in (any token, in a company or not).
- Response: 200 Session (no
picture). - Pushes: as
PUT /api/me/picture, when there was one.
DELETE /api/me/picture · from openapi.yaml (deleteMePicture)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | Session (no `picture`) → SessionView {email: string, memberId: string|null, deviceId: string|null, company: CompanyView|null, name: string, firstName: string, lastName: string, languages: string[], born?: BirthView|null, picture?: string|null, created?: boolean|null, keyMatched?: boolean|null, moved?: MovedFrom|null} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
curl
# answers 200; errors 401
curl -sS -X DELETE 'https://spacebackup.net/account/api/me/picture' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/me/picture",
method="DELETE",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/me/picture")!)
req.httpMethod = "DELETE"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Delete, "https://spacebackup.net/account/api/me/picture");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/me/picture#
The caller's own picture: the image bytes with their Content-Type (image/jpeg or image/png).
- Auth: signed in (any token, in a company or not).
- Response: 200 the image, with
ETag: "<picture version>"andCache-. 304 when the request'sControl: private, no- cache If-None-Matchis that ETag. - Errors: 404 →
no picture.
GET /api/me/picture · from openapi.yaml (getMePicture)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 400 | Bad Requestnot a valid email address |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
| 404 | no pictureno picture |
curl
# answers ; errors 400, 401, 403, 404
curl -sS -X GET 'https://spacebackup.net/account/api/me/picture' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/me/picture",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/me/picture")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/me/picture");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers ; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/company/join#
Puts the signed-in email into a company: finds the right one, or makes a new one. Call it after every sign-in.
- Auth: signed in.
- Request: all optional.
Field Type Meaning keyProof?string the proof of a company key this device already holds (a PC upgrading from before accounts) create?bool true: "Create my own company" when no company matchesname?string the new company's name (1–100 characters); default: the email's domain, or "<email>'s company" for a personal address
- What it does, first match wins:
- The email is already a member of a company (active or pending) → that company. Exception: when the person was
invited to another company and their current company is disposable (they are its only member, it never had a
company key, and it holds no relay credit or payment), they are moved: they become an active member of the
inviting company, their devices move there (each needs that company's key handed over), the old company is deleted,
and the answer carries
"moved": {"from": "c_…"}. keyProofmatches a company's current key proof → active member of it.- An invitation for the email → active member of the inviting company.
- A company with auto-join on for the email's domain → active member.
- A company with that domain but auto-join off, and
createnottrue→pendingmember; its owner and admins get a mail with an Approve link (Mailed approval links). - A personal mail domain (gmail.com, outlook.com and the like) with
createnottrue→ 409 (below). Personal addresses join by invitation only. - Otherwise a new company with the caller as its
owner. It claims the email's domain when the domain is not personal and no other company has it.
An email that was removed from a company and comes back by key proof or auto-join is
pendingthere. - The email is already a member of a company (active or pending) → that company. Exception: when the person was
invited to another company and their current company is disposable (they are its only member, it never had a
company key, and it holds no relay credit or payment), they are moved: they become an active member of the
inviting company, their devices move there (each needs that company's key handed over), the old company is deleted,
and the answer carries
- Response: 200 Session, plus
"created": truefor a new company, and"keyMatched": truewhenkeyProofis the current key proof of the caller's company after the join (the registered device is then recorded as holding the current key version).{"email": "bob@acme.com", "memberId": "m_9xk2qa7mz3wp4n5c", "deviceId": null, "company": {"id": "c_k3xq7m2pa9fz4w8r", "name": "Acme", "role": "member", "status": "pending", "keyVersion": 3, "rotationNeeded": false, "autoJoin": false, "domain": "acme.com"}, "name": "", "firstName": "", "lastName": ""} - Errors:
- 400 →
name is too long,name must not contain control characters. - 409 →
{"error": "Ask your company's admin to invite anna@gmail.: show Check again and Create my own company (which sendscom, or create your own company. ", "code": "invite_ needed"} create: true). - 409 →
device name ANNA-(a move, when a moving device's name is taken in the new company; nothing changed).PC is already used in Acme: rename this device, then join again
- 400 →
POST /api/company/join · from openapi.yaml (postCompanyJoin)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json JoinRequestkeyProof string|null · the proof of a company key this device already holds (a PC upgrading from before accounts)create boolean|null · `true`: "Create my own company" when no company matchesname string|null · the new company's name (1–100 characters); default: the email's domain, or "<email>'s company" for a personal address |
| 200 | Session, plus `"created": true` for a new company, and `"keyMatched": true` when `keyProof` is the current key proof of the caller's company after the join (the registered device is then recorded as holding the current key version) → SessionView {email: string, memberId: string|null, deviceId: string|null, company: CompanyView|null, name: string, firstName: string, lastName: string, languages: string[], born?: BirthView|null, picture?: string|null, created?: boolean|null, keyMatched?: boolean|null, moved?: MovedFrom|null} |
| 400 | name is too long, name must not contain control characters. -<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 409 | {"error": "Ask your company's admin to invite anna@gmail.com, or create your own company.", "code": "invite_needed"}: show **Check again** and **Create my own company** (which sends create: true). -Ask your company's admin to invite <email>, or create your own company.device name <name> is already used in <name>: rename this device, then join again |
curl
# answers 200; errors 400, 401, 409
curl -sS -X POST 'https://spacebackup.net/account/api/company/join' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"keyProof":"MCowBQYDK2VwAyEA8Jx…","create":true,"name":"Anna Smith"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/company/join",
method="POST",
data=json.dumps({"keyProof": "MCowBQYDK2VwAyEA8Jx…", "create": True, "name": "Anna Smith"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/company/join")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"keyProof":"MCowBQYDK2VwAyEA8Jx…","create":true,"name":"Anna Smith"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/company/join");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"keyProof":"MCowBQYDK2VwAyEA8Jx…","create":true,"name":"Anna Smith"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/company/settings#
Changes the company's name, auto-join and recognising faces, as the admin page's settings form does (Renaming the company).
- Auth: owner/admin.
- Request:
{"name"?: "Acme Inc.. A field left out (or", "autoJoin"?: true, "faces"?: false} null) keeps its value;{}changes nothing.name: trimmed, 1–100 characters, no control characters.autoJoin: trueneeds a company domain.faces: the company's PCs recognise faces in its photos (albums made afterwards take it; existing albums keep theirs). - Response: 200 Session with the updated company.
- Errors: 400 →
name is required,name is too long,name must not contain control characters,auto-. 403 →join needs a company domain; this company has none only the company's owner or an admin may do this.
POST /api/company/settings · from openapi.yaml (postCompanySettings)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json CompanySettingsRequestname string|nullautoJoin boolean|nullfaces boolean|null |
| 200 | Session with the updated company → SessionView {email: string, memberId: string|null, deviceId: string|null, company: CompanyView|null, name: string, firstName: string, lastName: string, languages: string[], born?: BirthView|null, picture?: string|null, created?: boolean|null, keyMatched?: boolean|null, moved?: MovedFrom|null} |
| 400 | name is required, name is too long, name must not contain control characters, auto-join needs a company domain; this company has noneauto-join needs a company domain; this company has none<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the company's owner or an admin may do thisonly the company's owner or an admin may do this |
curl
# answers 200; errors 400, 401, 403
curl -sS -X POST 'https://spacebackup.net/account/api/company/settings' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"name":"Acme Inc.","autoJoin":true,"faces":false}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/company/settings",
method="POST",
data=json.dumps({"name": "Acme Inc.", "autoJoin": True, "faces": False}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/company/settings")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"name":"Acme Inc.","autoJoin":true,"faces":false}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/company/settings");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"name":"Acme Inc.","autoJoin":true,"faces":false}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Members & people#
The admin page's member list, for the apps (account members, account invite in the CLI). See
Members and Roles for what each action means.
GET /api/members#
- Auth: owner/admin.
- Response: 200
[Member](Member): active, invited and pending members; pending first, then the owner, admins, members, each by email. - Errors: 403 →
only the company's owner or an admin may do this.
GET /api/members · from openapi.yaml (getMembers)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | `[Member]` (Member): active, invited and pending members → array of MemberView {id: string, email: string, name: string, firstName: string, lastName: string, role: string, status: string, invitedBy: string|null, created: string(date-time), languages: string[]} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the company's owner or an admin may do thisonly the company's owner or an admin may do this |
curl
# answers 200; errors 401, 403
curl -sS -X GET 'https://spacebackup.net/account/api/members' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/members",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/members")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/members");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/members/invite#
Invites an address (a personal one too) and mails the invitation. The person joins when they sign in with exactly that
address and the app calls company/join.
- Auth: owner/admin.
- Request:
{"email": "bob@acme.;com", "role"?: "member"} roleismember(default) oradmin. - Response: 200 the new Member row (
status: "invited"; a pending person invited this way becomesactiveat once). - Errors: 400 →
not a valid email address,role must be admin or member. 404 →no such member(only when the new row was removed again before the answer was read back). 409 →bob@acme.,com is already a member bob@acme.(a company of their own that nothing depends on does not count).com belongs to another company
POST /api/members/invite · from openapi.yaml (postMembersInvite)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json MemberInviteRequestemail string|nullrole string|null |
| 200 | The new Member row (`status: "invited"` → MemberView {id: string, email: string, name: string, firstName: string, lastName: string, role: string, status: string, invitedBy: string|null, created: string(date-time), languages: string[]} |
| 400 | not a valid email address, role must be admin or memberrole must be admin or membernot a valid email addressbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddenonly the company's owner or an admin may do this |
| 404 | no such member (only when the new row was removed again before the answer was read back)no such member |
| 409 | bob@acme.com is already a member, bob@acme.com belongs to another company (a company of their own that nothing depends on does not count)<e> is already a member<e> belongs to another company |
curl
# answers 200; errors 400, 401, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/api/members/invite' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"email":"bob@acme.com","role":"member"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/members/invite",
method="POST",
data=json.dumps({"email": "bob@acme.com", "role": "member"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/members/invite")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"email":"bob@acme.com","role":"member"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/members/invite");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"email":"bob@acme.com","role":"member"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/members/{id}/role#
- Auth: owner/admin.
- Request:
{"role": "admin"}(adminormember). - Response: 200 the member's row after the change.
- Errors: 400 →
role must be admin or member. 404 →no such member. 409 →the owner's role cannot be changed.
POST /api/members/{id}/role · from openapi.yaml (postMembersIdRole)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json MemberRoleRequestrole string|null |
| 200 | The member's row after the change → MemberView {id: string, email: string, name: string, firstName: string, lastName: string, role: string, status: string, invitedBy: string|null, created: string(date-time), languages: string[]} |
| 400 | role must be admin or memberrole must be admin or memberbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddenonly the company's owner or an admin may do this |
| 404 | no such memberno such member |
| 409 | the owner's role cannot be changedthe owner's role cannot be changed |
curl
# answers 200; errors 400, 401, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/role' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"role":"admin"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/role",
method="POST",
data=json.dumps({"role": "admin"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/role")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"role":"admin"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/role");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"role":"admin"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/members/{id}/approve#
Lets a pending person in. They get a "You joined Acme" mail.
- Auth: owner/admin.
- Request: no body.
- Response: 200 the member's row (
status: "active"). - Errors: 404 →
no such member. 409 →bob@acme.,com is active, not waiting for approval bob@acme..com belongs to another company now
POST /api/members/{id}/approve · from openapi.yaml (postMembersIdApprove)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | The member's row (`status: "active"`) → MemberView {id: string, email: string, name: string, firstName: string, lastName: string, role: string, status: string, invitedBy: string|null, created: string(date-time), languages: string[]} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddenonly the company's owner or an admin may do this |
| 404 | no such memberno such member |
| 409 | bob@acme.com is active, not waiting for approval, bob@acme.com belongs to another company now<email> is <status>, not waiting for approval<email> belongs to another company now |
curl
# answers 200; errors 401, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/approve' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/approve",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/approve")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/approve");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/members/{id}/deny#
- Auth: owner/admin.
- Request: no body.
- Response: 200 the member's row (
status: "removed"). - Errors: 404 →
no such member. 409 →bob@acme.(any status butcom is active, not waiting for approval pending),bob@acme..com belongs to another company now
POST /api/members/{id}/deny · from openapi.yaml (postMembersIdDeny)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | The member's row (`status: "removed"`) → MemberView {id: string, email: string, name: string, firstName: string, lastName: string, role: string, status: string, invitedBy: string|null, created: string(date-time), languages: string[]} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddenonly the company's owner or an admin may do this |
| 404 | no such memberno such member |
| 409 | bob@acme.com is active, not waiting for approval (any status but pending), bob@acme.com belongs to another company now<email> is <status>, not waiting for approval<email> belongs to another company now |
curl
# answers 200; errors 401, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/deny' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/deny",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/deny")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/deny");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/members/{id}/remove#
Removes a member: their sessions are revoked, their devices removed, their shares ended, their phones' saved state
deleted, and the company key must be replaced (rotationNeeded). The owner and admins get a mail.
- Auth: owner/admin.
- Request: no body.
- Response: 200 the member's row (
status: "removed"). Removing someone already removed changes nothing. - Errors: 404 →
no such member. 409 →the owner cannot be removed.
POST /api/members/{id}/remove · from openapi.yaml (postMembersIdRemove)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | The member's row (`status: "removed"`) → MemberView {id: string, email: string, name: string, firstName: string, lastName: string, role: string, status: string, invitedBy: string|null, created: string(date-time), languages: string[]} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddenonly the company's owner or an admin may do this |
| 404 | no such memberno such member |
| 409 | the owner cannot be removedthe owner cannot be removed |
curl
# answers 200; errors 401, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/remove' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/remove",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/remove")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/remove");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/members/{id}/name#
Sets or clears any member's first and last name (the owner's too). Whoever wrote last wins.
- Auth: owner/admin, by bearer token or web session + CSRF.
- Request: as
PUT /api/me:{"firstName", "lastName"}or{"name"}. - Response: 200
{"name": "Bob Jones", "firstName": "Bob", "lastName": "Jones"}(all""after clearing). - Errors: 400 as for
PUT /api/me. 403 → a plain member (they usePUT /api/me). 404 →no such member(also a removed one).
POST /api/members/{id}/name · from openapi.yaml (postMembersIdName)
| Auth | Authorization: Bearer <device token>, or the admin page's web session (cookie sa_session) plus X-CSRF-Token |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json MemberNameRequestname string|nullfirstName string|nulllastName string|null |
| 200 | (all `""` after clearing) |
| 400 | Bad Requestfirst name is required with a last name<what> is too long (at most 40 characters)<what> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | a plain member (they use PUT /api/me)only the company's owner or an admin may do thismissing CSRF token |
| 404 | no such member (also a removed one)no such member |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/name' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"name":"Anna Smith","firstName":"ANNA-PC","lastName":"ANNA-PC"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/name",
method="POST",
data=json.dumps({"name": "Anna Smith", "firstName": "ANNA-PC", "lastName": "ANNA-PC"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/name")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"name":"Anna Smith","firstName":"ANNA-PC","lastName":"ANNA-PC"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/members/m_7hd2kq9wz3xa5npe/name");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"name":"Anna Smith","firstName":"ANNA-PC","lastName":"ANNA-PC"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/people#
Finds colleagues to share with, by name or email.
- Auth: active member.
- Query:
q=<words>: the active members of the caller's company (never the caller) whose email, or any word of their first or last name, starts with any word ofq. Name words are split at spaces, hyphens and apostrophes; matching ignores case and accents ("zoe" finds Zoë, "luc" finds Jean-Luc). The email matches from its start only ("acme" does not find everyone at acme.com). At most 50. A blankqanswers[].all=1(orall=true): every active member but the caller, at most 500;qis ignored.
- Response: 200
[Person](Person), by first name, last name, email (people without a name last).[{"email": "zoe@acme.com", "firstName": "Zoë", "lastName": "Martin"}, {"email": "zack@acme.com", "firstName": "", "lastName": ""}] - Errors: 400 →
q is too long (at most 200 characters). 403 → not an active member. 429 →too many searches; try again in a minute(60 a minute per member, both forms together).
GET /api/people · from openapi.yaml (getPeople)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| query | q string|null (optional) |
| query | all string|null (optional) |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | `[Person]` (Person), by first name, last name, email (people without a name last) → array of PersonView {email: string, firstName: string, lastName: string, picture?: string|null} |
| 400 | q is too long (at most 200 characters)q is too long (at most 200 characters) |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | not an active membernot an active member of a company |
| 429 | too many searches; try again in a minute (60 a minute per member, both forms together)too many searches; try again in a minute |
curl
# answers 200; errors 400, 401, 403, 429
curl -sS -X GET 'https://spacebackup.net/account/api/people?q=anna&all=1' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/people?q=anna&all=1",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 429
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/people?q=anna&all=1")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 429
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/people?q=anna&all=1");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 429
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/people/picture#
A colleague's own picture (requests #125), as they set it with PUT /api/me/picture.
- Auth: active member (the caller's own email: signed in).
- Query:
email=<address>(any case): an active member of the caller's company, or the caller. - Response: 200 the image bytes with their
Content-Type(image/jpegorimage/png), `ETag: "<picture version>"(thepictureof their [Person](#obj-Cache-Control: private, no-cache`. 304 when the request'sperson)) and If-None-Matchis that ETag. Keep it by the version; read it again whenGET /api/peopleshows another one or apicturespush comes. - Errors: 400 →
email is required,not a valid email address. 403 → not an active member. 404 →no picture: they have none, or are not an active member of the caller's company (the same answer, so it tells nothing about other companies).
GET /api/people/picture · from openapi.yaml (getPeoplePicture)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| query | email string|null (optional) |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 400 | email is required, not a valid email addressemail is requirednot a valid email address |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | not an active membernot an active member of a company |
| 404 | no picture: they have none, or are not an active member of the caller's company (the same answer, so it tells nothing about other companies)no picture |
curl
# answers ; errors 400, 401, 403, 404
curl -sS -X GET 'https://spacebackup.net/account/api/people/picture?email=1' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/people/picture?email=1",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/people/picture?email=1")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/people/picture?email=1");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers ; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Groups#
A person's own groups of people to share with (the phone's Groups tab). Groups are private: nobody else, admins included, sees or changes them. Members of a group may be any email addresses, not only colleagues.
While the company has auto-join on, everyone in it also has the automatic Coworkers group (id coworkers): all
active members at the company's domain, the caller left out, computed at every read. It can be hidden, nothing else.
GET /api/groups#
- Auth: active member.
- Response: 200
[Group](Group): Coworkers first (when there is one), then the caller's groups by name.
GET /api/groups · from openapi.yaml (getGroups)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | `[Group]` (Group): Coworkers first (when there is one), then the caller's groups by name → array of GroupView {id: string, name: string, members: string[], hidden: boolean, automatic?: string|null} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
curl
# answers 200; errors 401, 403
curl -sS -X GET 'https://spacebackup.net/account/api/groups' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/groups",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/groups")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/groups");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/groups#
- Auth: active member.
- Request:
{"name": "Design team", "members"?: ["bob@acme..com", "zoe@acme. com"], "hidden"?: false} name: trimmed, 1–40 characters, no control characters.members: valid addresses, lower-cased, each once, at most 500. - Response: 201 Group.
- Errors: 400 →
name is required,name is too long (at most 40 characters),name must not contain control characters,not a valid email address,too many members (at most 500). 409 →too many groups (at most 200).
POST /api/groups · from openapi.yaml (postGroups)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json GroupRequestname string|nullmembers string[]hidden boolean|null |
| 201 | Group → GroupView {id: string, name: string, members: string[], hidden: boolean, automatic?: string|null} |
| 400 | name is required, name is too long (at most 40 characters), name must not contain control characters, not a valid email address, too many members (at most 500)name is requiredname is too long (at most 40 characters)name must not contain control characterstoo many members (at most 500)bad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
| 409 | too many groups (at most 200)too many groups (at most 200) |
curl
# answers 201; errors 400, 401, 403, 409
curl -sS -X POST 'https://spacebackup.net/account/api/groups' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"name":"Design team","members":["bob@acme.com","zoe@acme.com"],"hidden":false}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/groups",
method="POST",
data=json.dumps({"name": "Design team", "members": ["bob@acme.com", "zoe@acme.com"], "hidden": False}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 201; errors 400, 401, 403, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/groups")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"name":"Design team","members":["bob@acme.com","zoe@acme.com"],"hidden":false}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 201; errors 400, 401, 403, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/groups");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"name":"Design team","members":["bob@acme.com","zoe@acme.com"],"hidden":false}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 201; errors 400, 401, 403, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");PUT /api/groups/{id}#
- Auth: active member (the group's owner).
- Request:
{"name"?, "members"?, "hidden"?}; a field left out keeps its value;membersreplaces the whole list. Forcoworkersonlyhiddenmay change (sending the same name and members is no change). - Response: 200 Group.
- Errors: 400 as for
POST. 403 →the service keeps Coworkers; you can only hide it. 404 →no such group(not the caller's, orcoworkerswhile auto-join is off).
PUT /api/groups/{id} · from openapi.yaml (putGroupsId)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json GroupRequestname string|nullmembers string[]hidden boolean|null |
| 200 | Group → GroupView {id: string, name: string, members: string[], hidden: boolean, automatic?: string|null} |
| 400 | Bad Requestname is requiredname is too long (at most 40 characters)name must not contain control characterstoo many members (at most 500)bad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | the service keeps Coworkers; you can only hide itthe service keeps Coworkers; you can only hide itnot an active member of a company |
| 404 | no such group (not the caller's, or coworkers while auto-join is off)no such group |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X PUT 'https://spacebackup.net/account/api/groups/gr_q8w3zx5m2ka7np4c' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"name":"Family","members":["anna@acme.com"],"hidden":true}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/groups/gr_q8w3zx5m2ka7np4c",
method="PUT",
data=json.dumps({"name": "Family", "members": ["anna@acme.com"], "hidden": True}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/groups/gr_q8w3zx5m2ka7np4c")!)
req.httpMethod = "PUT"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"name":"Family","members":["anna@acme.com"],"hidden":true}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Put, "https://spacebackup.net/account/api/groups/gr_q8w3zx5m2ka7np4c");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"name":"Family","members":["anna@acme.com"],"hidden":true}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");DELETE /api/groups/{id}#
- Auth: active member (the group's owner).
- Response: 204.
- Errors: 403 →
the service keeps Coworkers; you can hide it instead. 404 →no such group.
DELETE /api/groups/{id} · from openapi.yaml (deleteGroupsId)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | No Content |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | the service keeps Coworkers; you can hide it insteadthe service keeps Coworkers; you can hide it insteadnot an active member of a company |
| 404 | no such groupno such group |
curl
# answers 204; errors 401, 403, 404
curl -sS -X DELETE 'https://spacebackup.net/account/api/groups/gr_q8w3zx5m2ka7np4c' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/groups/gr_q8w3zx5m2ka7np4c",
method="DELETE",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/groups/gr_q8w3zx5m2ka7np4c")!)
req.httpMethod = "DELETE"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Delete, "https://spacebackup.net/account/api/groups/gr_q8w3zx5m2ka7np4c");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Face names#
The name picker of face recognition (docs/faces.md#names): when someone names a person in the People view, "Who is
this?" or Rename, the apps suggest the company's members, the people in the caller's groups and every name given
before in the company. The names given are kept here for the company, under the face data's rules: the company's
active members only (their devices and the web, never a TV, a guest or an app's token), nothing while the company's
Recognize faces is off (kept, shown again when it is on), erased by faces delete-all. The PC that writes a name into
a member's book records it (POST); a phone asks a PC (faces.name) and never records it itself.
GET /api/faces/names#
- Auth: active member (a device or the web).
- Query:
q(optional): only the rows whose name contains it, or whose email starts with it (case and accents ignored).limit: 1–500, default 50.groups=0: without the caller's groups (a PC answering for a phone). - Response: 200
{"on": true, "names": [FaceName]};on: falseand no name while the company's Recognize faces is off. One row per name: the names given before (source: "name"), the most used first, then the most recent; then the company's active members ("member", the caller too) and the people of the caller's groups ("group", Coworkers too,groupits name; a person who is no member is shown by email), by name. A member or group person whose email a name given before is linked to, or whose display name (or email) it is, is that one row (its email filled in). A person's other names (aka, below) are each a row of their own right after the person's name, with itsemail,usesandlast; every row of a person with other names carriesalso: the person's other names (on the name: itsaka; on an aka: the name, then the other akas), so the picker can show "Mo · Marina Galentovsky". An aka that is also a name given on its own stays that row (and takes the person's names asalsowhen it has none); an aka of two people is the first's row.{"on": true, "names": [ {"name": "Marina", "source": "name", "email": "marina@acme.com", "member": true, "uses": 214, "last": 1793462400123}, {"name": "Ivan", "source": "name", "uses": 3, "last": 1793001200000, "also": ["Vanya"]}, {"name": "Vanya", "source": "name", "uses": 3, "last": 1793001200000, "also": ["Ivan"]}, {"name": "Bob Jones", "source": "member", "email": "bob@acme.com", "member": true, "uses": 0}, {"name": "zoe@elsewhere.org", "source": "group", "email": "zoe@elsewhere.org", "group": "Family", "uses": 0}]} - Errors: 400 →
q is too long (at most 200 characters). 403 → not an active member, oronly the company's members' devices see the faces' names. 429 →too many requests; try again in a minute(120 a minute per member, reads and records together).
GET /api/faces/names · from openapi.yaml (getFacesNames)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| query | q string|null (optional) |
| query | limit integer|null (optional) |
| query | groups string|null (optional) |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | OK → FaceNamesView {on: boolean, names: FaceNameView[]} |
| 400 | q is too long (at most 200 characters)q is too long (at most 200 characters) |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | not an active member, or only the company's members' devices see the faces' namesonly the company's members' devices see the faces' namesnot an active member of a company |
| 429 | too many requests; try again in a minute (120 a minute per member, reads and records together)too many requests; try again in a minute |
curl
# answers 200; errors 400, 401, 403, 429
curl -sS -X GET 'https://spacebackup.net/account/api/faces/names?q=anna&limit=50&groups=1' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/faces/names?q=anna&limit=50&groups=1",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 429
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/faces/names?q=anna&limit=50&groups=1")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 429
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/faces/names?q=anna&limit=50&groups=1");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 429
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/faces/names#
A name was given (a group named, a person renamed or split off, a face named): added to the company's names, or used
once more (uses + 1, last now, the newest spelling kept; the same name ignoring case and accents is one row).
- Auth: active member (a device or the web).
- Request:
{"name": "Marina", "email"?: "marina@acme..com", "aka"?: ["Mo", "marina@example. com"]} name: trimmed, inner spaces one, 1–60 characters, no control characters; or an email (a person known only by their address), up to 254 characters, kept lower case.email: the member the person is linked to (an active member of the company);""removes the link; left out, the link stays.aka: the person's other names, in their order, each asname(1–60 characters or an email), at most 10, none the name itself or another of them (case and accents ignored); left out, they stay as they were; a list replaces them;[]removes them. The PCs send the person's whole list with each name. - Response: 200 FaceName (
source: "name",alsoitsaka). - Errors: 400 →
name is required,name is too long (at most 60 characters, or an email),name must not contain control characters,aka: at most 10 other names,aka: Mo is already one of this person's names, the sameaka: …asname's,not a valid email address,email: not a member of this company. 403 → not an active member. 409 →Recognize faces is off for this company. 429 →too many requests; try again in a minute.
POST /api/faces/names · from openapi.yaml (postFacesNames)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json FaceNameRequestname string|nullemail string|nullaka string[] |
| 200 | FaceName (`source: "name"`, `also` its `aka`) → FaceNameView {name: string, source: string, email?: string|null, member?: boolean, group?: string|null, uses: integer(int64), last?: integer(int64)|null, also?: string[]} |
| 400 | name is required, name is too long (at most 60 characters, or an email), name must not contain control characters, aka: at most 10 other names, aka: Mo is already one of this person's names, the same aka: … as name's, not a valid email address, email: not a member of this companyemail: not a member of this company<field> is required<field> is too long (at most 60 characters, or an email)<field> must not contain control charactersnot a valid email addressaka: at most 10 other namesaka: <v> is already one of this person's namesbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | not an active memberonly the company's members' devices see the faces' namesnot an active member of a company |
| 409 | Recognize faces is off for this companyRecognize faces is off for this company |
| 429 | too many requests; try again in a minutetoo many requests; try again in a minute |
curl
# answers 200; errors 400, 401, 403, 409, 429
curl -sS -X POST 'https://spacebackup.net/account/api/faces/names' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"name":"Marina","email":"marina@acme.com","aka":["Mo","marina@example.com"]}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/faces/names",
method="POST",
data=json.dumps({"name": "Marina", "email": "marina@acme.com", "aka": ["Mo", "marina@example.com"]}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 409, 429
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/faces/names")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"name":"Marina","email":"marina@acme.com","aka":["Mo","marina@example.com"]}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 409, 429
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/faces/names");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"name":"Marina","email":"marina@acme.com","aka":["Mo","marina@example.com"]}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 409, 429
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");DELETE /api/faces/names#
- Auth: active member (a device or the web); without
name: the company's owner or an admin. - Query:
name: a name no person of the company has any more (its last person deleted); it leaves the list (case and accents ignored) with its other names, and leaves every other name'saka; also answered when it was not there. Withoutname: every name of the company (faces delete-all). - Response: 204.
- Errors: 400 →
name is too long (at most 60 characters, or an email). 403 → not an active member;only the company's owner or an admin may do this(every name).
DELETE /api/faces/names · from openapi.yaml (deleteFacesNames)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| query | name string|null (optional) |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | No Content |
| 400 | name is too long (at most 60 characters, or an email)<field> is required<field> is too long (at most 60 characters, or an email)<field> must not contain control charactersnot a valid email address |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | not an active member; only the company's owner or an admin may do this (every name)only the company's members' devices see the faces' namesnot an active member of a companyonly the company's owner or an admin may do this |
curl
# answers 204; errors 400, 401, 403
curl -sS -X DELETE 'https://spacebackup.net/account/api/faces/names' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/faces/names",
method="DELETE",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/faces/names")!)
req.httpMethod = "DELETE"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Delete, "https://spacebackup.net/account/api/faces/names");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Work marks#
The user's work mark (Vladimir, 2026-11-08; docs/albums.md,
"The user's work mark"): any photo or video can be marked work or not work by a member; the mark replaces Space
Vision's work label for that item for good (a later analysis never changes it), on every device of every member. One
mark per item of the company: source is the backups' device name the item comes from (the month index's machine, an
album item's source), id its id there; the same photo in an album and in its device's backups is one item. Every
changed mark takes the company's next version v (one counter per company), so a device asks only for what is new.
The company's PCs fold the marks into their month index and albums; a TV marks through its PC. Erased with the company.
POST /api/work/marks#
- Auth: an active member, from a device of theirs (phone, tablet, PC) or the web; never a guest, a TV's or an app's token.
- Request:
{"marks": [{"source": "Vlads-: 1 to 500 marks.iPhone", "id": "77ab…", "work": false}, …]} sourceandid: 1–200 characters, no control characters;work:true(work) orfalse(not work), a JSON boolean. There is no "back to the model": the last choice stays. The same item twice in one request: the last one counts. - Response: 200
{"ok": true, "v": 1234, "changed": 1}:vthe company's version after the request,changedthe marks that changed (a mark equal to the stored one changes nothing and is not counted). - Pushes: when
changed > 0,workto every device of every active member of the company, the marking device too (Changed pushes). - Errors: 400 →
marks is required,marks is empty (1 to 500 marks),too many marks (at most 500 a request),marks[0].,source is required marks[0].,id is too long (at most 200 characters) marks[0].,source must not contain control characters marks[0].. 403 → not an active member, orwork must be true or false only the company's members' devices and the web mark work(a TV's token: `a TV's token is for the TV routes only). 429 →too many marks (at most 2000 a minute); try again in a minute` (2,000 marks a minute per member, counted as sent; a refused request keeps nothing).
POST /api/work/marks · from openapi.yaml (postWorkMarks)
| Auth | Authorization: Bearer <device token>, or the admin page's web session (cookie sa_session) plus X-CSRF-Token |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json WorkMarksRequestmarks WorkMarkIn|null[] |
| 200 | `v` the company's version after the request, `changed` the marks that changed (a mark equal to the stored one changes nothing and is not counted) → WorkMarksPosted {ok: boolean, v: integer(int64), changed: integer} |
| 400 | marks is required, marks is empty (1 to 500 marks), too many marks (at most 500 a request), marks[0].source is required, marks[0].id is too long (at most 200 characters), marks[0].source must not contain control characters, marks[0].work must be true or falsemarks is requiredmarks is empty (1 to 500 marks)too many marks (at most 500 a request)marks[<i>] is not a markmarks[<i>].work must be true or falsemarks[<i>].<name> is requiredmarks[<i>].<name> is too long (at most 200 characters)marks[<i>].<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | not an active member, or only the company's members' devices and the web mark work (a TV's token: a TV's token is for the TV routes only)only the owner of a photo or video changes its work label: <source>'s items are not yoursonly the company's members' devices and the web mark worknot an active member of a companymissing CSRF token |
| 429 | too many marks (at most 2000 a minute); try again in a minute (2,000 marks a minute per member, counted as sent; a refused request keeps nothing)too many marks (at most 2000 a minute); try again in a minute |
curl
# answers 200; errors 400, 401, 403, 429
curl -sS -X POST 'https://spacebackup.net/account/api/work/marks' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"marks":[{"source":null,"id":null,"work":"…"}]}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/work/marks",
method="POST",
data=json.dumps({"marks": [{"source": None, "id": None, "work": "…"}]}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 429
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/work/marks")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"marks":[{"source":null,"id":null,"work":"…"}]}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 429
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/work/marks");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"marks":[{"source":null,"id":null,"work":"…"}]}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 429
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/work/marks#
- Auth: as POST.
- Query:
since(optional): only the marks withvgreater than it (0 or absent: all).limit: 1–5,000, default 5,000. - Response: 200 the company's marks, oldest first:
{"v": 1234, "marks": [ {"source": "Vlads-iPhone", "id": "77ab…", "work": false, "by": "vlad@acme.com", "at": 1794000000123, "v": 1233}, {"source": "Anna-PC", "id": "c1d2…", "work": true, "at": 1794000000456, "v": 1234}], "more": false}v: the company's version now; per markat(Unix ms) and its ownv;by(the member who marked it) only to the company's owners and admins.more: true: there are more; ask again withsincethe last mark'sv. A device that gets theworkpush asks with thevit holds. - Errors: 403 as POST.
GET /api/work/marks · from openapi.yaml (getWorkMarks)
| Auth | Authorization: Bearer <device token>, or the admin page's web session (cookie sa_session) plus X-CSRF-Token |
|---|---|
| query | since integer(int64)|null (optional) |
| query | limit integer|null (optional) |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | The company's marks, oldest first: `v`: the company's version now → WorkMarksView {v: integer(int64), marks: WorkMarkView[], more: boolean} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddenonly the company's members' devices and the web mark worknot an active member of a companymissing CSRF token |
curl
# answers 200; errors 401, 403
curl -sS -X GET 'https://spacebackup.net/account/api/work/marks?since=1&limit=50' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/work/marks?since=1&limit=50",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/work/marks?since=1&limit=50")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/work/marks?since=1&limit=50");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Devices#
POST /api/devices/register#
Ties the calling token to a device and records its public key. Call it after company/join, and again whenever the
device's name, OS, app version or key changes.
- Auth: signed in, with a company (active or pending).
- Request:
Field Type Rules namestring the machine name (below) os?string free text, at most 100 characters ("Windows 11 Pro 23H2", "iOS 26.0") version?string the app version, at most 40 characters publicKeystring the device's P-256 public key, base64 SubjectPublicKeyInfo {"name": "ANNA-PC", "os": "Windows 11 Pro 23H2", "version": "1.8.2", "publicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…"}nameis also the device's top folder on the PCs that store its backups, so it must be a machine name: 1–64 ASCII letters, digits,-,_,., starting with a letter or digit, not ending in., no.., not a Windows reserved name (CON, NUL, COM1…), and notAlbums. No other active device of the company may use it (ignoring case); a removed device's name is free. See Choose a computer name. - Response: 200
{"deviceId": "d_. Calling it again with the same token updates the device. A new session of the same email registering the same public key gets the same device id back. The company's owner and admins get a "New device ANNA-PC (anna@acme.com) joined Acme" mail and a4f2a7cqm3xk9wz2b"} device-joinednotification for a new device. A rename also moves the device's saved device state to the new name. - Errors:
- 400 →
{"error": "name must be a machine name: …", "code": "name_,invalid"} {"error": "Albums is a reserved name (the albums' folder on the hosts); choose another name", "code": "name_,invalid"} publicKey must be a base64 P-.256 SubjectPublicKeyInfo - 409 →
join a company first (company/;join) {"error": "device name ANNA-.PC is already used in this company", "code": "name_ taken"}
- 400 →
POST /api/devices/register · from openapi.yaml (postDevicesRegister)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json RegisterRequestname string|null · the machine name (below)os string|null · free text, at most 100 characters ("Windows 11 Pro 23H2", "iOS 26.0")version string|null · the app version, at most 40 characterspublicKey string|null · the device's P-256 public key, base64 SubjectPublicKeyInfo |
| 200 | OK → DeviceRegistered {deviceId: string} |
| 400 | {"error": "name must be a machine name: …", "code": "name_invalid"}, {"error": "Albums is a reserved name (the albums' folder on the hosts); choose another name", "code": "name_invalid"}, publicKey must be a base64 P-256 SubjectPublicKeyInfo. -name must be a machine name: 1-64 ASCII letters, digits, '-', '_' or '.', starting with a letter or digit, not ending in '.', no '..', not a Windows reserved name (CON, NUL, COM1...)Albums is a reserved name (the albums' folder on the hosts); choose another namepublicKey must be a base64 P-256 SubjectPublicKeyInfo<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 409 | join a company first (company/join); {"error": "device name ANNA-PC is already used in this company", "code": "name_taken"}join a company first (company/join)device name <name> is already used in this companydevice name <name> is an iCloud Photos library's in this company |
curl
# answers 200; errors 400, 401, 409
curl -sS -X POST 'https://spacebackup.net/account/api/devices/register' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"name":"ANNA-PC","os":"Windows 11 Pro 23H2","version":"1.8.2","publicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/register",
method="POST",
data=json.dumps({"name": "ANNA-PC", "os": "Windows 11 Pro 23H2", "version": "1.8.2", "publicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/register")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"name":"ANNA-PC","os":"Windows 11 Pro 23H2","version":"1.8.2","publicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/devices/register");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"name":"ANNA-PC","os":"Windows 11 Pro 23H2","version":"1.8.2","publicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/devices#
All devices of the caller's company, removed ones too.
- Auth: active member.
- Response: 200
[Device](Device), active ones first, by email and name.
GET /api/devices · from openapi.yaml (getDevices)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | `[Device]` (Device), active ones first, by email and name → array of DeviceView {id: string, name: string, email: string, os: string, version: string, created: string(date-time), lastSeen: string(date-time), removed: boolean, keyVersion: integer, isMe: boolean, fingerprint: string, ownerName?: string|null, label?: string|null, kind?: string|null, host?: string|null} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
curl
# answers 200; errors 401, 403
curl -sS -X GET 'https://spacebackup.net/account/api/devices' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/devices");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/devices/key#
The public key of a device of the company, by its name. PCs use it to check another PC's signed replication grants (Replication).
- Auth: registered device.
- Query:
name=<device name>(any case). - Response: 200
{"deviceId": "d_8wq3zx2mka7p4n5c", "name": "OFFICE-NAS", "publicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…", "signingKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…"}signingKeyis optional: present when the device registered a separate signing key (below); check grants with it when present, else withpublicKey. - Errors: 400 →
name is required. 404 →no active device of that name in this company,codeno_device. 410 →device <n> was removed from this company,coderemoved(only removed devices have that name; a removed member's devices are removed too), or `device <n>'s member is not an active member of this company: its key is revoked,coderevoked. 404 and 410 with acode` are the definite "no": a PC that kept the device's key (a Space Vision worker's, a day) drops it and refuses; a 401/403 or a 404 without acodeis not that answer (try again).
GET /api/devices/key · from openapi.yaml (getDevicesKey)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| query | name string|null (optional) |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | `signingKey` is *optional*: present when the device registered a separate signing key (below) → DeviceKeyView {deviceId: string, name: string, publicKey: string, signingKey?: string|null} |
| 400 | name is required<name> is required<name> is too long<name> must not contain control characters |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
| 404 | no active device of that name in this company, code no_deviceno active device of that name in this company |
| 410 | device <n> was removed from this company, code removed (only removed devices have that name; a removed member's devices are removed too), or device <n>'s member is not an active member of this company: its key is revoked, code revoked. 404 and 410 with a code are the definite "no": a PC that kept the device's key (a Space Vision worker's, a day) drops it and refuses; a 401/403 or a 404 without a code is not that answer (try again)device <n> was removed from this companydevice <name>'s member is not an active member of this company: its key is revoked |
curl
# answers 200; errors 400, 401, 403, 404, 410
curl -sS -X GET 'https://spacebackup.net/account/api/devices/key?name=ANNA-PC' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/key?name=ANNA-PC",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404, 410
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/key?name=ANNA-PC")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404, 410
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/devices/key?name=ANNA-PC");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404, 410
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/devices/icloud#
The calling PC backs up its member's iCloud Photos library (the folder iCloud for Windows keeps). The library is then
listed by GET /api/devices as a device of the member with "kind": "icloud", "host": this PC's device id, "os":
"icloud". Its name is a machine name, its folder on the drives (laid out like a phone's), in the peer protocol, the
Photos tab and Space Vision: <First>-iCloud-Photos, from the first word of the member's display name (else the part of
their email before the @) without what a machine name refuses (iCloud-Photos when nothing is left), with -2, -3...
when a device or another iCloud source of the company (removed ones too) has it; given once and kept. Its label is what
the apps show: <member>'s iCloud Photos. A device cannot register under a live source's name (409).
- Auth: registered device of an active member.
- Response: 200
{"id": "ic_. The same PC and member get the same source again.8wq3zx2mka7p4n5c", "name": "Anna- iCloud- Photos", "label": "Anna's iCloud Photos", "email": "anna@acme. com", "host": "d_ …"}
POST /api/devices/icloud · from openapi.yaml (postDevicesIcloud)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | OK → ICloudSourceView {id: string, name: string, email: string, host: string, label?: string|null} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
curl
# answers 200; errors 401, 403
curl -sS -X POST 'https://spacebackup.net/account/api/devices/icloud' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/icloud",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/icloud")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/devices/icloud");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/devices/icloud/{id}/remove#
Stops an iCloud Photos source; it stays listed with "removed": true, and its backups stay on the drives. Its key
leaves the member's sync.shared (see PUT /api/datakey).
- Auth: its member, the PC that hosts it, or an owner/admin.
- Response: 204.
- Errors: 403 →
only its member, its PC or an admin can remove an iCloud source. 404 →no such iCloud source.
POST /api/devices/icloud/{id}/remove · from openapi.yaml (postDevicesIcloudIdRemove)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | No Content |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only its member, its PC or an admin can remove an iCloud sourceonly its member, its PC or an admin can remove an iCloud sourcenot an active member of a company |
| 404 | no such iCloud sourceno such iCloud source |
curl
# answers 204; errors 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/devices/icloud/x_k3xq7m2pa9fz4w8r/remove' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/icloud/x_k3xq7m2pa9fz4w8r/remove",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/icloud/x_k3xq7m2pa9fz4w8r/remove")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/devices/icloud/x_k3xq7m2pa9fz4w8r/remove");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/devices/{id}/label#
Gives a device a friendly name for showing ("Bob's laptop"). The machine name does not change.
- Auth: active member: the device's own member, or an owner/admin.
- Request:
{"label": "Anna's desk PC"}; at most 64 characters, no control characters;""ornullclears it. - Response: 200
{"label": "Anna's desk PC"}. - Errors: 400 →
the name is too long (at most 64 characters),the name must not contain control characters. 404 →no such device(removed, another company's, or another member's for a plain member).
POST /api/devices/{id}/label · from openapi.yaml (postDevicesIdLabel)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json DeviceLabelRequestlabel string|null |
| 200 | OK |
| 400 | the name is too long (at most 64 characters), the name must not contain control charactersthe name is too long (at most 64 characters)the name must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
| 404 | no such device (removed, another company's, or another member's for a plain member)no such device |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/label' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"label":"Anna'\''s desk PC"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/label",
method="POST",
data=json.dumps({"label": "Anna's desk PC"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/label")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"label":"Anna's desk PC"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/label");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"label":"Anna's desk PC"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/devices/{id}/signing-key#
Registers the key a device signs its replication grants with, for a device whose registered key cannot sign (an iPhone's Secure Enclave key-agreement key). Calling it again replaces the key; removing the device clears it.
- Auth: only that device's own device token (
{id}must be the caller's device). Another device, even of the same member or an admin, gets 403; a web session gets 401. - Request:
{"publicKey": "<base64 P-(the field may also be called256 SubjectPublicKeyInfo>"} signingKey). - Response: 204.
- Errors: 400 →
publicKey must be a base64 P-. 403 → `only the device itself sets its signing key256 SubjectPublicKeyInfo ,this device is not registered (devices/register)`.
POST /api/devices/{id}/signing-key · from openapi.yaml (postDevicesIdSigningKey)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json SigningKeyRequestpublicKey string|nullsigningKey string|null |
| 204 | No Content |
| 400 | publicKey must be a base64 P-256 SubjectPublicKeyInfopublicKey must be a base64 P-256 SubjectPublicKeyInfo<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the device itself sets its signing key, this device is not registered (devices/register)only the device itself sets its signing keynot an active member of a companythis device is not registered (devices/register) |
curl
# answers 204; errors 400, 401, 403
curl -sS -X POST 'https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/signing-key' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"publicKey":"<base64 P-256 SubjectPublicKeyInfo>"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/signing-key",
method="POST",
data=json.dumps({"publicKey": "<base64 P-256 SubjectPublicKeyInfo>"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/signing-key")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"publicKey":"<base64 P-256 SubjectPublicKeyInfo>"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/signing-key");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"publicKey":"<base64 P-256 SubjectPublicKeyInfo>"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/devices/{id}/remove#
Removes a device: it is signed out, its waiting key deliveries are dropped, its shares end, and the company key is
replaced by the next PC online (rotationNeeded, once the company has a key). The owner and admins get a mail.
- Auth: active member: an owner/admin, the device itself, or another device of the device's member.
- Request: no body.
- Response: 204 (also when it was removed already).
- Errors: 403 →
only the company's owner or an admin (or the device's member) may remove a device. 404 →no such device.
POST /api/devices/{id}/remove · from openapi.yaml (postDevicesIdRemove)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | (also when it was removed already) |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the company's owner or an admin (or the device's member) may remove a deviceonly the company's owner or an admin (or the device's member) may remove a devicenot an active member of a company |
| 404 | no such deviceno such device |
curl
# answers 204; errors 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/remove' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/remove",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/remove")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/remove");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Company key & handover#
Each company has one company key: it encrypts the channel between the company's PCs and protects the recovery of
data keys (The company key). The service never holds it in clear. It moves between
devices only sealed to the receiving device's public key, as a keyring: JSON
{"current": 3, "keys": {"1": "K7MXP- with every version, so older recovery copies stay usable.
A device that has the current version hands it to devices that lack it; the service only carries the sealed boxes.
GET /api/sync#
The app's heartbeat: call it right after sign-in and then every 60 seconds. It records the device's last-seen time and app version, and returns everything the device must act on.
- Auth: signed in (fields are empty or
nullwhile there is no company or no registered device). - Response: 200
{ "company": {"id": "c_k3xq7m2pa9fz4w8r", "name": "Acme", "role": "owner", "status": "active", "keyVersion": 3, "rotationNeeded": false, "autoJoin": false, "domain": "acme.com"}, "device": {"id": "d_4f2a7cqm3xk9wz2b", "removed": false, "keyVersion": 3}, "deliveries": [], "handovers": [ {"deviceId": "d_9pz4wn5cm3k9xq2a", "name": "Annas-MacBook", "email": "anna@acme.com", "publicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…"} ], "keyRecovery": null, "datakeyRequests": [], "dataKeyRotation": false, "keyRelease": null, "keyReleaseRequests": [], "shared": [ {"shareId": "sh_q2a7pz4wn5cm3k9x", "sourceDeviceId": "d_7pz4wn5cq2am3k9x", "sourceName": "BOB-PC", "ownerEmail": "bob@acme.com", "since": "2026-10-13T09:12:00.000+00:00", "keys": [{"keyId": "dk-5c2e…", "keyVersion": 3, "wrapped": "AAECAwQF…", "current": true}]} ], "notifications": {"latest": 1842, "unread": 2}, "albums": [ {"id": "al_x7k2mq9pa4zw3n5c", "name": "Las Vegas", "ownerEmail": "anna@acme.com", "mine": true, "itemCount": 42, "updated": "2026-10-17T21:02:45.930+00:00", "destinations": [{"device": "d_4f2a7cqm3xk9wz2b", "deviceName": "ANNA-PC", "dest": "e3b0c442", "label": "Backup disk"}], "ownerName": "Anna Smith", "created": "2026-10-15T18:20:04.112+00:00", "membersCanAdd": false, "cover": null} ], "deletedAlbums": [] }Field Meaning companyas in the Session; nullin no companydevicethis device: removed, and the key version it acknowledged;nullbeforedevices/registerdeliveriessealed keyrings waiting for this device (versions above the one it acknowledged): [{"id", "version", "fromDevice", "fromName", "fromEmail", "sealed"}].fromDeviceis the sending device's id, or"service"for a copy the service released from the recovery copy (thenfromNameandfromEmailarenull)handoversdevices this device should hand the key to: active devices of active members whose acknowledged version is below the company's. Only listed to a device that has the current version itself, and not again while a box of the current version waits for them keyRecoverythis device's newest company-key recovery request {"id", "state", "releaseAt"}, ornulldatakeyRequeststhis device's restore requests: [{"id", "sourceDeviceId", "sourceName", "state"}]dataKeyRotationthis device must make a new data key (a share of its backups ended after its key was handed out) keyReleasethis device's own wait for the company key, or nullkeyReleaseRequestsowner/admin devices: other devices waiting for an approval, as in GET /api/key-releasesharedthe backups shared with this device's member, with the source's wrapped data keys (current and former; keyVersion= the company-key version it is wrapped with). Also, with no approval, the member's own iCloud Photos sources whose PC put their data key (PUT /api/datakey withdevice):shareIdandsourceDeviceId= the source's id (ic_…),sourceNameits (machine) name,ownerEmailthe member,"sourceKind": "icloud"(absent on a share); only to the member's own devices (never another member's, nor the PC hosting it), gone once the source is removed, never rotated. Unwrapped as any share's keysnotificationsthe inbox's newest id and unread count albumsthe member's albums and those shared with them (Album brief, see Album) deletedAlbumsthe member's recently deleted albums, as in GET /api/albums/deleted: Album briefs with deletedAt,deletedBy,purgeAt;[]when none. A PC with an album in its deleted area that is in neither list (deleted permanently while it was off) removes itmatchKeyoptional: the member's matching key (iOS request #68), 32 random bytes made by the member's device that won the claim and sealed by a device of the member to this device's key (purpose member-match-key), base64; absent until one was handed to this device. Devices HMAC-SHA256 their match keys with it so a phone's list for the iCloud source names no photo. The service stores only the sealed boxes, never the keymatchKeyNeededno device of the member holds a matching key yet (none was handed over and no device's claim is live): POST /api/matchkey/claim; the one device answered 204 makes 32 random bytesmatchKeyHandoversfor a device that holds the matching key (or may make it now): the member's other devices, and PCs hosting the member's iCloud Photos, still without one, [{"deviceId", "name", "email", "publicKey"}], shaped likehandovers; seal it to each andPOST /. Empty for a device that neither holds it nor may make itapi/ matchkey/ deliver memberMatchKeysa PC hosting another member's iCloud Photos: [{"email", "sealed"}], that member's matching key sealed to this devicecommandsrequests for this PC still waiting, [{"id", "kind", "requestedBy", "requested"}](kindbackup-now: a remote agent'sbackup_now); run each once and answer it withPOST /. Empty for a phone, an older request (over an hour) or one already answeredapi/ devices/ commands/ {id} shared,keyRelease,keyReleaseRequests,albumsanddataKeyRotationare only filled for a registered, not removed device of an active member. A device drops the shared keys of a share no longer listed.
What a device does with it:
deliveriesnot empty → open the newest box with the device's private key, keep the keyring, thenPOST /api/key/ackwith its version.handoversnot empty (and this device has the current key) → seal the keyring to each listedpublicKeyandPOST /api/key/deliver.company.rotationNeededand this device has the current key → make a new key,POST /api/company/keywith version + 1; the others get it as handovers.dataKeyRotation→ make a new data key andPUT /api/datakey.matchKeyNeededand no matching key kept →POST /api/matchkey/claim; on 204 make 32 random bytes and keep them. Holding the matching key andmatchKeyHandoversnot empty → seal it to each andPOST /.api/ matchkey/ deliver
GET /api/sync · from openapi.yaml (getSync)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | | Field | Meaning | |---|---| | `company` | as in the Session → SyncView {company: CompanyView|null, device: SyncDevice|null, deliveries: DeliveryView[], handovers: HandoverView[], keyRecovery: KeyRecoveryBrief|null, datakeyRequests: DataKeyRequestBrief[], dataKeyRotation: boolean, keyRelease: KeyReleaseView|null, keyReleaseRequests: KeyReleaseRequestView[], shared: SharedKeysView[], notifications: SyncNotifications|null, update?: UpdateNews|null, albums: AlbumBriefView[], deletedAlbums: AlbumBriefView[], matchKey?: string|null, matchKeyNeeded: boolean, matchKeyHandovers: HandoverView[], memberMatchKeys: MemberMatchKeyView[], commands: RemoteCommandBrief[]} |
| 400 | Bad Request<name> must be a string<name> is too long |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
curl
# answers 200; errors 400, 401
curl -sS -X GET 'https://spacebackup.net/account/api/sync' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/sync",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/sync")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/sync");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/key/deliver#
Leaves a sealed keyring in another device's mailbox.
- Auth: registered device that holds the company's current key version.
- Request:
{"toDevice": "d_.9pz4wn5cm3k9xq2a", "version": 3, "sealed": "<base64 sealed box>"} sealedis opaque to the service (at most 64 KB of base64). - Response: 204. A second box from the same sender for the same device and version replaces the first.
- Errors: 400 →
sealed must be base64,sealed is too long. 404 →no such device(not an active device of the company). 409 →{"error": "only the company's current key version can be delivered", "keyVersion": 3},{"error": "this device does not have the current key", "keyVersion": 3}.
POST /api/key/deliver · from openapi.yaml (postKeyDeliver)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json DeliverRequesttoDevice string|nullversion integersealed string|null |
| 204 | No Content |
| 400 | sealed must be base64, sealed is too long<name> is required<name> is too long<name> must not contain control characters<name> must be base64bad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
| 404 | no such device (not an active device of the company)no such device |
| 409 | {"error": "only the company's current key version can be delivered", "keyVersion": 3}, {"error": "this device does not have the current key", "keyVersion": 3}only the company's current key version can be deliveredthis device does not have the current key |
curl
# answers 204; errors 400, 401, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/api/key/deliver' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"toDevice":"d_9pz4wn5cm3k9xq2a","version":3,"sealed":"<base64 sealed box>"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/key/deliver",
method="POST",
data=json.dumps({"toDevice": "d_9pz4wn5cm3k9xq2a", "version": 3, "sealed": "<base64 sealed box>"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/key/deliver")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"toDevice":"d_9pz4wn5cm3k9xq2a","version":3,"sealed":"<base64 sealed box>"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/key/deliver");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"toDevice":"d_9pz4wn5cm3k9xq2a","version":3,"sealed":"<base64 sealed box>"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/matchkey/claim#
The right to make the member's matching key (iOS request #68), for one device only: the service never makes, holds or
sees the key. The winner makes 32 random bytes, keeps them and hands them over sealed (POST /).
- Auth: registered device of an active member.
- Request: empty (
{}). - Response: 204 to the first device that asks while no device of the member holds a key, and again to that same
device while its claim is live (it lost the key before keeping it);
sync.matchKeyNeededis false from then on. - Lapse: a claim whose device has handed the key to nobody lapses when that device is removed, or once an hour has
gone by since both the claim and the arrival of another device waiting for the key. Then
matchKeyNeededis true again and another device may claim; the old winner's key reaches nobody and the new one replaces it on its device. A claim stays for good once its device delivered a box; a member's only device keeps its claim however long it is alone. - Errors: 409 →
a device of this member already holds the matching key; it is handed to this device,another device of this member makes the matching key.
POST /api/matchkey/claim · from openapi.yaml (postMatchkeyClaim)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | To the first device that asks while no device of the member holds a key, and again to that same device while its claim is live (it lost the key before keeping it) |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
| 409 | a device of this member already holds the matching key; it is handed to this device, another device of this member makes the matching keya device of this member already holds the matching key; it is handed to this deviceanother device of this member makes the matching key |
curl
# answers 204; errors 401, 403, 409
curl -sS -X POST 'https://spacebackup.net/account/api/matchkey/claim' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/matchkey/claim",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401, 403, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/matchkey/claim")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401, 403, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/matchkey/claim");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 401, 403, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/matchkey/deliver#
A device holding the member's matching key (it won the claim, or one was handed to it) leaves it sealed for one of the
devices in matchKeyHandovers (DeviceKey.Seal, purpose member-match-key); that device drops out of the list and
gets the box as sync.matchKey (a PC hosting another member's iCloud Photos: in memberMatchKeys). The box is opaque;
the service stores only sealed boxes.
- Auth: registered device of an active member that holds the matching key.
- Request:
{"toDevice": "d_.9pz4wn5cm3k9xq2a", "sealed": "<base64 sealed box>"} - Response: 204. A box once stored is never replaced.
- Errors: 400 →
the matching key is handed to another device(toDeviceis the caller),sealed must be base64. 403 → a target that is neither the member's own device nor a PC hosting their iCloud Photos. 404 →no such device. 409 →this device does not hold the member's matching key.
POST /api/matchkey/deliver · from openapi.yaml (postMatchkeyDeliver)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json MatchKeyDeliverRequesttoDevice string|nullsealed string|null |
| 204 | No Content |
| 400 | the matching key is handed to another device (toDevice is the caller), sealed must be base64the matching key is handed to another device<name> is required<name> is too long<name> must not contain control characters<name> must be base64bad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | a target that is neither the member's own device nor a PC hosting their iCloud Photosa matching key goes only to the member's own devices and the PCs hosting their iCloud Photosnot an active member of a companythis device is not registered (devices/register) |
| 404 | no such deviceno such device |
| 409 | this device does not hold the member's matching keythis device does not hold the member's matching key |
curl
# answers 204; errors 400, 401, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/api/matchkey/deliver' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"toDevice":"d_9pz4wn5cm3k9xq2a","sealed":"<base64 sealed box>"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/matchkey/deliver",
method="POST",
data=json.dumps({"toDevice": "d_9pz4wn5cm3k9xq2a", "sealed": "<base64 sealed box>"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/matchkey/deliver")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"toDevice":"d_9pz4wn5cm3k9xq2a","sealed":"<base64 sealed box>"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/matchkey/deliver");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"toDevice":"d_9pz4wn5cm3k9xq2a","sealed":"<base64 sealed box>"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/key/ack#
Says this device now has a key version. Its deliveries up to that version are dropped; the acknowledged version never goes down. It also ends a wait for the company key.
- Auth: registered device.
- Request:
{"version": 3, "keyProof"?: "<proof>"}. WithkeyProof(a PC that already held the key, upgrading), it must be the proof of the current version andversionthe current one. - Response: 204.
- Errors: 400 →
no such key version,keyProof is not the proof of the company's current key version.
POST /api/key/ack · from openapi.yaml (postKeyAck)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AckRequestversion integerkeyProof string|null |
| 204 | No Content |
| 400 | no such key version, keyProof is not the proof of the company's current key versionno such key versionkeyProof is not the proof of the company's current key versionbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
curl
# answers 204; errors 400, 401, 403
curl -sS -X POST 'https://spacebackup.net/account/api/key/ack' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"version":3,"keyProof":"<proof>"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/key/ack",
method="POST",
data=json.dumps({"version": 3, "keyProof": "<proof>"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/key/ack")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"version":3,"keyProof":"<proof>"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/key/ack");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"version":3,"keyProof":"<proof>"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/company/key#
Sets the company's first key (version 1) or rotates it (version = current + 1). Compare-and-set: of two PCs
rotating at once one wins and the other gets 409 and takes the winner's keyring from its deliveries.
- Auth: registered device that holds the current version (any version for the first key).
- Request:
Field Type Meaning versionint current + 1 keyProofstring a proof derived from the new key (the service stores its hash; it lets other PCs that hold the key join by keyProof)recoverystring the whole new keyring sealed to the service's recovery public key ( GET /api/recovery-key); a sealed box starting withSBK1, base64, at most 64 KB
- Response: 204. The caller's key version becomes
version,rotationNeededis cleared, and boxes of older versions waiting in mailboxes are dropped. - Errors: 400 →
recovery must be a sealed box (DeviceKey.,Seal to the recovery key) keyProof is required. 409 →{"error": "the first key must be version 1", "keyVersion": 0},{"error": "the company key changed; take the current one from your deliveries", "keyVersion": 4}.
POST /api/company/key · from openapi.yaml (postCompanyKey)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json CompanyKeyRequestversion integer · current + 1keyProof string|null · a proof derived from the new key (the service stores its hash; it lets other PCs that hold the key join by `keyProof`)recovery string|null · the whole new keyring sealed to the service's recovery public key (`GET /api/recovery-key`); a sealed box starting with `SBK1`, base64, at most 64 KB |
| 204 | No Content |
| 400 | recovery must be a sealed box (DeviceKey.Seal to the recovery key), keyProof is requiredrecovery must be a sealed box (DeviceKey.Seal to the recovery key)<name> is required<name> is too long<name> must not contain control characters<name> must be base64bad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
| 409 | {"error": "the first key must be version 1", "keyVersion": 0}, {"error": "the company key changed; take the current one from your deliveries", "keyVersion": 4}the first key must be version 1the company key changed; take the current one from your deliveriesthe company key changed |
curl
# answers 204; errors 400, 401, 403, 409
curl -sS -X POST 'https://spacebackup.net/account/api/company/key' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"version":3,"keyProof":"MCowBQYDK2VwAyEA8Jx…","recovery":"…"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/company/key",
method="POST",
data=json.dumps({"version": 3, "keyProof": "MCowBQYDK2VwAyEA8Jx…", "recovery": "…"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/company/key")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"version":3,"keyProof":"MCowBQYDK2VwAyEA8Jx…","recovery":"…"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/company/key");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"version":3,"keyProof":"MCowBQYDK2VwAyEA8Jx…","recovery":"…"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/recovery-key#
The service's recovery public key, to seal the recovery copy to.
- Auth: none.
- Response: 200
{"publicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…"}(P-256, base64 SubjectPublicKeyInfo).
GET /api/recovery-key · from openapi.yaml (getRecoveryKey)
| Auth | none |
|---|---|
| 200 | (P-256, base64 SubjectPublicKeyInfo) → RecoveryKeyView {publicKey: string} |
curl
# answers 200
curl -sS -X GET 'https://spacebackup.net/account/api/recovery-key'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/recovery-key",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/recovery-key")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/recovery-key");
using var res = await http.SendAsync(req); // answers 200
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Waiting for the company key#
A new device must never be stuck because the only device that holds the key is off or asleep. So when no device hands the key over within 2 minutes, the owner and admins can approve the new device, and the service gives it the key from its recovery copy at once. See Devices waiting for the company key.
- A device waits when it is registered, its member is active, the company has a key, the device has none and no box
waits in its mailbox. Its first
syncin that state starts the wait. - After 2 minutes without a handover (the server setting
keyHandoverWaitSeconds), the device's nextsyncmails the owner and admins once ("ANNA-LAPTOP (anna@acme.com) is waiting for your company's key") with an Approve link, and they get akey-waitingnotification. - On the waiting device,
syncreturnskeyRelease:{"id": "kq_w2m7zx4qa9k3pn5c", "state": "waiting", "since": "2026-10-18T09:00:03.120+00:00", "mailedAt": "2026-10-18T09:02:05.884+00:00", "approvers": ["anna@acme.com"], "holders": [{"deviceId": "d_4f2a7cqm3xk9wz2b", "name": "ANNA-PC", "os": "Windows 11 Pro 23H2", "lastSeen": "2026-10-18T07:41:00.000+00:00"}], "approverIsMe": true, "adminUrl": "https://spacebackup.net/account/admin"}stateiswaitingorapproved(the key is in its deliveries);mailedAtisnulluntil the approvers were mailed;holdersare the active devices that hold the current key, most recently seen first;approverIsMesays the device's own email is an approver (show an Approve button that opensadminUrl).keyReleaseisnullonce the device has a key.
GET /api/key-release#
The devices waiting for an approval: mailed, not removed, still without a key; not the caller's own device.
- Auth: owner/admin, by bearer token or web session + CSRF.
- Response: 200
[{"id": "kq_w2m7zx4qa9k3pn5c", "deviceId": "d_2kq9wz3xa5npe7hd", "name": "ANNA-LAPTOP", "email": "anna@acme.com", "os": "macOS 26.0", "since": "2026-10-18T09:00:03.120+00:00", "mailedAt": "2026-10-18T09:02:05.884+00:00"}]The same list is
keyReleaseRequestsin an owner's or admin'ssync. - Errors: 403 →
only the company's owner or an admin may do this.
GET /api/key-release · from openapi.yaml (getKeyRelease)
| Auth | Authorization: Bearer <device token>, or the admin page's web session (cookie sa_session) plus X-CSRF-Token |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | The same list is `keyReleaseRequests` in an owner's or admin's `sync` → array of KeyReleaseRequestView {id: string, deviceId: string, name: string, email: string, os: string, since: string(date-time), mailedAt: string(date-time)} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the company's owner or an admin may do thisonly the company's owner or an admin may do thismissing CSRF token |
curl
# answers 200; errors 401, 403
curl -sS -X GET 'https://spacebackup.net/account/api/key-release' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/key-release",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/key-release")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/key-release");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/key-release/{id}/approve#
Approves a waiting device: the newest recovery copy of the keyring is opened with the service's recovery key and sealed
to the waiting device's public key, as a delivery with fromDevice: "service". The device takes it with its next sync
and acknowledges it.
- Auth: owner/admin, by bearer token or web session + CSRF; not the waiting device itself.
- Request: no body.
- Response: 204 (also when it was approved already).
- Errors: 403 → `a device cannot approve itself: approve it from the email we sent, or from another signed-in device
or the admin page
;only the company's owner or an admin may approve this. 404 →no such key request`. 409 →ANNA-,LAPTOP already has the company key that device was removed,the company has no recovery copy of its key. 503 →the recovery copy cannot be opened with this service's recovery key; try again after the operator has fixed it(the service runs with another recovery key than the copy was sealed to; nothing changed, try again later).
POST /api/key-release/{id}/approve · from openapi.yaml (postKeyReleaseIdApprove)
| Auth | Authorization: Bearer <device token>, or the admin page's web session (cookie sa_session) plus X-CSRF-Token |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | (also when it was approved already) |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | a device cannot approve itself: approve it from the email we sent, or from another signed-in device or the admin page; only the company's owner or an admin may approve thisa device cannot approve itself: approve it from the email we sent, or from another signed-in device or the admin pageonly the company's owner or an admin may do thisonly the company's owner or an admin may approve thismissing CSRF token |
| 404 | no such key requestno such key request |
| 409 | ANNA-LAPTOP already has the company key, that device was removed, the company has no recovery copy of its keythat device was removed<name> already has the company keythe company has no recovery copy of its key |
| 503 | the recovery copy cannot be opened with this service's recovery key; try again after the operator has fixed it (the service runs with another recovery key than the copy was sealed to; nothing changed, try again later)the recovery copy cannot be opened with this service's recovery key; try again after the operator has fixed it |
curl
# answers 204; errors 401, 403, 404, 409, 503
curl -sS -X POST 'https://spacebackup.net/account/api/key-release/kq_w2m7zx4qa9k3pn5c/approve' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/key-release/kq_w2m7zx4qa9k3pn5c/approve",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401, 403, 404, 409, 503
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/key-release/kq_w2m7zx4qa9k3pn5c/approve")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401, 403, 404, 409, 503
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/key-release/kq_w2m7zx4qa9k3pn5c/approve");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 401, 403, 404, 409, 503
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Company-key recovery#
For the case where every device that held the company key is lost. An admin's new device asks for the recovery
copy; after 24 hours (server setting recoveryDelayHours), unless an admin cancels, the service releases it to that
device. Every admin is mailed a Cancel link. See Company-key recovery.
POST /api/key-recovery/request#
- Auth: owner/admin with a registered device that holds no current key.
- Request: no body.
- Response: 200
{"id": "kr_. Asking again while one waits returns that one (no new mails).p4xq9m2ka7zw3n5c", "releaseAt": "2026- 10- 19T09:15:00. 000+00:00"} - Errors: 403 → a plain member, or
this device is not registered (devices/. 409 →register) the company has no key to recover yet,this device already has the company key.
POST /api/key-recovery/request · from openapi.yaml (postKeyRecoveryRequest)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | OK → KeyRecoveryStarted {id: string, releaseAt: string(date-time)} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | a plain member, or this device is not registered (devices/register)only the company's owner or an admin may do thisthis device is not registered (devices/register) |
| 409 | the company has no key to recover yet, this device already has the company keythe company has no key to recover yetthis device already has the company key |
curl
# answers 200; errors 401, 403, 409
curl -sS -X POST 'https://spacebackup.net/account/api/key-recovery/request' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/key-recovery/request",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/key-recovery/request")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/key-recovery/request");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/key-recovery/{id}#
- Auth: the registered device that asked (any other: 404).
- Response: 200
{"id": "kr_. Once…", "state": "waiting", "releaseAt": "…"} releaseAthas passed and nobody cancelled:state: "released"andsealed, the newest keyring sealed to this device's public key:{"id": "kr_p4xq9m2ka7zw3n5c", "state": "released", "releaseAt": "2026-10-19T09:15:00.000+00:00", "sealed": "U0JLMQ…"}Other states:
waiting,cancelled. - Errors: 403 →
only an admin's device gets the recovery copy(the requester is no longer an admin). 404 →no such key recovery request. 503 → `the recovery copy cannot be opened with this service's recovery key; try again after the operator has fixed it(the request isreleased` but the service runs with another recovery key than the copy was sealed to; ask again later).
GET /api/key-recovery/{id} · from openapi.yaml (getKeyRecoveryId)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | OK → KeyRecoveryView {id: string, state: string, releaseAt: string(date-time), sealed?: string|null} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only an admin's device gets the recovery copy (the requester is no longer an admin)only an admin's device gets the recovery copynot an active member of a companythis device is not registered (devices/register) |
| 404 | no such key recovery requestno such key recovery request |
| 503 | the recovery copy cannot be opened with this service's recovery key; try again after the operator has fixed it (the request is released but the service runs with another recovery key than the copy was sealed to; ask again later)the recovery copy cannot be opened with this service's recovery key; try again after the operator has fixed it |
curl
# answers 200; errors 401, 403, 404, 503
curl -sS -X GET 'https://spacebackup.net/account/api/key-recovery/kr_p4xq9m2ka7zw3n5c' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/key-recovery/kr_p4xq9m2ka7zw3n5c",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403, 404, 503
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/key-recovery/kr_p4xq9m2ka7zw3n5c")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403, 404, 503
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/key-recovery/kr_p4xq9m2ka7zw3n5c");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403, 404, 503
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/key-recovery/{id}/cancel#
- Auth: owner/admin, by bearer token or web session + CSRF.
- Request: no body.
- Response: 204 (also when cancelled already).
- Errors: 403 → not owner/admin. 404 →
no such key recovery request. 409 →the recovery copy was already released.
POST /api/key-recovery/{id}/cancel · from openapi.yaml (postKeyRecoveryIdCancel)
| Auth | Authorization: Bearer <device token>, or the admin page's web session (cookie sa_session) plus X-CSRF-Token |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | (also when cancelled already) |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | not owner/adminonly the company's owner or an admin may do thismissing CSRF token |
| 404 | no such key recovery requestno such key recovery request |
| 409 | the recovery copy was already releasedthe recovery copy was already released |
curl
# answers 204; errors 401, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/api/key-recovery/kr_p4xq9m2ka7zw3n5c/cancel' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/key-recovery/kr_p4xq9m2ka7zw3n5c/cancel",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/key-recovery/kr_p4xq9m2ka7zw3n5c/cancel")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/key-recovery/kr_p4xq9m2ka7zw3n5c/cancel");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 401, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Data-key recovery & restore requests#
Each device (PC or phone) encrypts its backups with its own data key. It stores a copy on the service, wrapped with a key derived from the company key, which the service cannot open. When a device is lost, another device (a PC or a new phone) asks to restore its backups; it is approved; the requesting device then gets the wrapped copy and unwraps it with the company key (the copy is not sealed to the requesting device; the format is in docs/account-service.md, "Data-key recovery"). See Approving restores.
PUT /api/datakey#
Stores (or replaces) the calling device's wrapped data key, or the data key of an iCloud Photos source it hosts.
- Auth: registered device.
- Request:
{"keyId": "dk-.5c2e…", "keyVersion": 3, "wrapped": "<base64>"} keyVersionis the company-key version it is wrapped with;wrappedat most 64 KB of base64;keyIdat most 100 characters. Optional `"device": "ic_…"`: the copy is that iCloud Photos source's (iOS request #68), not the PC's: each source has a data key of its own, made by its PC and used for that source's backups only, never the PC's own key. Only the PC hosting the source may put it, while the source is not removed. - Response: 204. The same
keyIdagain (re-wrapped with a newer company key) replaces the copy. A differentkeyId(a new data key) keeps the previous one as a former key, so older backups stay readable, and clearsdataKeyRotation. - Errors: 400 →
no such key version,wrapped must be base64,keyId is required. 403 → `only the PC hosting an iCloud source puts its data key. 404 →no such iCloud source` (also once it is removed).
PUT /api/datakey · from openapi.yaml (putDatakey)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json DataKeyPutkeyId string|nullkeyVersion integerwrapped string|nulldevice string|null |
| 204 | No Content |
| 400 | no such key version, wrapped must be base64, keyId is requiredno such key version<name> is required<name> is too long<name> must not contain control characters<name> must be base64bad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the PC hosting an iCloud source puts its data keynot an active member of a companythis device is not registered (devices/register)only the PC hosting an iCloud source puts its data key |
| 404 | no such iCloud source (also once it is removed)no such iCloud source |
curl
# answers 204; errors 400, 401, 403, 404
curl -sS -X PUT 'https://spacebackup.net/account/api/datakey' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"keyId":"dk-5c2e…","keyVersion":3,"wrapped":"<base64>"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/datakey",
method="PUT",
data=json.dumps({"keyId": "dk-5c2e…", "keyVersion": 3, "wrapped": "<base64>"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/datakey")!)
req.httpMethod = "PUT"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"keyId":"dk-5c2e…","keyVersion":3,"wrapped":"<base64>"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Put, "https://spacebackup.net/account/api/datakey");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"keyId":"dk-5c2e…","keyVersion":3,"wrapped":"<base64>"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/datakeys#
The source devices whose keys the caller may ask for: devices of the caller's email (all of the company for owners and admins), not the caller itself, that have a stored copy.
- Auth: active member.
- Response: 200
[{"deviceId": "d_7pz4wn5cq2am3k9x", "name": "OLD-LAPTOP", "email": "anna@acme.com", "keyId": "dk-91fe…", "removed": true}]removedistruefor a removed device (a lost one usually is).
GET /api/datakeys · from openapi.yaml (getDatakeys)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | `removed` is `true` for a removed device (a lost one usually is) → array of DataKeySource {deviceId: string, name: string, email: string, keyId: string, removed: boolean} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
curl
# answers 200; errors 401, 403
curl -sS -X GET 'https://spacebackup.net/account/api/datakeys' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/datakeys",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/datakeys")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/datakeys");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/datakey-requests#
Asks to restore another device's backups. The device's own member and the owner and admins get a mail with Approve
and Deny links and a restore-approval notification (target approval for the device's member, datakey-request
for the admins).
A device of the caller's own email (since 2026-10-29): when the calling device holds the company key, the request is
approved at once (decidedBy "auto: same member"), nothing is mailed or notified, and a row goes to the company's
audit log; the answer's state is approved and GET / gives wrapped right away. Asking
again for that source returns the same approved request.
- Auth: registered device.
- Request:
{"sourceDevice": "d_7pz4wn5cq2am3k9x"} - Response: 200
{"id": "dr_(z3k7xq2ma9pw4n5c", "state": "waiting"} "approved"for the caller's own device, above). Asking again while one waits returns that one. - Errors: 404 →
no data key of that device to ask for(not one the caller may ask for, or no copy stored).
POST /api/datakey-requests · from openapi.yaml (postDatakeyRequests)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json DataKeyRequestCreatesourceDevice string|null |
| 200 | (`"approved"` for the caller's own device, above) → DataKeyRequestStarted {id: string, state: string} |
| 400 | Bad Request<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
| 404 | no data key of that device to ask for (not one the caller may ask for, or no copy stored)no data key of that device to ask for |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/datakey-requests' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"sourceDevice":"d_7pz4wn5cq2am3k9x"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/datakey-requests",
method="POST",
data=json.dumps({"sourceDevice": "d_7pz4wn5cq2am3k9x"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/datakey-requests")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"sourceDevice":"d_7pz4wn5cq2am3k9x"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/datakey-requests");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"sourceDevice":"d_7pz4wn5cq2am3k9x"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/datakey-requests/{id}#
- Auth: the requesting device, or an owner/admin (who see it without the key). Anyone else: 404.
- Response: 200
{"id": "dr_z3k7xq2ma9pw4n5c", "state": "approved", "sourceDevice": "d_7pz4wn5cq2am3k9x", "keyId": "dk-91fe…", "keyVersion": 3, "wrapped": "AAECAwQF…", "former": [{"keyId": "dk-0a3b…", "keyVersion": 2, "wrapped": "BgcICQoL…", "current": false}]}stateiswaiting,approvedordenied.wrappedandformer(the source's older data keys) are optional: only whenapproved, and only to the requesting device.keyId/keyVersionare those of the source's current copy. Approving or denying is done on the admin page, by the device's own member (GET /api/me/approvals, or Restore requests on their web page) or by the mailed link (Mailed approval links). - Errors: 404 →
no such data-key request(also when the caller may not see it).
GET /api/datakey-requests/{id} · from openapi.yaml (getDatakeyRequestsId)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | `state` is `waiting`, `approved` or `denied`. `wrapped` and `former` (the source's older data keys) are *optional*: only when `approved`, and only to the requesting device. `keyId`/`keyVersion` are those of the source's current copy → DataKeyRequestView {id: string, state: string, sourceDevice: string, keyId: string, keyVersion: integer, wrapped?: string|null, former?: WrappedKeyView[]} |
| 400 | Bad Request<name> must be a string<name> is too long |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
| 404 | no such data-key request (also when the caller may not see it)no such data-key request |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X GET 'https://spacebackup.net/account/api/datakey-requests/dr_z3k7xq2ma9pw4n5c' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/datakey-requests/dr_z3k7xq2ma9pw4n5c",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/datakey-requests/dr_z3k7xq2ma9pw4n5c")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/datakey-requests/dr_z3k7xq2ma9pw4n5c");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/me/approvals#
Every request to restore a device of the caller's email, any state, newest first: what the iPhone app's Approvals
screen and Restore requests on /account/me show. For an owner or admin it also holds the company's other
members' requests (those they get a datakey-request notification for): every one that waits, and those decided in
the last 30 days.
- Auth: registered device of an active member (any role); a plain member never sees other members' requests.
- Response: 200
[{"id": "dr_z3k7xq2ma9pw4n5c", "state": "waiting", "sourceDevice": "d_7pz4wn5cq2am3k9x", "sourceName": "ANNA-PC", "sourceEmail": "anna@acme.com", "requester": "bob@acme.com", "requesterName": "Bob Jones", "requestingDevice": "BOB-PC", "created": "2026-10-18T12:00:00+00:00", "canDecide": true, "decidedBy": null, "decided": null}]stateiswaiting,approvedordenied;sourceEmailis the email of the device's member;requesterNameisnullwhen the asker has no name;canDecideistruewhen it waits and the caller may decide it now (falsefor the caller's own request from another device unless they are an owner or admin: an owner or admin decides that one;falsetoo for an owner's or admin's own request for another member's device: that member or another owner or admin decides it);decidedBy(an email) anddecidedonce decided.
GET /api/me/approvals · from openapi.yaml (getMeApprovals)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | `state` is `waiting`, `approved` or `denied` → array of ApprovalView {id: string, state: string, sourceDevice: string, sourceName: string, requester: string, requesterName: string|null, requestingDevice: string, created: string(date-time), canDecide: boolean, decidedBy: string|null, decided: string(date-time)|null, sourceEmail: string} |
| 400 | Bad Request<name> must be a string<name> is too long |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
curl
# answers 200; errors 400, 401, 403
curl -sS -X GET 'https://spacebackup.net/account/api/me/approvals' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/me/approvals",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/me/approvals")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/me/approvals");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/me/approvals/{id}/approve, POST /api/me/approvals/{id}/deny#
The same decision as the mailed link, from any of the caller's signed-in devices, whatever their role: the device's member decides requests for their devices; an owner or admin also decides other members' requests (the same decision as on the admin page).
- Auth: registered device of an active member.
- Response: 204.
- Errors: 404 →
no such request to restore a device of yours(unknown, or another member's device and the caller is not an owner or admin); 403 → not for them to decide (their own request from another device, not being an owner or admin; an owner's or admin's own request for another member's device); 409 →this request was already approved|denied.
POST /api/me/approvals/{id}/approve · from openapi.yaml (postMeApprovalsIdApprove)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | No Content |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | not for them to decide (their own request from another device, not being an owner or admin; an owner's or admin's own request for another member's device);not an active member of a company |
| 404 | no such request to restore a device of yours (unknown, or another member's device and the caller is not an owner or admin);no such request to restore a device of yoursno such data-key request |
| 409 | this request was already approved|deniedthis request was already <state> |
curl
# answers 204; errors 401, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/api/me/approvals/dr_z3k7xq2ma9pw4n5c/approve' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/me/approvals/dr_z3k7xq2ma9pw4n5c/approve",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/me/approvals/dr_z3k7xq2ma9pw4n5c/approve")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/me/approvals/dr_z3k7xq2ma9pw4n5c/approve");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 401, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/me/approvals/{id}/deny · from openapi.yaml (postMeApprovalsIdDeny)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | No Content |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | not for them to decide (their own request from another device, not being an owner or admin; an owner's or admin's own request for another member's device);not an active member of a company |
| 404 | no such request to restore a device of yours (unknown, or another member's device and the caller is not an owner or admin);no such request to restore a device of yoursno such data-key request |
| 409 | this request was already approved|deniedthis request was already <state> |
curl
# answers 204; errors 401, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/api/me/approvals/dr_z3k7xq2ma9pw4n5c/deny' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/me/approvals/dr_z3k7xq2ma9pw4n5c/deny",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/me/approvals/dr_z3k7xq2ma9pw4n5c/deny")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/me/approvals/dr_z3k7xq2ma9pw4n5c/deny");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 401, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Device state#
A phone keeps its backup catalog and choices with the account, so deleting the app, or a new phone given the same name, does not start over. The state is sealed on the phone with its own data key; the service never opens it. It is kept per company, member and device name (ignoring case), not per device id.
PUT /api/devices/state#
- Auth: registered device.
- Request:
Content-(else 415),Type: application/ json {"sealed": "<base64>", "updated": "2026-.10- 18T09:12:00+02:00"} sealedup to 8 MB decoded (this route alone reads a body up to 12 MB);updatedany ISO-8601 time (the phone's), kept exactly as sent. - Response: 204. Replaces the state kept for this name and records which device wrote it.
- Errors:
- 400 →
sealed is required,sealed must be base64,updated must be an ISO-.8601 time - 409 →
{"error": "Another device with this name keeps its state here.: another, still registered device of the same member wrote the state under this name. A removed device's state is taken over by the next PUT.Rename this device. ", "code": "name_ clash"} - 413 →
sealed is larger than 8 MB,request larger than 12 MB (sealed up to 8 MB). - 415 →
the body must be JSON (Content-.Type: application/ json)
- 400 →
Note: When the device is renamed (
devices/registerwith another name), its state moves to the new name. The state is deleted when the member is removed from the company; a removed device's state stays under its name.
PUT /api/devices/state · from openapi.yaml (putDevicesState)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json DeviceStatePutsealed string|nullupdated string|null |
| 204 | No Content |
| 400 | sealed is required, sealed must be base64, updated must be an ISO-8601 time. -bad request: <message>a JSON body is requiredsealed is requiredsealed must be base64updated must be an ISO-8601 timebad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
| 409 | {"error": "Another device with this name keeps its state here. Rename this device.", "code": "name_clash"}: another, still registered device of the same member wrote the state under this name. A removed device's state is taken over by the next PUT. - |
| 413 | sealed is larger than 8 MB, request larger than 12 MB (sealed up to 8 MB). -request larger than 12 MB (sealed up to 8 MB)sealed is larger than 8 MB |
| 415 | the body must be JSON (Content-Type: application/json)the body must be JSON (Content-Type: application/json) |
curl
# answers 204; errors 400, 401, 403, 409, 413, 415
curl -sS -X PUT 'https://spacebackup.net/account/api/devices/state' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"sealed":"<base64>","updated":"2026-10-18T09:12:00+02:00"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/state",
method="PUT",
data=json.dumps({"sealed": "<base64>", "updated": "2026-10-18T09:12:00+02:00"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403, 409, 413, 415
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/state")!)
req.httpMethod = "PUT"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"sealed":"<base64>","updated":"2026-10-18T09:12:00+02:00"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403, 409, 413, 415
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Put, "https://spacebackup.net/account/api/devices/state");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"sealed":"<base64>","updated":"2026-10-18T09:12:00+02:00"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403, 409, 413, 415
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/devices/state#
- Auth: registered device.
- Query:
device=<device id>? another device's state: a lost phone's, read by the member's new phone under another name and opened with the lost phone's data key from an approved restore request. Only a device of the caller's email, or one whose restore request by the calling device was approved. - Response: 200
{"sealed": "<base64>", "updated": "2026-for the caller's company, member and device name; with10- 18T09:12:00+02:00"} device, the state that device wrote (whatever its name now). - Errors: 404 →
no state kept for this device; withdevice:no state kept for that device(also when the caller may not read it).
GET /api/devices/state · from openapi.yaml (getDevicesState)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| query | device string|null (optional) |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | For the caller's company, member and device name → DeviceStateView {sealed: string, updated: string} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
| 404 | no state kept for this device; with device: no state kept for that device (also when the caller may not read it)no state kept for this deviceno state kept for that device |
curl
# answers 200; errors 401, 403, 404
curl -sS -X GET 'https://spacebackup.net/account/api/devices/state?device=d_4f2a7cqm3xk9wz2b' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/state?device=d_4f2a7cqm3xk9wz2b",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/state?device=d_4f2a7cqm3xk9wz2b")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/devices/state?device=d_4f2a7cqm3xk9wz2b");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Remote commands & PC status#
What the remote MCP server (AI agents, docs/mcp.md "Remote") needs from the PCs: an agent's
backup_now waits as a command until the PC's next GET /api/sync lists it in commands (about a minute), the PC runs
it through its own "Back up now" and answers; a PC reports a small plain status (times, counts, a result), never a file
name, a path or a key.
POST /api/devices/commands/{id}#
The PC's answer to a command from sync.commands: started when its backup began, then done or failed when that
run ended (or failed at once, with the reason). A late started after an end changes nothing.
- Auth: registered device: only the device the command is for (a device token; not a web session).
- Request:
{"state": "started", "message": "backup started"};stateone ofstarted,done,failed;message? one line, cut to 200 characters. - Response: 204.
- Errors: 400 →
state must be started, done or failed. 403 →only the device answers its commands,this device is not registered (devices/. 404 →register) no such command(another device's, or unknown).
POST /api/devices/commands/{id} · from openapi.yaml (postDevicesCommandsId)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json CommandAnswerstate string|nullmessage string|null |
| 204 | No Content |
| 400 | state must be started, done or failedstate must be started, done or failedbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the device answers its commands, this device is not registered (devices/register)only the device answers its commandsnot an active member of a companythis device is not registered (devices/register) |
| 404 | no such command (another device's, or unknown)no such command |
curl
# answers 204; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/devices/commands/x_k3xq7m2pa9fz4w8r' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"state":"started","message":"backup started"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/commands/x_k3xq7m2pa9fz4w8r",
method="POST",
data=json.dumps({"state": "started", "message": "backup started"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/commands/x_k3xq7m2pa9fz4w8r")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"state":"started","message":"backup started"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/devices/commands/x_k3xq7m2pa9fz4w8r");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"state":"started","message":"backup started"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");PUT /api/devices/status#
The calling PC's own status, replacing the last one. Sent when it changes, at least every 15 minutes and just after a run.
- Auth: registered device (a device token).
- Request: `{"running": false, "lastRunStarted": "2026-10-30T11:00:00Z", "lastRunEnded": "2026-10-30T11:05:00Z",
"lastResult": "ok", "lastError": null, "lastFiles": 12, "lastBytes": 3456, "nextRun": "2026-10-30T13:00:00Z",
"folders": 2, "destinations": 1, "paused": null}`; every field may be null or left out. Times any ISO-8601 (kept in UTC);
lastResultone ofok,errors,failed,cancelled;lastErrorone line, cut to 200 characters. - Response: 204.
- Errors: 400 →
lastResult must be one of ok, errors, failed, cancelled,lastRunStarted must be an ISO-(and the other times),8601 time counts out of range. 403 →only a device reports its status,this device is not registered (devices/.register)
PUT /api/devices/status · from openapi.yaml (putDevicesStatus)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json DeviceStatusReportrunning boolean|nulllastRunStarted string|nulllastRunEnded string|nulllastResult string|nulllastError string|nulllastFiles integer(int64)|nulllastBytes integer(int64)|nullnextRun string|nullfolders integer|nulldestinations integer|nullpaused boolean|null |
| 204 | No Content |
| 400 | lastResult must be one of ok, errors, failed, cancelled, lastRunStarted must be an ISO-8601 time (and the other times), counts out of rangelastResult must be one of <runResults>counts out of range<name> must be an ISO-8601 timebad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only a device reports its status, this device is not registered (devices/register)only a device reports its statusnot an active member of a companythis device is not registered (devices/register) |
curl
# answers 204; errors 400, 401, 403
curl -sS -X PUT 'https://spacebackup.net/account/api/devices/status' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"running":false,"lastRunStarted":"2026-10-30T11:00:00Z","lastRunEnded":"2026-10-30T11:05:00Z","lastResult":"ok","lastError":null,"lastFiles":12,"lastBytes":3456,"nextRun":"2026-10-30T13:00:00Z","folders":2,"destinations":1,"paused":null}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/status",
method="PUT",
data=json.dumps({"running": False, "lastRunStarted": "2026-10-30T11:00:00Z", "lastRunEnded": "2026-10-30T11:05:00Z", "lastResult": "ok", "lastError": None, "lastFiles": 12, "lastBytes": 3456, "nextRun": "2026-10-30T13:00:00Z", "folders": 2, "destinations": 1, "paused": None}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/status")!)
req.httpMethod = "PUT"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"running":false,"lastRunStarted":"2026-10-30T11:00:00Z","lastRunEnded":"2026-10-30T11:05:00Z","lastResult":"ok","lastError":null,"lastFiles":12,"lastBytes":3456,"nextRun":"2026-10-30T13:00:00Z","folders":2,"destinations":1,"paused":null}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Put, "https://spacebackup.net/account/api/devices/status");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"running":false,"lastRunStarted":"2026-10-30T11:00:00Z","lastRunEnded":"2026-10-30T11:05:00Z","lastResult":"ok","lastError":null,"lastFiles":12,"lastBytes":3456,"nextRun":"2026-10-30T13:00:00Z","folders":2,"destinations":1,"paused":null}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/devices/{id}/status#
One device as the agent's device_status shows it: the Device row, the PC's last status (null until it
sent one), when a phone last saved its state (never the state), and its newest five requests.
- Auth: active member: their own devices; an owner/admin: every device of the company.
- Response: 200
{"device": {…Device…}, "status": {"reported": "…", "running": false, "lastResult": "ok", …}, "phoneStateSaved": null, "requests": [{"id": "cmd_.…", "device": "d_ …", "kind": "backup- now", "requestedBy": "anna@acme. com", "requested": "…", "state": "done", "stateAt": "…", "message": "finished: ok"}]} - Errors: 404 →
no such device.
GET /api/devices/{id}/status · from openapi.yaml (getDevicesIdStatus)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | OK → DeviceStatusView {device: DeviceView, status: PcStatusView|null, phoneStateSaved?: string|null, requests: DeviceCommandView[]} |
| 400 | Bad Request<name> must be a string<name> is too long |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
| 404 | no such deviceno such device |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X GET 'https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/status' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/status",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/status")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/status");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/devices/{id}/backup-now#
Asks a PC to back up now (what the agent's backup_now does). One open request per PC: asked again while one waits (or
the PC started it within the last minute), that one is answered. Not picked up within an hour, it reads expired.
- Auth: active member: the device's own member, or an owner/admin; a bearer token or the web session + CSRF.
- Request: no body.
- Response: 200 the request: `{"id": "cmd_…", "device": "d_…", "kind": "backup-now", "requestedBy": "anna@acme.com", "requested": "…", "state": "pending", "stateAt": "…", "message": null}`.
- Errors: 400 →
Anna-. 403 → `only the device's member or the company's owner or an admin may start its backupiPhone is not a computer (iOS 26. 5): a phone backs up from its own app . 404 →no such device`.
POST /api/devices/{id}/backup-now · from openapi.yaml (postDevicesIdBackupNow)
| Auth | Authorization: Bearer <device token>, or the admin page's web session (cookie sa_session) plus X-CSRF-Token |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | The request: {...} → DeviceCommandView {id: string, device: string, kind: string, requestedBy: string, requested: string(date-time), state: string, stateAt: string(date-time), message: string|null} |
| 400 | Anna-iPhone is not a computer (iOS 26.5): a phone backs up from its own app<name> is not a computer (<os>): a phone backs up from its own app<name> must be a string<name> is too long |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the device's member or the company's owner or an admin may start its backuponly the device's member or the company's owner or an admin may start its backupnot an active member of a companymissing CSRF token |
| 404 | no such deviceno such device |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/backup-now' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/backup-now",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/backup-now")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/devices/d_4f2a7cqm3xk9wz2b/backup-now");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Shares of a device's backups#
A share lets one colleague view and restore a copy of everything one device backed up, read-only. It is a standing
approval: the recipient's devices get the source's wrapped data keys in sync (shared), and the PCs that store the
backups serve them once the service confirms a peer ticket. See
Sharing a device's backups.
POST /api/shares#
- Auth: active member.
- A member may share only their own devices (else 403); an owner/admin any device of the company, also a removed one (a lost PC).
- Request:
{"sourceDevice": "d_. One recipient per request; the recipient must be an4f2a7cqm3xk9wz2b", "email": "bob@acme. com"} activeorinvitedmember of the same company (an invited person gets the keys once they joined). To share with a group, send one request per member. - Response: 201 Share, or 200 with the existing share when it was shared already. Mails: the recipient;
the owner and admins when a plain member shared; the device's owner when an admin shared someone else's device. The
recipient gets a
sharednotification. - Errors: 400 →
these backups are already bob@acme.(the recipient is the device's owner). 403 →com's only the device's owner or an admin can share its backups. 404 →no such device,bob@acme..com is not a member of your company
POST /api/shares · from openapi.yaml (postShares)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json ShareCreatesourceDevice string|nullemail string|null |
| 200 | 201 Share, or 200 with the existing share when it was shared already → ShareView {id: string, sourceDevice: string, sourceName: string, ownerEmail: string, recipientEmail: string, sharedBy: string, since: string(date-time), scope: string} |
| 201 | Share, or 200 with the existing share when it was shared already → ShareView {id: string, sourceDevice: string, sourceName: string, ownerEmail: string, recipientEmail: string, sharedBy: string, since: string(date-time), scope: string} |
| 400 | these backups are already bob@acme.com's (the recipient is the device's owner)these backups are already <email>'s<name> is required<name> is too long<name> must not contain control charactersnot a valid email addressbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the device's owner or an admin can share its backupsonly the device's owner or an admin can share its backupsyou cannot share <name>'s backups with yourself: ask to restore them instead, which <email> or another owner or admin approvesnot an active member of a company |
| 404 | no such device, bob@acme.com is not a member of your companyno such device<email> is not a member of your company |
curl
# answers 200, 201; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/shares' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"sourceDevice":"d_4f2a7cqm3xk9wz2b","email":"bob@acme.com"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/shares",
method="POST",
data=json.dumps({"sourceDevice": "d_4f2a7cqm3xk9wz2b", "email": "bob@acme.com"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200, 201; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/shares")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"sourceDevice":"d_4f2a7cqm3xk9wz2b","email":"bob@acme.com"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200, 201; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/shares");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"sourceDevice":"d_4f2a7cqm3xk9wz2b","email":"bob@acme.com"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200, 201; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/shares#
Active shares the caller may see: of the devices with the caller's email; owners and admins: all of the company.
- Auth: active member.
- Query:
device=<device id>? narrows to one source device. - Response: 200
[Share], by device name and recipient.
GET /api/shares · from openapi.yaml (getShares)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| query | device string|null (optional) |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | `[Share]`, by device name and recipient → array of ShareView {id: string, sourceDevice: string, sourceName: string, ownerEmail: string, recipientEmail: string, sharedBy: string, since: string(date-time), scope: string} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
curl
# answers 200; errors 401, 403
curl -sS -X GET 'https://spacebackup.net/account/api/shares?device=d_4f2a7cqm3xk9wz2b' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/shares?device=d_4f2a7cqm3xk9wz2b",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/shares?device=d_4f2a7cqm3xk9wz2b")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/shares?device=d_4f2a7cqm3xk9wz2b");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/shares/with-me#
Active shares whose recipient is the caller.
- Auth: active member.
- Response: 200
[Share].
GET /api/shares/with-me · from openapi.yaml (getSharesWithMe)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | `[Share]` → array of ShareView {id: string, sourceDevice: string, sourceName: string, ownerEmail: string, recipientEmail: string, sharedBy: string, since: string(date-time), scope: string} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
curl
# answers 200; errors 401, 403
curl -sS -X GET 'https://spacebackup.net/account/api/shares/with-me' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/shares/with-me",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/shares/with-me")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/shares/with-me");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/shares/{id}/remove#
Stops a share. Backups that the recipient's devices could already read stay readable to them; new backups are not shared (the source makes a new data key at its next sync when the keys had been handed out).
- Auth: active member: the device's owner, an owner/admin, whoever shared it, or the recipient (removing it from their own list).
- Request: no body.
- Response: 204 (also when already removed). The recipient is mailed and notified unless they removed it themselves.
- Errors: 404 →
no such share(also for anyone not allowed).
POST /api/shares/{id}/remove · from openapi.yaml (postSharesIdRemove)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | (also when already removed) |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
| 404 | no such share (also for anyone not allowed)no such share |
curl
# answers 204; errors 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/shares/sh_m3k9xq2a7pz4wn5c/remove' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/shares/sh_m3k9xq2a7pz4wn5c/remove",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/shares/sh_m3k9xq2a7pz4wn5c/remove")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/shares/sh_m3k9xq2a7pz4wn5c/remove");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Peer tickets#
A PC that stores other devices' backups (a host) serves another machine's folder to a device only after the service confirms a live share or an approved restore. The reader proves who it is with a ticket from the service, which it hands to the host over the encrypted peer channel; the host checks it here. The peer side is in API reference: the peer protocol.
POST /api/peer-tickets#
- Auth: registered device (the reader).
- Request:
{"sourceDevice": "d_4f2a7cqm3xk9wz2b"} - Response: 200
{"ticket": "pt_Yk3Qm9xP2aZ7wC4nV8bT1rL6sD0fH5jK9eG3uI7oA2c", "sourceDevice": "d_4f2a7cqm3xk9wz2b", "sourceName": "ANNA-PC", "reason": "share", "expires": "2026-10-18T10:12:00.000+00:00"}reason:share(an active share of that source to the caller's email) orrestore(an approved restore request of the calling device for that source; also for a removed source). Valid 1 hour, for this reader device and source only.sourceNameis the machine's folder name on the hosts. - Errors: 403 → not an active member, or the device is not registered. 404 → `no share or approved restore of that device for you`.
POST /api/peer-tickets · from openapi.yaml (postPeerTickets)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json PeerTicketCreatesourceDevice string|null |
| 200 | `reason`: `share` (an active share of that source to the caller's email) or `restore` (an approved restore request of the calling device for that source → PeerTicketView {ticket: string, sourceDevice: string, sourceName: string, reason: string, expires: string(date-time)} |
| 400 | Bad Request<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | not an active member, or the device is not registerednot an active member of a companythis device is not registered (devices/register) |
| 404 | no share or approved restore of that device for youno share or approved restore of that device for you |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/peer-tickets' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"sourceDevice":"d_4f2a7cqm3xk9wz2b"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/peer-tickets",
method="POST",
data=json.dumps({"sourceDevice": "d_4f2a7cqm3xk9wz2b"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/peer-tickets")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"sourceDevice":"d_4f2a7cqm3xk9wz2b"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/peer-tickets");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"sourceDevice":"d_4f2a7cqm3xk9wz2b"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/peer-tickets/check#
A host asks whether a reader's ticket is good now (the share or approval is checked at every call, not only when the ticket was made).
- Auth: registered device of the same company (the host).
- Request:
{"ticket": "pt_…"} - Response: 200
{"requesterDevice": "d_7pz4wn5cq2am3k9x", "requesterName": "BOB-PC", "requesterEmail": "bob@acme.com", "sourceDevice": "d_4f2a7cqm3xk9wz2b", "sourceName": "ANNA-PC", "reason": "share", "expires": "2026-10-18T10:12:00.000+00:00"}A host serves only when
requesterNameis the connection's peer name andsourceNamethe asked machine. Hosts cache a yes for 5 minutes (never pastexpires) and a no for 1 minute. - Errors: 404 →
no live share or approved restore for that ticket(unknown or expired ticket, the share ended, the restore no longer approved, the reader device or its member removed).
POST /api/peer-tickets/check · from openapi.yaml (postPeerTicketsCheck)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json PeerTicketCheckticket string|null |
| 200 | A host serves only when `requesterName` is the connection's peer name and `sourceName` the asked machine → PeerTicketCheckView {requesterDevice: string, requesterName: string, requesterEmail: string, sourceDevice: string, sourceName: string, reason: string, expires: string(date-time)} |
| 400 | Bad Request<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
| 404 | no live share or approved restore for that ticket (unknown or expired ticket, the share ended, the restore no longer approved, the reader device or its member removed) |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/peer-tickets/check' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"ticket":"pt_…"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/peer-tickets/check",
method="POST",
data=json.dumps({"ticket": "pt_…"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/peer-tickets/check")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"ticket":"pt_…"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/peer-tickets/check");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"ticket":"pt_…"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");TV app#
The TV app (Fire TV, Android TV; docs/tv.md) is a
viewer that never types a password. It shows a pairing code (8 letters and digits without 0, O, 1, I, L; shown as
ABCD-EFGH, typed in any case, with or without the dash) and a QR code for 10 minutes; the iPhone app (scanning the QR),
a signed-in desktop app or the web page /tv approves it; the TV polls and gets its own token (tvt_…), listed
with its member's TVs and removable. A TV is not a device of the company: no company key, no data key, nothing to back
up. It views the photos through one of its member's own PCs: tv/pass gives each of them with a ticket, the key of
the TLS certificate the PC serves it with, and a relay guest pass. Albums of another company the member is a guest
of come from that company's PCs keeping them (guests in tv/pass): a guest ticket per PC and a relay guest pass for
that company's group; such a PC shows the TV those albums only, read-only.
A TV's token opens only tv/me, tv/pass, tv/languages, tv/voice/wait, tv/changed/wait and tv/signout; any other route answers 403
a TV's token is for the TV routes only.
POST /api/tv/pair/start#
The TV asks for a pairing. No sign-in.
- Auth: none.
- Request:
{"name": "Fire TV Stick", "model": "AFTSSS", "os": "Fire OS 8 (Android 11)", "version": "tv-;1. 0. 0"} nameis required (at most 64 characters, shown to the approver), the others optional. - Response: 200
{"pairId": "tvp_8w2kq4zx7m3c5n9a", "secret": "q0Vh3c2v6b1Kx9yQ0d3t8w5r2z7n4m1p6s9u2f5h8j1", "code": "K7QM-3XRT", "url": "https://spacebackup.net/tv", "qrUrl": "https://spacebackup.net/tv?code=K7QM3XRT", "expires": "2026-10-27T18:10:00.000+00:00", "interval": 3, "link": "https://spacebackup.net/tv/K7QM3XRT"}The TV shows
codeandurlin words andlinkas a QR code (the iPhone's Camera opens it in the Space Backup app; without the app, a page saying to open it), and polls everyintervalseconds untilexpires.qrUrlis the older QR form (?code=), still accepted everywhere, for TV apps from beforelink.secretstays on the TV (only it can poll). - Errors: 400 →
name is required; 429 →too many pairings from this network; try again later(10 per IP address and 10 minutes, 30 per day).
POST /api/tv/pair/start · from openapi.yaml (postTvPairStart)
| Auth | none |
|---|---|
| Body | application/json TvPairStartname string|nullmodel string|nullos string|nullversion string|null |
| 200 | The TV shows `code` and `url` in words and `link` as a QR code (the iPhone's Camera opens it in the Space Backup app → TvPairStarted {pairId: string, secret: string, code: string, url: string, qrUrl: string, expires: string(date-time), interval: integer, link: string} |
| 400 | name is required;name is requiredbad request: <the JSON parser's message> |
| 429 | too many pairings from this network; try again later (10 per IP address and 10 minutes, 30 per day)too many pairings from this network; try again later |
curl
# answers 200; errors 400, 429
curl -sS -X POST 'https://spacebackup.net/account/api/tv/pair/start' \
-H "Content-Type: application/json" \
--data '{"name":"Fire TV Stick","model":"AFTSSS","os":"Fire OS 8 (Android 11)","version":"tv-1.0.0"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/tv/pair/start",
method="POST",
data=json.dumps({"name": "Fire TV Stick", "model": "AFTSSS", "os": "Fire OS 8 (Android 11)", "version": "tv-1.0.0"}).encode(),
headers={"Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 429
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/tv/pair/start")!)
req.httpMethod = "POST"
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"name":"Fire TV Stick","model":"AFTSSS","os":"Fire OS 8 (Android 11)","version":"tv-1.0.0"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 429
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/tv/pair/start");
req.Content = new StringContent("""{"name":"Fire TV Stick","model":"AFTSSS","os":"Fire OS 8 (Android 11)","version":"tv-1.0.0"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 429
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/tv/pair/poll#
The TV asks whether it was approved. No sign-in.
- Auth: none (
pairId+secret). - Request:
{"pairId": "tvp_8w2kq4zx7m3c5n9a", "secret": "q0Vh3c2v6b1Kx9yQ0d3t8w5r2z7n4m1p6s9u2f5h8j1"} - Response: 200, waiting:
{"state": "waiting", "expires": "2026-; approved (answered once, the token is made then):10- 27T18:10:00. 000+00:00"} {"state": "approved", "expires": "2026-10-27T18:10:00.000+00:00", "token": "tvt_Yp3k9w2q7x4m1c8v5b2n6z0r3t7h1j4f", "deviceId": "tv_3k9w2q7x4m1c8v5b", "name": "Living room TV", "email": "anna@acme.com", "memberName": "Anna Smith", "company": {"id": "co_4kq8z2m7x3w9p5n1", "name": "Acme"}}nameis the TV's;memberName(the member's display name, "" when they set none) andemailare who it is signed in as: the TV keeps them with its token and shows them in its Menu ("Signed in as Anna Smith · anna@acme.com"). The TV sendsAuthorization: Bearer <token>from then on (andX-).SpaceBackup- Version: tv- <version> - Errors: 404 →
no such pairing(unknown, or the wrong secret); 410 (withstate) →the code expired; show a new one(expired); 410 →the pairing was declined(denied); 410 →this pairing was already used(taken); 410 →this TV was removed(denied).
POST /api/tv/pair/poll · from openapi.yaml (postTvPairPoll)
| Auth | none |
|---|---|
| Body | application/json TvPairPollpairId string|nullsecret string|null |
| 200 | Waiting: {...} → TvPairPolled {state: string, expires: string(date-time), token?: string|null, deviceId?: string|null, name?: string|null, email?: string|null, memberName?: string|null, company?: TvCompany|null} |
| 400 | Bad Request<name> is required<name> is too long<name> must not contain control characters<name> must be a stringbad request: <the JSON parser's message> |
| 404 | no such pairing (unknown, or the wrong secret); 410 (with state) → the code expired; show a new one (expired);no such pairing |
| 410 | the pairing was declined (denied);the pairing was declinedthis pairing was already usedthe code expired; show a new onethis TV was removed |
curl
# answers 200; errors 400, 404, 410
curl -sS -X POST 'https://spacebackup.net/account/api/tv/pair/poll' \
-H "Content-Type: application/json" \
--data '{"pairId":"tvp_8w2kq4zx7m3c5n9a","secret":"q0Vh3c2v6b1Kx9yQ0d3t8w5r2z7n4m1p6s9u2f5h8j1"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/tv/pair/poll",
method="POST",
data=json.dumps({"pairId": "tvp_8w2kq4zx7m3c5n9a", "secret": "q0Vh3c2v6b1Kx9yQ0d3t8w5r2z7n4m1p6s9u2f5h8j1"}).encode(),
headers={"Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 404, 410
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/tv/pair/poll")!)
req.httpMethod = "POST"
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"pairId":"tvp_8w2kq4zx7m3c5n9a","secret":"q0Vh3c2v6b1Kx9yQ0d3t8w5r2z7n4m1p6s9u2f5h8j1"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 404, 410
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/tv/pair/poll");
req.Content = new StringContent("""{"pairId":"tvp_8w2kq4zx7m3c5n9a","secret":"q0Vh3c2v6b1Kx9yQ0d3t8w5r2z7n4m1p6s9u2f5h8j1"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 404, 410
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/tv/pair/{code}#
What the approving screen shows before Approve: the TV's name and model, when it asked.
- Auth: device token (the iPhone app, a desktop app) or web session; an active member. Not a TV.
- Response: 200
{"code": "K7QM-3XRT", "name": "Fire TV Stick", "model": "AFTSSS", "os": "Fire OS 8 (Android 11)", "version": "tv-1.0.0", "created": "2026-10-27T18:00:00.000+00:00", "expires": "2026-10-27T18:10:00.000+00:00"} - Errors: 404 →
no TV is showing that code; check it, or show a new one on the TV(unknown, expired, already approved or declined); 429 →too many wrong codes; wait a few minutes(10 wrong codes per member and 10 minutes, counting this route, approve and deny); 403 →a TV cannot do this,not an active member of a company.
GET /api/tv/pair/{code} · from openapi.yaml (getTvPairCode)
| Auth | Authorization: Bearer <device token>, or the admin page's web session (cookie sa_session) plus X-CSRF-Token |
|---|---|
| path | code string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | OK → TvPairInfo {code: string, name: string, model: string, os: string, version: string, created: string(date-time), expires: string(date-time)} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | a TV cannot do this, not an active member of a companynot an active member of a companya TV cannot do thismissing CSRF token |
| 404 | no TV is showing that code; check it, or show a new one on the TV (unknown, expired, already approved or declined);no TV is showing that code; check it, or show a new one on the TV |
| 429 | too many wrong codes; wait a few minutes (10 wrong codes per member and 10 minutes, counting this route, approve and deny);too many wrong codes; wait a few minutes |
curl
# answers 200; errors 401, 403, 404, 429
curl -sS -X GET 'https://spacebackup.net/account/api/tv/pair/x_k3xq7m2pa9fz4w8r' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/tv/pair/x_k3xq7m2pa9fz4w8r",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403, 404, 429
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/tv/pair/x_k3xq7m2pa9fz4w8r")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403, 404, 429
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/tv/pair/x_k3xq7m2pa9fz4w8r");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403, 404, 429
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/tv/pair/{code}/approve#
The TV becomes the caller's (their member, their company); its next poll gets its token.
- Auth: as
GET tv/pair/{code}. - Request:
{"name": "Living room TV"}(optional: replaces the TV's own name; at most 64 characters). - Response: 200, the TV:
{"id": "tv_3k9w2q7x4m1c8v5b", "name": "Living room TV", "model": "AFTSSS", "os": "Fire OS 8 (Android 11)", "version": "tv-1.0.0", "email": "anna@acme.com", "created": "2026-10-27T18:01:00.000+00:00", "lastSeen": "2026-10-27T18:01:00.000+00:00", "approvedBy": "anna@acme.com", "approvedVia": "device", "removed": false}approvedVia:device(an app's token) orweb. The owner and admins get a "New TV" notification. - Errors: 404 →
no TV is showing that code; check it, or show a new one on the TV; 429 → `too many wrong codes; wait a few minutes; 403 →a TV cannot do this,not an active member of a company`.
POST /api/tv/pair/{code}/approve · from openapi.yaml (postTvPairCodeApprove)
| Auth | Authorization: Bearer <device token>, or the admin page's web session (cookie sa_session) plus X-CSRF-Token |
|---|---|
| path | code string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json TvPairApprovename string|null |
| 200 | The TV: `approvedVia`: `device` (an app's token) or `web` → TvView {id: string, name: string, model: string, os: string, version: string, email: string, created: string(date-time), lastSeen: string(date-time), approvedBy: string, approvedVia: string, removed: boolean} |
| 400 | Bad Requestbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | a TV cannot do this, not an active member of a companynot an active member of a companya TV cannot do thismissing CSRF token |
| 404 | no TV is showing that code; check it, or show a new one on the TV;no TV is showing that code; check it, or show a new one on the TV |
| 429 | too many wrong codes; wait a few minutes;too many wrong codes; wait a few minutes |
curl
# answers 200; errors 400, 401, 403, 404, 429
curl -sS -X POST 'https://spacebackup.net/account/api/tv/pair/x_k3xq7m2pa9fz4w8r/approve' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"name":"Living room TV"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/tv/pair/x_k3xq7m2pa9fz4w8r/approve",
method="POST",
data=json.dumps({"name": "Living room TV"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404, 429
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/tv/pair/x_k3xq7m2pa9fz4w8r/approve")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"name":"Living room TV"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404, 429
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/tv/pair/x_k3xq7m2pa9fz4w8r/approve");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"name":"Living room TV"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404, 429
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/tv/pair/{code}/deny#
The TV's next poll says declined.
- Auth: as
GET tv/pair/{code}. - Response: 204.
- Errors: 404 →
no TV is showing that code; check it, or show a new one on the TV; 429 → `too many wrong codes; wait a few minutes; 403 →a TV cannot do this,not an active member of a company`.
POST /api/tv/pair/{code}/deny · from openapi.yaml (postTvPairCodeDeny)
| Auth | Authorization: Bearer <device token>, or the admin page's web session (cookie sa_session) plus X-CSRF-Token |
|---|---|
| path | code string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | No Content |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | a TV cannot do this, not an active member of a companynot an active member of a companya TV cannot do thismissing CSRF token |
| 404 | no TV is showing that code; check it, or show a new one on the TV;no TV is showing that code; check it, or show a new one on the TV |
| 429 | too many wrong codes; wait a few minutes;too many wrong codes; wait a few minutes |
curl
# answers 204; errors 401, 403, 404, 429
curl -sS -X POST 'https://spacebackup.net/account/api/tv/pair/x_k3xq7m2pa9fz4w8r/deny' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/tv/pair/x_k3xq7m2pa9fz4w8r/deny",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401, 403, 404, 429
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/tv/pair/x_k3xq7m2pa9fz4w8r/deny")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401, 403, 404, 429
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/tv/pair/x_k3xq7m2pa9fz4w8r/deny");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 401, 403, 404, 429
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/tvs#
The caller's TVs; the owner and admins get the company's.
- Auth: device token or web session; an active member. Not a TV.
- Response: 200, a list of TVs as
POST tv/answers them (not removed ones).pair/ {code}/ approve
GET /api/tvs · from openapi.yaml (getTvs)
| Auth | Authorization: Bearer <device token>, or the admin page's web session (cookie sa_session) plus X-CSRF-Token |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | A list of TVs as `POST tv/pair/{code}/approve` answers them (not removed ones) → array of TvView {id: string, name: string, model: string, os: string, version: string, email: string, created: string(date-time), lastSeen: string(date-time), approvedBy: string, approvedVia: string, removed: boolean} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companya TV cannot do thismissing CSRF token |
curl
# answers 200; errors 401, 403
curl -sS -X GET 'https://spacebackup.net/account/api/tvs' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/tvs",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/tvs")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/tvs");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/tvs/{id}/remove#
Disconnects a TV: its token stops at once, its tickets with it. Its member, the owner or an admin. No key is replaced (a TV never had one).
- Auth: as
GET tvs. - Response: 204.
- Errors: 404 →
no such TV.
POST /api/tvs/{id}/remove · from openapi.yaml (postTvsIdRemove)
| Auth | Authorization: Bearer <device token>, or the admin page's web session (cookie sa_session) plus X-CSRF-Token |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | No Content |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companya TV cannot do thismissing CSRF token |
| 404 | no such TVno such TV |
curl
# answers 204; errors 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/tvs/x_k3xq7m2pa9fz4w8r/remove' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/tvs/x_k3xq7m2pa9fz4w8r/remove",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/tvs/x_k3xq7m2pa9fz4w8r/remove")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/tvs/x_k3xq7m2pa9fz4w8r/remove");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/tv/me#
The TV's own view of itself.
- Auth: the TV's token.
- Response: 200
{"deviceId": "tv_3k9w2q7x4m1c8v5b", "name": "Living room TV", "email": "anna@acme.com", "memberName": "Anna Smith", "active": true, "company": {"id": "co_4kq8z2m7x3w9p5n1", "name": "Acme"}} - Errors: 401 →
this TV was removed; pair it again; 403 →only a TV's own token.
GET /api/tv/me · from openapi.yaml (getTvMe)
| Auth | none |
|---|---|
| 200 | OK → TvMe {deviceId: string, name: string, email: string, active: boolean, company: TvCompany|null, memberName: string} |
| 401 | this TV was removed; pair it again;this TV was removed; pair it again |
| 403 | only a TV's own tokenonly a TV's own token |
curl
# answers 200; errors 401, 403
curl -sS -X GET 'https://spacebackup.net/account/api/tv/me'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/tv/me",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/tv/me")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/tv/me");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/tv/pass#
The PCs the TV can view through, now: its member's own PCs (not phones) that registered a viewer key, most recently
seen first, each with a ticket for 12 hours (the PC asks the service again every 5 minutes, so a removed TV stops at once); and a relay guest pass naming them (relay is null while the company's
relay group is not known yet: then the LAN only). Asked again before expires.
- Auth: the TV's token; its member still active.
- Response: 200
{"expires": "2026-10-28T06:01:00.000+00:00", "pcs": [{"deviceId": "d_4f2a7cqm3xk9wz2b", "name": "ANNA-PC", "label": "Anna's desktop", "os": "Ubuntu 24.04", "version": "0.15.0", "lastSeen": "2026-10-27T18:00:40.000+00:00", "viewerKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…", "ticket": "vt_Q2k8w3m7x1c9v4b6n2z5r8t1h3j7f0p"}], "relay": {"pass": "gp1.Zk2…", "address": "relay.spacebackup.net:47900", "fingerprint": null}, "email": "anna@acme.com", "memberName": "Anna Smith", "languages": ["ru", "en"]}email,memberName: who the TV is signed in as now (the TV refreshes its Menu's "Signed in as" from them).languages: the member's languages (me/settings, up to 3); the TV apps' own screens and the TV page are in the first;[]when none is picked (the TV's own). Menu → Language on the TV writes them with PUT /api/tv/languages.guests: per company whose albums the member is a guest of (an accepted invitation, Guests), the PCs of that company keeping them that serve TVs (a viewer key), each with a guest ticket (vg_…, 12 hours) and the ids of those albums on it, and a relay guest pass for that company's group naming only those PCs (null while that company's relay group is not known yet). Empty when there are none (older services leave it out)."guests": [{"id": "c_globex", "name": "Globex", "pcs": [{"deviceId": "d_7h2k…", "name": "GINA-PC", "label": null, "os": "Ubuntu 24.04", "version": "0.16.15", "lastSeen": "…", "viewerKey": "MFkw…", "ticket": "vg_Lw3k…", "albums": ["al_lisbon…"]}], "relay": {"pass": "gp1.Rt8…", "address": "relay.spacebackup.net:47900", "fingerprint": null}}]viewerKey: the P-256 SubjectPublicKeyInfo (base64) of the PC's TLS certificate: the TV accepts that PC only with that key.relay.pass: hello as a guest (hello {guest, instanceId, machine, version}), which sees and reaches only these PCs;fingerprint: a self-signed relay's certificate SHA-256 (tests), null for the real relay. - Errors: 401 →
this TV was removed; pair it again; 403 →not an active member of a company any more.
POST /api/tv/pass · from openapi.yaml (postTvPass)
| Auth | none |
|---|---|
| 200 | `email`, `memberName`: who the TV is signed in as now (the TV refreshes its Menu's "Signed in as" from them). `languages`: the member's languages (me/settings, up to 3) → TvPassView {expires: string(date-time), pcs: TvPcView[], relay: TvRelayView|null, email: string, memberName: string, languages: string[], guests: TvGuestCompanyView[]} |
| 401 | this TV was removed; pair it again;this TV was removed; pair it again |
| 403 | not an active member of a company any morenot an active member of a company any morethis TV belongs to another companyonly a TV's own token |
curl
# answers 200; errors 401, 403
curl -sS -X POST 'https://spacebackup.net/account/api/tv/pass'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/tv/pass",
method="POST",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/tv/pass")!)
req.httpMethod = "POST"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/tv/pass");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");PUT /api/tv/languages#
The TV's Menu → Language picker writes its member's languages (2026-11-05: the account's language wins, never the
device's). The same as PUT /api/me/settings languages for the TV's member, and only that.
- Auth: the TV's own token (
tvt_…), its member still an active member of the TV's company. - Request:
{"languages": ["de", "ru"]}: 1 to 3 codes, no repeats (case and a region tag are ignored);[]clears them; required. The picker sends the chosen language first and the member's others after it, at most 3. Its Automatic sends nothing (the TV follows the member's first language). - Response: 200
{"languages": ["de", "ru"]}, the member's languages as stored. - Pushes: as me/settings: every device of the member gets
settings(silent), and when the company's languages change with it, every device of the company getslanguages. - Errors: 400 →
languages is required,unknown language "ko" (one of en, fr, …),"ru" is given twice, `at most 3 languages a member. 401 →this TV was removed; pair it again. 403 →only a TV's own token` (a guest's, a phone's or a PC's token),not an active member of a company any more,this TV belongs to another company.
PUT /api/tv/languages · from openapi.yaml (putTvLanguages)
| Auth | none |
|---|---|
| Body | application/json TvLanguagesRequestlanguages string[] |
| 200 | The member's languages as stored → TvLanguagesView {languages: string[]} |
| 400 | languages is required, unknown language "ko" (one of en, fr, …), "ru" is given twice, at most 3 languages a memberlanguages is requiredbad request: <the JSON parser's message> |
| 401 | this TV was removed; pair it againthis TV was removed; pair it again |
| 403 | only a TV's own token (a guest's, a phone's or a PC's token), not an active member of a company any more, this TV belongs to another companynot an active member of a company any morethis TV belongs to another companyonly a TV's own token |
curl
# answers 200; errors 400, 401, 403
curl -sS -X PUT 'https://spacebackup.net/account/api/tv/languages' \
-H "Content-Type: application/json" \
--data '{"languages":["de","ru"]}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/tv/languages",
method="PUT",
data=json.dumps({"languages": ["de", "ru"]}).encode(),
headers={"Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/tv/languages")!)
req.httpMethod = "PUT"
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"languages":["de","ru"]}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Put, "https://spacebackup.net/account/api/tv/languages");
req.Content = new StringContent("""{"languages":["de","ru"]}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/tv/signout#
The TV disconnects itself (its Sign out): as POST tvs/{id}/remove.
- Auth: the TV's token.
- Response: 204.
POST /api/tv/signout · from openapi.yaml (postTvSignout)
| Auth | none |
|---|---|
| 204 | No Content |
| 401 | Unauthorizedthis TV was removed; pair it again |
| 403 | Forbiddenonly a TV's own token |
curl
# answers 204; errors 401, 403
curl -sS -X POST 'https://spacebackup.net/account/api/tv/signout'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/tv/signout",
method="POST",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/tv/signout")!)
req.httpMethod = "POST"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/tv/signout");
using var res = await http.SendAsync(req); // answers 204; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/devices/viewer-key#
A PC registers its viewer key: the P-256 key of the self-signed TLS certificate it serves the TV app with (made once, kept with the PC's identity). Sent at each start; unchanged keys change nothing.
- Auth: registered device (a PC).
- Request:
{"publicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…"} - Response: 204.
- Errors: 400 →
publicKey must be a base64 P-.256 SubjectPublicKeyInfo
POST /api/devices/viewer-key · from openapi.yaml (postDevicesViewerKey)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json ViewerKeyRequestpublicKey string|null |
| 204 | No Content |
| 400 | publicKey must be a base64 P-256 SubjectPublicKeyInfopublicKey must be a base64 P-256 SubjectPublicKeyInfo<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
curl
# answers 204; errors 400, 401, 403
curl -sS -X POST 'https://spacebackup.net/account/api/devices/viewer-key' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"publicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/viewer-key",
method="POST",
data=json.dumps({"publicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/viewer-key")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"publicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/devices/viewer-key");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"publicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/tv-tickets/check#
A PC asks whether a TV's ticket lets it view through this PC now.
- Auth: registered device of the same company (the PC the ticket was made for).
- Request:
{"ticket": "vt_Q2k8w3m7x1c9v4b6n2z5r8t1h3j7f0p"} - Response: 200
{"tvDevice": "tv_3k9w2q7x4m1c8v5b", "tvName": "Living room TV", "email": "anna@acme.com", "expires": "2026-10-28T06:01:00.000+00:00"}access:member(the PC's own member's TV: it sees what that PC's Photos shows). A guest ticket (vg_…, fromguestsintv/pass) is confirmed only when the request has"guests": true(the PC shows a guest TV its albums alone; an older PC, which would not, gets 404) and answersaccess: "guest", the TV's member's owncompany, andalbums: the albums of this PC's company kept on this PC that the TV's member is a guest of now (`{id, name, ownerEmail, ownerName, itemCount, cover, dests}`); the PC shows that TV those albums only, read-only.PCs cache a yes for 5 minutes (never past
expires) and ask again after that, so a removed TV is cut off within 5 minutes. - Errors: 404 →
no TV may view through this PC with that ticket(unknown or expired, made for another PC, the TV removed, its member no longer active or not this PC's member; a guest ticket: no album of this PC's company kept on this PC that the member is still a guest of).
POST /api/tv-tickets/check · from openapi.yaml (postTvTicketsCheck)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json TvTicketCheckticket string|nullguests boolean|null |
| 200 | `access`: `member` (the PC's own member's TV: it sees what that PC's Photos shows) → TvTicketCheckView {tvDevice: string, tvName: string, email: string, expires: string(date-time), access: string, albums?: TvGuestAlbumView[], company?: string|null} |
| 400 | Bad Request<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
| 404 | no TV may view through this PC with that ticket (unknown or expired, made for another PC, the TV removed, its member no longer active or not this PC's member; a guest ticket: no album of this PC's company kept on this PC that the member is still a guest of) |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/tv-tickets/check' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"ticket":"vt_Q2k8w3m7x1c9v4b6n2z5r8t1h3j7f0p"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/tv-tickets/check",
method="POST",
data=json.dumps({"ticket": "vt_Q2k8w3m7x1c9v4b6n2z5r8t1h3j7f0p"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/tv-tickets/check")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"ticket":"vt_Q2k8w3m7x1c9v4b6n2z5r8t1h3j7f0p"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/tv-tickets/check");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"ticket":"vt_Q2k8w3m7x1c9v4b6n2z5r8t1h3j7f0p"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/tv/voice/wait#
What was said to the Alexa skill for this TV: a long poll the TV app keeps open while it is on the screen. The service holds the request up to 25 seconds and answers as soon as a sentence comes; the TV asks again at once. A newer wait of the same TV ends the older one (204). A TV that waited within the last 40 seconds counts as having Space Backup open; the most recent of the member's TVs gets the words. Sentences are kept in memory only, 10 seconds at most, never logged.
- Auth: the TV's token.
- Response: 200
{"id": "tvv_, or 204 when nothing came. The TV puts5k2m9x7q3w1c8v4b", "text": "show our Chicago 2026 photos", "via": "alexa"} textto its page as if said into the remote: the PC's assistant (POST /api/tvassistanton the PC, the phone's plan) and what it names opened. - Errors: 403 →
for a TV's token only.
POST /api/tv/voice/wait · from openapi.yaml (postTvVoiceWait)
| Auth | none |
|---|---|
| 200 | Or 204 when nothing came |
| 204 | 200 {...}, or 204 when nothing came |
| 403 | for a TV's token onlyfor a TV's token only |
curl
# answers 200, 204; errors 403
curl -sS -X POST 'https://spacebackup.net/account/api/tv/voice/wait'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/tv/voice/wait",
method="POST",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200, 204; errors 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/tv/voice/wait")!)
req.httpMethod = "POST"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200, 204; errors 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/tv/voice/wait");
using var res = await http.SendAsync(req); // answers 200, 204; errors 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/tv/changed/wait#
The changed pushes for a TV: a Fire TV has no Google Play services, so FCM cannot reach it, and the
TV app keeps this long poll open while it is on the screen instead. The service holds the request up to 25 seconds and
answers as soon as something its member's devices are pushed changes (the same topics, coalesced the same way;
forms excepted); the TV asks again at once and re-reads those parts (tv/pass, and its page's
window.tvChanged(topics)). A newer wait of the same TV ends the older one (204). Changes are queued for a TV only while
it listens (a wait open, or one ended within the last 40 seconds); a TV not open gets nothing and reads everything when
it opens. Kept in memory only.
- Auth: the TV's token.
- Response: 200
{"changed": ["albums", "album:al_(5k2m9x7q3w1c8v4b"], "v": null} v: the #70 change counter per versioned topic, as in the push), or 204 when nothing changed. - Errors: 403 →
for a TV's token only; 401 →this TV was removed; pair it again.
POST /api/tv/changed/wait · from openapi.yaml (postTvChangedWait)
| Auth | none |
|---|---|
| 200 | (`v`: the #70 change counter per versioned topic, as in the push), or 204 when nothing changed |
| 204 | 200 {...} (`v`: the #70 change counter per versioned topic, as in the push), or 204 when nothing changed |
| 401 | this TV was removed; pair it againthis TV was removed; pair it again |
| 403 | for a TV's token only;for a TV's token onlyonly a TV's own token |
curl
# answers 200, 204; errors 401, 403
curl -sS -X POST 'https://spacebackup.net/account/api/tv/changed/wait'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/tv/changed/wait",
method="POST",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200, 204; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/tv/changed/wait")!)
req.httpMethod = "POST"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200, 204; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/tv/changed/wait");
using var res = await http.SendAsync(req); // answers 200, 204; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Alexa skill#
"Alexa, show our Chicago 2026 photos in Space Backup" (docs/tv.md,
"Alexa"): a custom Alexa skill whose endpoint is this service (no AWS Lambda). Account linking is the remote MCP's
OAuth (Remote MCP) with the fixed client space-backup-alexa (settings alexa.clientId): a public
client (PKCE S256 required, the secret Amazon sends not checked), or, when the service has SPACEBACKUP_
in its environment, a confidential one (that secret checked at oauth/token, PKCE optional); the redirect URIs are Amazon's three for each vendor id in
alexa.vendorIds (https:/, layla.amazon.com, alexa.amazon.co.jp);
none configured: the client does not exist. The consent page is "Link Alexa to Space Backup?" with Link account
(scope read); refresh tokens last a year. The skill's access token is refused by /account/mcp.
POST /alexa#
The skill's endpoint (the developer console's Endpoint, HTTPS, "a certificate from a trusted certificate authority").
Every request is checked as Amazon requires before anything else: SignatureCertChainUrl is https, host
s3.amazonaws.com, port 443, a path under /echo.api/ once normalized; the chain there (kept 12 hours) is valid now,
its leaf names echo-api.amazon.com and it leads to a trusted root; Signature-256 is the RSA SHA-256 signature of the
body by that leaf; request.timestamp is within 150 seconds; the skill id is one of alexa.skillIds.
- Auth: Amazon's signature; the member is the one the request's
context.was issued to.System. user. accessToken - Request: Alexa's request envelope (
LaunchRequest,IntentRequestwithShowIntentorPlayIntentand the slotquery,AMAZON.HelpIntent,AMAZON.StopIntent,AMAZON.CancelIntent,AMAZON.FallbackIntent,AMAZON.,NavigateHomeIntent SessionEndedRequest). - Response: 200, Alexa's response envelope:
{"version": "1.0", "response": {"shouldEndSession": true, "outputSpeech": {"type": "PlainText", "text": "Here it is, on Living room TV."}}}ShowIntentsends "show <query>",PlayIntent"play <query>" to the member's TV that has Space Backup open (POST /api/tv/voice/wait) and waits up to 4 seconds for it to take the words. Said instead: not linked (with aLinkAccountcard), no TV paired, Space Backup not open on the TV, the TV did not take it yet, not in a company, too many requests (20 a minute, 300 a day per member). Logged with the number of characters, never the words. - Errors: 400 →
not a request of this skill(not Amazon's, or not this skill's: the reason is in the service's log); 413 →the request is larger than 128 KB.
POST /alexa · from openapi.yaml (postAlexa)
| Auth | none |
|---|---|
| 200 | Alexa's response envelope: `ShowIntent` sends "show <query>", `PlayIntent` "play <query>" to the member's TV that has Space Backup open (POST /api/tv/voice/wait) and waits up to 4 seconds for it to take the words |
| 400 | not a request of this skill (not Amazon's, or not this skill's: the reason is in the service's log);not a request of this skill |
| 413 | the request is larger than 128 KBthe request is larger than 128 KB |
curl
# answers 200; errors 400, 413
curl -sS -X POST 'https://spacebackup.net/account/alexa'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/alexa",
method="POST",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 413
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/alexa")!)
req.httpMethod = "POST"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 413
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/alexa");
using var res = await http.SendAsync(req); // answers 200; errors 400, 413
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Albums#
An album is a plain copy of chosen photos and videos, kept on one or more destinations of the company's PCs that the owner picks. The service keeps the album's name, owner, members, drives and item count; the files are on the PCs. See Albums and Sharing albums.
Who sees an album: its owner, the members it is shared with, and the company's owner and admins. Anyone else gets 404.
POST /api/albums#
- Auth: active member (the caller becomes the owner).
- Request:
{"name": "Las Vegas", "destinations": [{"device": "d_4f2a7cqm3xk9wz2b", "dest": "e3b0c442", "label": "Backup disk"}]}name: 1–100 characters.destinations? (at most 8): eachdevicean active device of the company,destthat PC's destination id (up to 200 characters),label? shown to people (cut at 200 characters).public? (bool, iOS request #42):truemakes the calling device's Shared publicly album, where the phone puts the plain copies it makes for public links itself (no key is lent). One per device: its name is alwaysShared publicly(nameis ignored and may be left out), and when the device has one already that album is answered as it is (200; itsdestinationsare not changed). The Album then has"public": trueand"publicDevice": "<the device's name>". It cannot be renamed (400); otherwise it is an album like any other (destinations, cover, delete; after a delete the next{"public": true}makes a new one).{"public": true, "destinations": [{"device": "d_4f2a7cqm3xk9wz2b", "dest": "e3b0c442"}]} - Response: 201 Album; 200 for a device's existing public album.
- Errors: 400 →
name is required,name is too long,at most 8 destinations per album. 404 →no such device.
POST /api/albums · from openapi.yaml (postAlbums)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumCreatename string|nulldestinations AlbumDestinationSet[]public boolean|null |
| 200 | For a device's existing public album → AlbumView {id: string, name: string, ownerEmail: string, mine: boolean, created: string(date-time), updated: string(date-time), itemCount: integer, destinations: AlbumDestinationView[], members: AlbumMemberView[], ownerName?: string|null, membersCanAdd: boolean, faces: boolean, cover: string|null, filter: AlbumFilter|null, invited: AlbumInvitedView[], shown: boolean, public?: boolean, publicDevice?: string|null, archived?: string(date-time)|null, mergedFrom?: string[], deletedAt?: string(date-time)|null, deletedBy?: string|null, deletedByName?: string|null, purgeAt?: string(date-time)|null} |
| 201 | Album → AlbumView {id: string, name: string, ownerEmail: string, mine: boolean, created: string(date-time), updated: string(date-time), itemCount: integer, destinations: AlbumDestinationView[], members: AlbumMemberView[], ownerName?: string|null, membersCanAdd: boolean, faces: boolean, cover: string|null, filter: AlbumFilter|null, invited: AlbumInvitedView[], shown: boolean, public?: boolean, publicDevice?: string|null, archived?: string(date-time)|null, mergedFrom?: string[], deletedAt?: string(date-time)|null, deletedBy?: string|null, deletedByName?: string|null, purgeAt?: string(date-time)|null} |
| 400 | name is required, name is too long, at most 8 destinations per album<name> is required<name> is too long<name> must not contain control charactersat most 8 destinations per albumbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
| 404 | no such deviceno such device |
curl
# answers 200, 201; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"name":"Las Vegas","destinations":[{"device":"d_4f2a7cqm3xk9wz2b","dest":"e3b0c442","label":"Backup disk"}]}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums",
method="POST",
data=json.dumps({"name": "Las Vegas", "destinations": [{"device": "d_4f2a7cqm3xk9wz2b", "dest": "e3b0c442", "label": "Backup disk"}]}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200, 201; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"name":"Las Vegas","destinations":[{"device":"d_4f2a7cqm3xk9wz2b","dest":"e3b0c442","label":"Backup disk"}]}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200, 201; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"name":"Las Vegas","destinations":[{"device":"d_4f2a7cqm3xk9wz2b","dest":"e3b0c442","label":"Backup disk"}]}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200, 201; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/albums#
Lists the caller's albums: their own, and the albums shared with them (shared with me).
- Auth: active member.
- Response: 200
[Album]: the caller's own albums first, then those shared with them, by name.
GET /api/albums · from openapi.yaml (getAlbums)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | `[Album]`: the caller's own albums first, then those shared with them, by name → array of AlbumView {id: string, name: string, ownerEmail: string, mine: boolean, created: string(date-time), updated: string(date-time), itemCount: integer, destinations: AlbumDestinationView[], members: AlbumMemberView[], ownerName?: string|null, membersCanAdd: boolean, faces: boolean, cover: string|null, filter: AlbumFilter|null, invited: AlbumInvitedView[], shown: boolean, public?: boolean, publicDevice?: string|null, archived?: string(date-time)|null, mergedFrom?: string[], deletedAt?: string(date-time)|null, deletedBy?: string|null, deletedByName?: string|null, purgeAt?: string(date-time)|null} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
curl
# answers 200; errors 401, 403
curl -sS -X GET 'https://spacebackup.net/account/api/albums' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/albums");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/albums/{id}#
- Auth: active member who may see it.
- Response: 200 Album.
- Errors: 404 →
no such album.
GET /api/albums/{id} · from openapi.yaml (getAlbumsId)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | Album → AlbumView {id: string, name: string, ownerEmail: string, mine: boolean, created: string(date-time), updated: string(date-time), itemCount: integer, destinations: AlbumDestinationView[], members: AlbumMemberView[], ownerName?: string|null, membersCanAdd: boolean, faces: boolean, cover: string|null, filter: AlbumFilter|null, invited: AlbumInvitedView[], shown: boolean, public?: boolean, publicDevice?: string|null, archived?: string(date-time)|null, mergedFrom?: string[], deletedAt?: string(date-time)|null, deletedBy?: string|null, deletedByName?: string|null, purgeAt?: string(date-time)|null} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
| 404 | no such albumno such album |
curl
# answers 200; errors 401, 403, 404
curl -sS -X GET 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}#
Changes an album. Every field is optional; a field left out stays.
- Auth: the album's owner. Exception:
{"itemCount", "removed"?}alone is also accepted from a device that holds one of the album's drives (registered, not removed; whoever signed it in), so the PCs keep the count right after members' adds. - Request:
Field Type Meaning name?string rename (1–100 characters) itemCount?int the number of items now (0–10,000,000) membersCanAdd?bool the members may add their own photos and remove what they added. It sets everyone at once: each person's own setting (shares/can-add) is cleared, so all follow it cover?string or null an item id of the album (up to 200 characters) as cover; nullor""clears it (the newest item)faces?bool recognise faces in the album's photos (on the company's PCs); may go with nameandmembersCanAddin the same requestremoved?[string] item ids just removed (with itemCount; at most 10,000): the cover among them is cleared, and their remove requests are done{"membersCanAdd": true, "cover": "2026-10-14/IMG_0412.HEIC"} - Response: 200 Album.
- Errors: 400 →
itemCount out of range,too many removed ids,cover too long,cover must be an item id or null,the Shared publicly album keeps its name. 403 →only the album's owner can change it(members and admins too). 404 →no such album.
POST /api/albums/{id} · from openapi.yaml (postAlbumsId)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumUpdatename string|null · rename (1–100 characters)itemCount integer|null · the number of items now (0–10,000,000)membersCanAdd boolean|null · the members may add their own photos and remove what they added. It sets everyone at once: each person's own setting (shares/can-add) is cleared, so all follow itcover any · an item id of the album (up to 200 characters) as cover; `null` or `""` clears it (the newest item)removed string[] · item ids just removed (with `itemCount`; at most 10,000): the cover among them is cleared, and their remove requests are donefaces boolean|null · recognise faces in the album's photos (on the company's PCs); may go with `name` and `membersCanAdd` in the same request |
| 200 | Album → AlbumView {id: string, name: string, ownerEmail: string, mine: boolean, created: string(date-time), updated: string(date-time), itemCount: integer, destinations: AlbumDestinationView[], members: AlbumMemberView[], ownerName?: string|null, membersCanAdd: boolean, faces: boolean, cover: string|null, filter: AlbumFilter|null, invited: AlbumInvitedView[], shown: boolean, public?: boolean, publicDevice?: string|null, archived?: string(date-time)|null, mergedFrom?: string[], deletedAt?: string(date-time)|null, deletedBy?: string|null, deletedByName?: string|null, purgeAt?: string(date-time)|null} |
| 400 | itemCount out of range, too many removed ids, cover too long, cover must be an item id or null, the Shared publicly album keeps its nameitemCount out of rangetoo many removed idsthe <publicAlbumName> album keeps its name<name> is required<name> is too long<name> must not contain control characterscover too longcover must be an item id or nullbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the album's owner can change it (members and admins too)not an active member of a companyonly the album's owner can change it |
| 404 | no such albumno such album |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"membersCanAdd":true,"cover":"2026-10-14/IMG_0412.HEIC"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c",
method="POST",
data=json.dumps({"membersCanAdd": True, "cover": "2026-10-14/IMG_0412.HEIC"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"membersCanAdd":true,"cover":"2026-10-14/IMG_0412.HEIC"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"membersCanAdd":true,"cover":"2026-10-14/IMG_0412.HEIC"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}/destinations#
Replaces the list of drives the album is kept on. The phone then asks a PC holding the album to copy it to the new drives.
- Auth: the album's owner.
- Request:
{"destinations": [{"device", "dest", "label"?}]}, as inPOST /api/albums(at most 8). - Response: 200 Album.
- Errors: 400 →
at most 8 destinations per album. 403 → not the owner. 404 →no such album,no such device.
POST /api/albums/{id}/destinations · from openapi.yaml (postAlbumsIdDestinations)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumDestinationsRequestdestinations AlbumDestinationSet[] |
| 200 | Album → AlbumView {id: string, name: string, ownerEmail: string, mine: boolean, created: string(date-time), updated: string(date-time), itemCount: integer, destinations: AlbumDestinationView[], members: AlbumMemberView[], ownerName?: string|null, membersCanAdd: boolean, faces: boolean, cover: string|null, filter: AlbumFilter|null, invited: AlbumInvitedView[], shown: boolean, public?: boolean, publicDevice?: string|null, archived?: string(date-time)|null, mergedFrom?: string[], deletedAt?: string(date-time)|null, deletedBy?: string|null, deletedByName?: string|null, purgeAt?: string(date-time)|null} |
| 400 | at most 8 destinations per albumat most 8 destinations per album<name> is required<name> is too long<name> must not contain control characters<name> must be a stringbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | not the owneronly the album's owner can change itnot an active member of a company |
| 404 | no such album, no such deviceno such albumno such device |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/destinations' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"destinations":[{"device":null,"dest":null,"label":null}]}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/destinations",
method="POST",
data=json.dumps({"destinations": [{"device": None, "dest": None, "label": None}]}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/destinations")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"destinations":[{"device":null,"dest":null,"label":null}]}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/destinations");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"destinations":[{"device":null,"dest":null,"label":null}]}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}/delete#
Deletes the album, kept 30 days in Recently deleted (GET /api/albums/deleted): it leaves
every list (the owner's, its members' and guests', the sync's albums), its tickets and pending album-add pushes go,
open remove requests are resolved, whole-album public links stop serving and open invitations are hidden. Its members
and guests (with their own settings), invitations, name, cover, settings, filter, drives and links are kept for
restore. After 30 days the service ends it for good (as
purge). The PCs move their copies to their drives' deleted area (peer request
album.delete, sent by the owner's device).
- Auth: the album's owner or an owner/admin of the company.
- Request: no body.
- Response: 204.
- Errors: 403 →
only the album's owner or an admin can delete it. 404 →no such album.
POST /api/albums/{id}/delete · from openapi.yaml (postAlbumsIdDelete)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | No Content |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the album's owner or an admin can delete itonly the album's owner or an admin can delete itnot an active member of a company |
| 404 | no such albumno such album |
curl
# answers 204; errors 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/delete' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/delete",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/delete")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/delete");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/albums/deleted#
Recently deleted: the caller's own albums deleted in the last 30 days, and those they deleted as an admin, newest first.
- Auth: an active member.
- Response:
[Album], each as its owner sees it (members, invited, destinations), plusdeletedAt(when),deletedBy(the email of who deleted it),deletedByName(their display name, when they have one) andpurgeAt(deletedAt+ 30 days: when it goes for good).[]when none.
GET /api/albums/deleted · from openapi.yaml (getAlbumsDeleted)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | OK → array of AlbumView {id: string, name: string, ownerEmail: string, mine: boolean, created: string(date-time), updated: string(date-time), itemCount: integer, destinations: AlbumDestinationView[], members: AlbumMemberView[], ownerName?: string|null, membersCanAdd: boolean, faces: boolean, cover: string|null, filter: AlbumFilter|null, invited: AlbumInvitedView[], shown: boolean, public?: boolean, publicDevice?: string|null, archived?: string(date-time)|null, mergedFrom?: string[], deletedAt?: string(date-time)|null, deletedBy?: string|null, deletedByName?: string|null, purgeAt?: string(date-time)|null} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
curl
# answers 200; errors 401, 403
curl -sS -X GET 'https://spacebackup.net/account/api/albums/deleted' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/deleted",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/deleted")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/albums/deleted");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}/restore#
Put back: a recently deleted album returns exactly as it was: its members and guests with their own canAdd and
shown, open invitations, name, cover, membersCanAdd, faces, filter, drives and public links. The owner's, members'
and guests' devices get changed: ["albums", "album:<id>"], invitees' ["invitations"]. Remove requests resolved by the
delete do not come back. The apps then send album.restore to the album's PCs.
- Auth: the album's owner, the admin who deleted it, or an owner/admin of the company.
- Request: no body.
- Response: the Album.
- Errors: 404 →
no such deleted album(not deleted, deleted more than 30 days ago, deleted permanently, unknown). 409 →that device has a new Shared publicly album since(a device's public album, when it made a new one).
POST /api/albums/{id}/restore · from openapi.yaml (postAlbumsIdRestore)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | OK → AlbumView {id: string, name: string, ownerEmail: string, mine: boolean, created: string(date-time), updated: string(date-time), itemCount: integer, destinations: AlbumDestinationView[], members: AlbumMemberView[], ownerName?: string|null, membersCanAdd: boolean, faces: boolean, cover: string|null, filter: AlbumFilter|null, invited: AlbumInvitedView[], shown: boolean, public?: boolean, publicDevice?: string|null, archived?: string(date-time)|null, mergedFrom?: string[], deletedAt?: string(date-time)|null, deletedBy?: string|null, deletedByName?: string|null, purgeAt?: string(date-time)|null} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
| 404 | no such deleted album (not deleted, deleted more than 30 days ago, deleted permanently, unknown)no such deleted album |
| 409 | that device has a new Shared publicly album since (a device's public album, when it made a new one)that device has a new <publicAlbumName> album since |
curl
# answers 200; errors 401, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/restore' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/restore",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/restore")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/restore");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}/purge#
Delete permanently: a live or a recently deleted album ends for good at once (it cannot be put back). Its members,
guests and drives go, open invitations are withdrawn, whole-album public links revoked. A relay ticket of it still
answers deleted: true, so a PC's waiting delete job runs.
- Auth: the album's owner or an owner/admin of the company (a recently deleted one: as for restore).
- Request: no body.
- Response: 204.
- Errors: 403 →
only the album's owner or an admin can delete it. 404 →no such album,no such deleted album.
POST /api/albums/{id}/purge · from openapi.yaml (postAlbumsIdPurge)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | No Content |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the album's owner or an admin can delete itonly the album's owner or an admin can delete itnot an active member of a company |
| 404 | no such album, no such deleted albumno such albumno such deleted album |
curl
# answers 204; errors 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/purge' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/purge",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/purge")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/purge");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}/archive#
Archives the album for its owner: it leaves the album list on all of the owner's devices and is listed under
Albums › Archived (archived in the owner's Album and the sync's Album briefs). Everything else stays:
its items, drives, members (to whom it is an ordinary album), tickets and links. The owner's devices get
changed: ["albums", "album:<id>"].
- Auth: the album's owner.
- Request: no body.
- Response: the Album (with
archived; asked again, as it is). - Errors: 403 →
only the album's owner can archive it. 404 →no such album.
POST /api/albums/{id}/archive · from openapi.yaml (postAlbumsIdArchive)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | OK → AlbumView {id: string, name: string, ownerEmail: string, mine: boolean, created: string(date-time), updated: string(date-time), itemCount: integer, destinations: AlbumDestinationView[], members: AlbumMemberView[], ownerName?: string|null, membersCanAdd: boolean, faces: boolean, cover: string|null, filter: AlbumFilter|null, invited: AlbumInvitedView[], shown: boolean, public?: boolean, publicDevice?: string|null, archived?: string(date-time)|null, mergedFrom?: string[], deletedAt?: string(date-time)|null, deletedBy?: string|null, deletedByName?: string|null, purgeAt?: string(date-time)|null} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the album's owner can archive itonly the album's owner can archive itnot an active member of a company |
| 404 | no such albumno such album |
curl
# answers 200; errors 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/archive' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/archive",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/archive")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/archive");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}/unarchive#
Unarchive: the album is back in the owner's album list (archived absent).
- Auth: the album's owner.
- Request: no body.
- Response: the Album.
- Errors: 403 →
only the album's owner can archive it. 404 →no such album.
POST /api/albums/{id}/unarchive · from openapi.yaml (postAlbumsIdUnarchive)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | OK → AlbumView {id: string, name: string, ownerEmail: string, mine: boolean, created: string(date-time), updated: string(date-time), itemCount: integer, destinations: AlbumDestinationView[], members: AlbumMemberView[], ownerName?: string|null, membersCanAdd: boolean, faces: boolean, cover: string|null, filter: AlbumFilter|null, invited: AlbumInvitedView[], shown: boolean, public?: boolean, publicDevice?: string|null, archived?: string(date-time)|null, mergedFrom?: string[], deletedAt?: string(date-time)|null, deletedBy?: string|null, deletedByName?: string|null, purgeAt?: string(date-time)|null} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the album's owner can archive itonly the album's owner can archive itnot an active member of a company |
| 404 | no such albumno such album |
curl
# answers 200; errors 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/unarchive' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/unarchive",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/unarchive")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/unarchive");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/merge#
Merges two of the caller's albums (Vladimir, 2026-11-08; docs/albums.md "Merging two albums"): a new album of the
caller's, unshared, with the first album's cover and faces setting, the first album's drives then the second's (at
most 8) and mergedFrom [first, second]; both albums are archived. One transaction. The service holds no items:
the app then sends the peer request album.merge to a PC holding both albums, which copies every item of the first and
the second into the new album, duplicates once. Undo: unarchive both, then
delete the new one. The caller's devices get `changed: ["albums", "album:<first>",
"album:<second>"]`.
- Auth: an active member, the owner of both albums.
- Request:
{"albums": ["al_(…", "al_ …"], "name": "Barcelona + Paris", "destinations"?: [{"device", "dest", "label"?}]} name1–100 characters;destinationsas in POST /api/albums, default the albums' own). - Response: 201
{"album": Album, "archived": [Album, Album]}: the new Album, then the two merged ones as they are now. - Errors: 400 →
merge two different albums,the Shared publicly album cannot be merged,name …, `at most 8 destinations per album. 403 →only albums you own can be merged. 404 →no such album,no such device`.
POST /api/albums/merge · from openapi.yaml (postAlbumsMerge)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumMergeRequestalbums string|null[]name string|nulldestinations AlbumDestinationSet[] |
| 201 | The new Album, then the two merged ones as they are now → AlbumMergeView {album: AlbumView, archived: AlbumView[]} |
| 400 | merge two different albums, the Shared publicly album cannot be merged, name …, at most 8 destinations per albummerge two different albumsthe <publicAlbumName> album cannot be merged<name> is required<name> is too long<name> must not contain control charactersat most 8 destinations per album<name> must be a stringbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only albums you own can be mergedonly albums you own can be mergednot an active member of a company |
| 404 | no such album, no such deviceno such albumno such device |
curl
# answers 201; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/merge' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"albums":["al_x7k2mq9pa4zw3n5c"],"name":"Chicago trip","destinations":[{"device":null,"dest":null,"label":null}]}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/merge",
method="POST",
data=json.dumps({"albums": ["al_x7k2mq9pa4zw3n5c"], "name": "Chicago trip", "destinations": [{"device": None, "dest": None, "label": None}]}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 201; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/merge")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"albums":["al_x7k2mq9pa4zw3n5c"],"name":"Chicago trip","destinations":[{"device":null,"dest":null,"label":null}]}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 201; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/merge");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"albums":["al_x7k2mq9pa4zw3n5c"],"name":"Chicago trip","destinations":[{"device":null,"dest":null,"label":null}]}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 201; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}/shares#
Shares the album with people.
- Auth: the album's owner or an owner/admin.
- Request:
{"email": "bob@acme., orcom"} {"emails": ["bob@acme.(up to 100, for a group). Withcom", "zoe@acme. com", "carol@example. org"]} emailsit is all or none: the first address that fails answers its error and nothing is shared. - What happens per address:
- an
activeorinvitedmember of the company → added at once; mailed ("anna@acme.com shared the album Las Vegas with you"), asharednotification and a push to their phones. Unless they turned offautoAcceptCompany: then an invitation, as for someone outside (ininvited, a push "Anna Smith invited you to a shared album" withinvite, a mail pointing to the app and/account/me); trusted senders do not apply. An open (pending or declined) invitation is accepted with it when they accept at once again; - an address at the company's own domain that is not a member → 404 (they should join the company, not be its guest);
- anyone else (another company, or none) → an invitation, listed in the album's
invited(see Invitations & guests); or a guest at once when they trust the sender.
- an
- Response: 201 Album when anyone was added or invited; 200 when everyone had it already (or an invitation was open: pending or declined; sharing again does not ask again).
- Errors: 400 →
the album is already anna@acme.,com's emails must not be empty,too many emails (at most 100),not a valid email address. 403 →only the album's owner or an admin can share it. 404 →no such album,bob@acme.. 429 →com is not a member of your company (invite them to the company first) too many invitations today (at most 200 a day).
POST /api/albums/{id}/shares · from openapi.yaml (postAlbumsIdShares)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumShareRequestemail string|nullemails string[] |
| 200 | When everyone had it already (or an invitation was open: pending or declined → AlbumView {id: string, name: string, ownerEmail: string, mine: boolean, created: string(date-time), updated: string(date-time), itemCount: integer, destinations: AlbumDestinationView[], members: AlbumMemberView[], ownerName?: string|null, membersCanAdd: boolean, faces: boolean, cover: string|null, filter: AlbumFilter|null, invited: AlbumInvitedView[], shown: boolean, public?: boolean, publicDevice?: string|null, archived?: string(date-time)|null, mergedFrom?: string[], deletedAt?: string(date-time)|null, deletedBy?: string|null, deletedByName?: string|null, purgeAt?: string(date-time)|null} |
| 201 | Album when anyone was added or invited → AlbumView {id: string, name: string, ownerEmail: string, mine: boolean, created: string(date-time), updated: string(date-time), itemCount: integer, destinations: AlbumDestinationView[], members: AlbumMemberView[], ownerName?: string|null, membersCanAdd: boolean, faces: boolean, cover: string|null, filter: AlbumFilter|null, invited: AlbumInvitedView[], shown: boolean, public?: boolean, publicDevice?: string|null, archived?: string(date-time)|null, mergedFrom?: string[], deletedAt?: string(date-time)|null, deletedBy?: string|null, deletedByName?: string|null, purgeAt?: string(date-time)|null} |
| 400 | the album is already anna@acme.com's, emails must not be empty, too many emails (at most 100), not a valid email addressemails must not be emptytoo many emails (at most 100)the album is already <email>'snot a valid email addressbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the album's owner or an admin can share itonly the album's owner or an admin can share itnot an active member of a company |
| 404 | no such album, bob@acme.com is not a member of your company (invite them to the company first)<email> is not a member of your company (invite them to the company first)no such album |
| 429 | too many invitations today (at most 200 a day)too many invitations today (at most 200 a day) |
curl
# answers 200, 201; errors 400, 401, 403, 404, 429
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/shares' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"email":"bob@acme.com"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/shares",
method="POST",
data=json.dumps({"email": "bob@acme.com"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200, 201; errors 400, 401, 403, 404, 429
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/shares")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"email":"bob@acme.com"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200, 201; errors 400, 401, 403, 404, 429
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/shares");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"email":"bob@acme.com"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200, 201; errors 400, 401, 403, 404, 429
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}/shares/remove#
Stops sharing with one person, withdraws an invitation (pending or declined), or removes a guest. A member may remove themselves (leaving the album). It takes effect on the PCs within 5 minutes.
- Auth: the album's owner, an owner/admin, or the member themselves.
- Request:
{"email": "bob@acme.com"} - Response: 204 (also when not shared). The person gets a
sharednotification ("Anna Smith stopped sharing the album with you") unless they left themselves. - Errors: 403 →
only the album's owner or an admin can stop sharing it. 404 →no such album.
POST /api/albums/{id}/shares/remove · from openapi.yaml (postAlbumsIdSharesRemove)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumShareRequestemail string|nullemails string[] |
| 204 | (also when not shared) |
| 400 | Bad Requestnot a valid email addressbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the album's owner or an admin can stop sharing itonly the album's owner or an admin can stop sharing itnot an active member of a company |
| 404 | no such albumno such album |
curl
# answers 204; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/shares/remove' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"email":"bob@acme.com"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/shares/remove",
method="POST",
data=json.dumps({"email": "bob@acme.com"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/shares/remove")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"email":"bob@acme.com"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/shares/remove");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"email":"bob@acme.com"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}/show#
Turns an album shared with the caller off or back on, for them alone (Vladimir 2026-10-31). Off: the apps keep
it out of Photos, Recent and Albums lists and download or cache nothing of it, and the service sends no album-add
push (nor inbox entry) for it; the caller stays a member (or guest), the owner sees them in members with
shown: false, and their tickets work as before. On: back as it was. This is not leaving the album
(shares/remove with their own email, or guest leave).
The album's owner hides their own album the same way (iOS request #85): shown: false in their own album lists, on
all their devices, and no album-add push (nor inbox entry) for them; it stays theirs (mine: true), and its sharing,
members, tickets and backups are untouched: the people it is shared with see no difference.
- Auth: signed in, its owner (an active member of its company), or someone the album is shared with: a member of its company (active), or a guest (from anywhere).
- Request:
{"on": false}(required). - Response: 204 (also when it already was). The caller's devices and the owner's get a
changedpush (albums); when the owner hides or shows their own, only the owner's other devices. - Errors: 400 →
on is required (true or false). 404 →no such album(also not shared with the caller, or deleted).
POST /api/albums/{id}/show · from openapi.yaml (postAlbumsIdShow)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumShowRequeston boolean|null |
| 204 | (also when it already was) |
| 400 | on is required (true or false)on is required (true or false)bad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 404 | no such album (also not shared with the caller, or deleted)no such album |
curl
# answers 204; errors 400, 401, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/show' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"on":false}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/show",
method="POST",
data=json.dumps({"on": False}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/show")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"on":false}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/show");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"on":false}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}/shares/can-add#
Lets one person the album is shared with add their own photos and videos (and remove what they added), or stops them.
Their setting overrides the album's membersCanAdd until the album-wide switch is set again
(POST /api/albums/{id} with membersCanAdd, which clears everyone's own setting). Someone with
no setting of their own follows the album. Their tickets follow at the next check (within the PCs' 5-minute cache):
member-add or member, and a relay ticket for their adds stops serving when it is turned off.
- Auth: the album's owner, or an owner/admin of the company.
- Request:
{"email": "bob@acme.(both required).com", "canAdd": true} - Response: 204. The album's
members[]show it ascanAdd; to that person, the album'smembersCanAddis it. - Errors: 400 →
canAdd is required (true or false),not a valid email address,a guest of the album cannot add to it. 403 →only the album's owner or an admin can say who may add to it. 404 →no such album,not shared with them(also the owner's own email).
POST /api/albums/{id}/shares/can-add · from openapi.yaml (postAlbumsIdSharesCanAdd)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumCanAddRequestemail string|nullcanAdd boolean|null |
| 204 | No Content |
| 400 | canAdd is required (true or false), not a valid email address, a guest of the album cannot add to itcanAdd is required (true or false)a guest of the album cannot add to itnot a valid email addressbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the album's owner or an admin can say who may add to itonly the album's owner or an admin can say who may add to itnot an active member of a company |
| 404 | no such album, not shared with them (also the owner's own email)not shared with themno such album |
curl
# answers 204; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/shares/can-add' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"email":"bob@acme.com","canAdd":true}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/shares/can-add",
method="POST",
data=json.dumps({"email": "bob@acme.com", "canAdd": True}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/shares/can-add")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"email":"bob@acme.com","canAdd":true}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/shares/can-add");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"email":"bob@acme.com","canAdd":true}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}/added#
Tells the service that this device just added photos or videos to the album, so the others hear of it. Call it after a successful add.
- Auth: registered device of the owner, or of a member who may add (their
canAdd). - Request:
{"count": 12, "job"?: "job_(1 to 1,000,000).3f9c2a71d04b8e65"} job: the detached album.add or clone these came from (itsjob, up to 64 characters): counted once, whether the phone or the PC that ran it (POST albums/{id}/jobs/done) says so first. - Response: 204. Everyone in the album but the adder (members, the owner, guests) gets an
album-addednotification; those with album-add notifications on get one push per album at most every 5 minutes ("Bob Jones added 12 photos and videos"). With ajobits PC counted already: 204 and nothing more. - Errors: 400 →
count is required,count must be 1 to 1000000,job is at most 64 characters. 403 →only the album's owner can add to it (its owner has not let members add). 404 →no such album.
POST /api/albums/{id}/added · from openapi.yaml (postAlbumsIdAdded)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumAddedRequestcount integer|nulljob string|null |
| 204 | No Content |
| 400 | count is required, count must be 1 to 1000000, job is at most 64 characterscount is requiredcount must be 1 to 1000000job is at most 64 charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the album's owner can add to it (its owner has not let members add)only the album's owner can add to it (its owner has not let members add)not an active member of a companythis device is not registered (devices/register) |
| 404 | no such albumno such album |
curl
# answers 204; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/added' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"count":12,"job":"job_3f9c2a71d04b8e65"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/added",
method="POST",
data=json.dumps({"count": 12, "job": "job_3f9c2a71d04b8e65"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/added")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"count":12,"job":"job_3f9c2a71d04b8e65"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/added");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"count":12,"job":"job_3f9c2a71d04b8e65"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}/jobs/accept#
A PC accepted a detached album.add or album.clone
(detach: true, iOS request #63): it binds the job to the device that sent it, so that when the job ends it can alert
that device's member (POST albums/{id}/jobs/done) with the phone gone. The PC calls it
as the job starts, off the request.
- Auth: registered device of the company (the PC running the job).
- Request:
{"ticket": "at_.…", "job": "job_ 3f9c2a71d04b8e65", "op": "add"} ticket: the album ticket the job was sent with (the sending device's own, unexpired, of this album).job: the PC's job id (up to 64 characters).op:addorclone. - Response: 200 `{"job": "job_3f9c2a71d04b8e65", "device": "d_7k2mq9pa4zw3n5cx", "album": "al_…", "until":
"2026-10-24T18:02:11Z"}
.device`: the device that sent the job (the ticket's). The binding lasts 24 hours (as long as the PC keeps the job), well past the ticket's hour. - Errors: 400 →
job is required,op is required,op is add or clone,ticket is required. 403 → `that device may not add to this album. 404 →no such album for that ticket (expired, another album's, or not a device's own album ticket)(a guest's, link's, filter's or assistant job's ticket too).this job is bound already`.409 →
POST /api/albums/{id}/jobs/accept · from openapi.yaml (postAlbumsIdJobsAccept)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumJobAcceptRequestticket string|nulljob string|nullop string|null |
| 200 | `device`: the device that sent the job (the ticket's) → AlbumJobAcceptView {job: string, device: string, album: string, until: string(date-time)} |
| 400 | job is required, op is required, op is add or clone, ticket is requiredop is add or clone<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | that device may not add to this albumthat device may not add to this albumnot an active member of a companythis device is not registered (devices/register) |
| 404 | no such album for that ticket (expired, another album's, or not a device's own album ticket) (a guest's, link's, filter's or assistant job's ticket too) |
| 409 | this job is bound alreadythis job is bound already |
curl
# answers 200; errors 400, 401, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/jobs/accept' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"ticket":"at_…","job":"job_3f9c2a71d04b8e65","op":"add"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/jobs/accept",
method="POST",
data=json.dumps({"ticket": "at_…", "job": "job_3f9c2a71d04b8e65", "op": "add"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/jobs/accept")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"ticket":"at_…","job":"job_3f9c2a71d04b8e65","op":"add"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/jobs/accept");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"ticket":"at_…","job":"job_3f9c2a71d04b8e65","op":"add"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}/jobs/done#
A PC's detached add or clone of the album ended (iOS request #63): the member whose device sent it gets one alert, the album's people re-read the album, and what was added goes to them as that device's POST albums/{id}/added would.
- Auth: registered device of the company: the PC that bound the job.
- Request: `{"job": "job_3f9c2a71d04b8e65", "ticket": "at_…", "added": 23, "already": 0, "failed": 0, "kind": "photos",
"error"?: "The album drive CHIA2 G: is not connected"}
.ticket`: the one bound with the job (POST albums/{id}/jobs/accept), so a PC alerts only the member whose device sent it the job. Counts only;kind:photos/videos(absent: both), for the wording;error: why the job stopped (up to 300 characters kept), absent when it ran to its end. - Response: 200
{"title": "Chicago Night River", "body": "23 photos added", "notification": 1043, "counted": true}. The alert (kindalbum-job,target: {type: "album", id}, collapse idalbum-job-<job>) goes to the sending device's member (notification: 0 when that device or member is gone). Bodies: "23 photos added", "1 photo added · 2 could not be added", "Nothing new: 5 were in the album already", "Could not finish: <error>".counted:added(≥ 1) went to the album's people now as analbum-addedfrom that member (false: nothing added, the device said so already with the job, or it may no longer add). Every device of the album's people, the sender's too, getschanged: ["album:<id>", "albums"]. Once per job. - One alert per action (requests #111): a job of the same member and album that ends within 5 minutes of the last
such alert, while it is unread, is folded into it: the one entry says what the jobs did together (everything they
added; what was there already but not put in by an earlier one of them; what could not be added, and why the last
stopped), and the answer's
title,bodyandnotificationare that entry's. The alert is pushed again only when it now says something new (the first adds after jobs that added nothing, or the job stopped), under the first job's collapse id so the phone replaces the one it shows; otherwise the inbox is re-read on a silent push. Vladimir's share of 8 photos in three jobs ("Nothing added · 8 could not be added", "8 photos added", "Nothing new: 8 were in the album already") is one entry, "8 photos added". What could not be added: a lateraddis the retry of an earlier one (an add that falls through to a second computer: "Nothing added · 8 could not be added" on one, "8 photos added" on the next, is "8 photos added"), and a latercloneon the same PC of an earlier clone there; an album made of own photos (add) and copies from shared albums (acloneon each PC holding one) adds up the parts' failures. Each member's alerts and each album's are their own. - Errors: 400 →
job is required. 403 → `no album job of this PC bound to that ticket (albums/{id}/jobs/accept; for the job's 24 hours)` (not bound, another PC's, another ticket or album, ended already, or the 24 hours over). 404 →no such album (deleted while the job ran).
POST /api/albums/{id}/jobs/done · from openapi.yaml (postAlbumsIdJobsDone)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumJobDoneRequestjob string|nullticket string|nulladded integer|nullalready integer|nullfailed integer|nullkind string|nullerror string|null |
| 200 | OK → AlbumJobDoneView {title: string, body: string, notification: integer(int64), counted: boolean} |
| 400 | job is required<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | no album job of this PC bound to that ticket (albums/{id}/jobs/accept; for the job's 24 hours) (not bound, another PC's, another ticket or album, ended already, or the 24 hours over)not an active member of a companythis device is not registered (devices/register) |
| 404 | no such album (deleted while the job ran)no such album (deleted while the job ran) |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/jobs/done' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"job":"job_3f9c2a71d04b8e65","ticket":"at_…","added":23,"already":0,"failed":0,"kind":"photos","error":"The album drive CHIA2 G: is not connected"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/jobs/done",
method="POST",
data=json.dumps({"job": "job_3f9c2a71d04b8e65", "ticket": "at_…", "added": 23, "already": 0, "failed": 0, "kind": "photos", "error": "The album drive CHIA2 G: is not connected"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/jobs/done")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"job":"job_3f9c2a71d04b8e65","ticket":"at_…","added":23,"already":0,"failed":0,"kind":"photos","error":"The album drive CHIA2 G: is not connected"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/jobs/done");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"job":"job_3f9c2a71d04b8e65","ticket":"at_…","added":23,"already":0,"failed":0,"kind":"photos","error":"The album drive CHIA2 G: is not connected"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}/remove-requests#
A member asks the album's owner to remove a photo that is not theirs.
- Auth: a member of the album in its company (not the owner, not a guest).
- Request:
{"item": "2026-.10- 14/ IMG_ 0412. HEIC", "source"?: "Bobs- iPhone"} itemup to 200 characters;source(the asking device's name) up to 100, logged only. - Response: 201
{"album": "al_; 200 with the same body when this person had asked for this item already (nothing new). The owner gets ax7k2mq9pa4zw3n5c", "item": "2026- 10- 14/ IMG_ 0412. HEIC"} remove-requestnotification ("Bob Jones asks you to remove a photo", targetalbum-item). When the item leaves the album the request is done and the notification marked read. - Errors: 400 →
item is required,source too long. 404 →no such album(also for the owner, guests, admins who are not members). 429 →too many remove requests today (at most 50 a day).
POST /api/albums/{id}/remove-requests · from openapi.yaml (postAlbumsIdRemoveRequests)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumRemoveRequestitem string|nullsource string|null |
| 200 | With the same body when this person had asked for this item already (nothing new) → AlbumRemoveRequestView {album: string, item: string} |
| 201 | Created → AlbumRemoveRequestView {album: string, item: string} |
| 400 | item is required, source too longsource too long<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 404 | no such album (also for the owner, guests, admins who are not members)no such album |
| 429 | too many remove requests today (at most 50 a day)too many remove requests today (at most 50 a day) |
curl
# answers 200, 201; errors 400, 401, 404, 429
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/remove-requests' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"item":"2026-10-14/IMG_0412.HEIC","source":"Bobs-iPhone"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/remove-requests",
method="POST",
data=json.dumps({"item": "2026-10-14/IMG_0412.HEIC", "source": "Bobs-iPhone"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200, 201; errors 400, 401, 404, 429
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/remove-requests")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"item":"2026-10-14/IMG_0412.HEIC","source":"Bobs-iPhone"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200, 201; errors 400, 401, 404, 429
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/remove-requests");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"item":"2026-10-14/IMG_0412.HEIC","source":"Bobs-iPhone"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200, 201; errors 400, 401, 404, 429
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}/filter#
Sets the album's standing filter, or stops it.
- Auth: the album's owner, or an owner or admin of its company.
- Request:
{"filter": {…}}(an Album filter) or{"filter": null}(stop). Each edit sends the whole filter again. - Response: 200 the Album with its
filter. Its members get a silentalbums,album:<id>push. What a filter added stays in the album and in its record when it is stopped: set again, it never adds those again. - Errors: 400 →
filter is required (null stops it),filter.,kind must be all, photos or videos filter.,timeFrom and filter. timeTo go together filter.,night and filter. day exclude each other filter.,timeFrom and timeTo are minutes after midnight (0- 1440) filter.,place needs lat (- 90 to 90) and lon (- 180 to 180) filter.,place. radiusKm must be above 0 (at most 20000) filter.,machines must name the devices whose new items are judged filter., `filter.words is too long (at most 500)machines: at most 20 . 403 →only the album's owner or an admin can set its filter. 404 →no such album`.
The morning push. One alert per member each morning, at 08:00 in their own time zone (the latest one their devices
sent, X-SpaceBackup-TimeZone; UTC when none did), of what the filters of their albums (theirs, and those
shared with them) added since the last one: kind album-auto-added, title "New in your albums", body "Night Chicago
Views: 5 new · Chicago Trips: 2 new" (the owner's also says "3 could not be added: only in encrypted backups"), target
{"type": "album", "id"} for one album, else {"type": "albums"}. Nothing when nothing was added. In the inbox like
every kind; kinds["album- in me/notifications turns the push off.
POST /api/albums/{id}/filter · from openapi.yaml (postAlbumsIdFilter)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumFilterRequestfilter any |
| 200 | The Album with its `filter` → AlbumView {id: string, name: string, ownerEmail: string, mine: boolean, created: string(date-time), updated: string(date-time), itemCount: integer, destinations: AlbumDestinationView[], members: AlbumMemberView[], ownerName?: string|null, membersCanAdd: boolean, faces: boolean, cover: string|null, filter: AlbumFilter|null, invited: AlbumInvitedView[], shown: boolean, public?: boolean, publicDevice?: string|null, archived?: string(date-time)|null, mergedFrom?: string[], deletedAt?: string(date-time)|null, deletedBy?: string|null, deletedByName?: string|null, purgeAt?: string(date-time)|null} |
| 400 | filter is required (null stops it), filter.kind must be all, photos or videos, filter.timeFrom and filter.timeTo go together, filter.night and filter.day exclude each other, filter.timeFrom and timeTo are minutes after midnight (0-1440), filter.place needs lat (-90 to 90) and lon (-180 to 180), filter.place.radiusKm must be above 0 (at most 20000), filter.machines must name the devices whose new items are judged, filter.machines: at most 20, filter.words is too long (at most 500)filter is required (null stops it)filter must be an object or nullfilter: <message>filter.<name> is too long (at most <max>)filter.kind must be all, photos or videosfilter.timeFrom and filter.timeTo go togetherfilter.night and filter.day exclude each otherfilter.timeFrom and timeTo are minutes after midnight (0-1440)filter.place needs lat (-90 to 90) and lon (-180 to 180)filter.place.radiusKm must be above 0 (at most 20000)filter.machines: a name is too longfilter.machines: at most 20filter.machines must name the devices whose new items are judgedbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the album's owner or an admin can set its filteronly the album's owner or an admin can set its filternot an active member of a company |
| 404 | no such albumno such album |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/filter' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"filter":null}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/filter",
method="POST",
data=json.dumps({"filter": None}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/filter")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"filter":null}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/filter");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"filter":null}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/auto#
A PC asks which albums to fill from one device's backups, after a vision pass over that device's new items.
- Auth: registered device of the company (the PC holding the backups).
- Request:
{"machine": "Vlads-.iPhone"} - Response: 200
{"machine": "Vlads-iPhone", "albums": [{"album": "al_x7k2mq9pa4zw3n5c", "name": "Night Chicago Views", "ownerEmail": "vlad@acme.com", "filter": {"words": "…", "content": "view", "night": true, "place": {"name": "Chicago", "lat": 41.88, "lon": -87.63, "radiusKm": 18.5}, "kind": "all", "timeFrom": null, "timeTo": null, "machines": ["Vlads-iPhone"], "since": "2026-10-22T15:05:00+00:00", "active": true}, "destinations": [{"device": "d_4f2a7cqm3xk9wz2b", "deviceName": "VLAD-PC", "dest": "e3b0c442", "label": null}], "added": ["A1B2C3"], "removed": ["D4E5F6"], "lastChecked": "2026-10-22T03:10:00+00:00", "ticket": "at_…", "expires": "2026-10-22T16:05:00+00:00"}]}Only active filters naming the machine, and only when it is one of the album owner's own devices.
addedandremovedare the album's record: items its filter added, and items taken out of the album since (by the owner, or a PC reporting the remove with POST albums/{id}removed); the PC adds neither again.ticketis a ticket of accessfilterfor this PC (an hour): it servesalbum.addof that machine's items to the album's drives (on this PC, andalbum.putto the other PCs' drives), nothing else. - Errors: 400 →
machine is required.
POST /api/albums/auto · from openapi.yaml (postAlbumsAuto)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumAutoRequestmachine string|null |
| 200 | Only active filters naming the machine, and only when it is one of the album owner's own devices. `added` and `removed` are the album's record: items its filter added, and items taken out of the album since (by the owner, or a PC reporting the remove with POST albums/{id} `removed`) → AlbumAutoList {machine: string, albums: AlbumAutoView[]} |
| 400 | machine is required<name> is required<name> is too long<name> must not contain control characters<name> must be a stringbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
curl
# answers 200; errors 400, 401, 403
curl -sS -X POST 'https://spacebackup.net/account/api/albums/auto' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"machine":"Vlads-iPhone"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/auto",
method="POST",
data=json.dumps({"machine": "Vlads-iPhone"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/auto")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"machine":"Vlads-iPhone"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/auto");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"machine":"Vlads-iPhone"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/{id}/auto-added#
The PC says what it added for the album's filter.
- Auth: registered device of the company.
- Request:
{"machine": "Vlads-.iPhone", "added": ["A1B2C3", "A7B8C9"], "encrypted": 2} added: item ids (up to 10,000);encrypted: items that passed but are held only in encrypted backups (skipped; no key is lent at night). - Response: 200
{"album": "al_(…", "added": 1, "already": 1, "encrypted": 2} already: recorded before, by this or another PC). The album's members get a silentalbum:<id>,albumspush at once; the morning push says it later. - Errors: 400 →
machine is required,at most 10000 ids at a time. 404 → `no such album with an active filter for that machine`.
POST /api/albums/{id}/auto-added · from openapi.yaml (postAlbumsIdAutoAdded)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumAutoAddedmachine string|nulladded string[]encrypted integer|null |
| 200 | (`already`: recorded before, by this or another PC) → AlbumAutoAddedView {album: string, added: integer, already: integer, encrypted: integer} |
| 400 | machine is required, at most 10000 ids at a timeat most 10000 ids at a timeencrypted out of range<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
| 404 | no such album with an active filter for that machineno such album with an active filter for that machine |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/auto-added' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"machine":"Vlads-iPhone","added":["A1B2C3","A7B8C9"],"encrypted":2}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/auto-added",
method="POST",
data=json.dumps({"machine": "Vlads-iPhone", "added": ["A1B2C3", "A7B8C9"], "encrypted": 2}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/auto-added")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"machine":"Vlads-iPhone","added":["A1B2C3","A7B8C9"],"encrypted":2}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/auto-added");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"machine":"Vlads-iPhone","added":["A1B2C3","A7B8C9"],"encrypted":2}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/assistant/jobs/ticket#
The phone takes a ticket for one assistant job before it sends assistant.job to a PC: without it no PC can make an album for it (POST assistant/jobs/album) or alert its member about the job (POST assistant/jobs/done).
- Auth: registered device of the company (the phone).
- Request:
{"pc": "d_.4hq8xw2mz7rk3n9p", "action": "shareAlbum"} pc: the PC's device id (an active device of the phone's company, not the phone itself).action:show·makeAlbum·shareAlbum, as the job's reading.device(optional, 2026-11-05): the device id of another device of the caller's own member whose backups the job reads: the desktop window on a computer asks for its member's phone (`{"pc": …, "action": "makeAlbum", "device": "d_7k2mq9pa4zw3n5cx"}`). The ticket then names that device as the phone, so redeem, the album (owned by its member) and the alert are exactly as when the phone asks itself. Absent, or the caller's own id: the caller. - Response: 200
{"ticket": "jt_. The ticket names the phone, the PC and the action; the PC must redeem it within 15 minutes, once, when it accepts the job (POST assistant/jobs/redeem), which binds it to that job for 24 hours. The phone passes it in…", "expires": "2026- 10- 22T15:20:00+00:00"} assistant.jobasjobTicket. Only its hash is stored. Ashowticket makes no album. - Errors: 400 →
pc is required,action is required,action is show, makeAlbum or shareAlbum, `pc is another device than the phone. 403 →this device is not registered (devices/register),a job ticket for another device is taken only for a device of your own(deviceof another member).no such device404 → (pcordevice` not of the phone's company, or removed).
POST /api/assistant/jobs/ticket · from openapi.yaml (postAssistantJobsTicket)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AssistantTicketRequestpc string|nullaction string|nulldevice string|null |
| 200 | OK → AssistantTicketView {ticket: string, expires: string(date-time)} |
| 400 | pc is required, action is required, action is show, makeAlbum or shareAlbum, pc is another device than the phoneaction is show, makeAlbum or shareAlbumdevice is too longpc is another device than the phone<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | this device is not registered (devices/register), a job ticket for another device is taken only for a device of your own (device of another member)a job ticket for another device is taken only for a device of your ownnot an active member of a companythis device is not registered (devices/register) |
| 404 | no such device (pc or device not of the phone's company, or removed)no such device |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/assistant/jobs/ticket' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"pc":"d_4hq8xw2mz7rk3n9p","action":"shareAlbum"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/assistant/jobs/ticket",
method="POST",
data=json.dumps({"pc": "d_4hq8xw2mz7rk3n9p", "action": "shareAlbum"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/assistant/jobs/ticket")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"pc":"d_4hq8xw2mz7rk3n9p","action":"shareAlbum"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/assistant/jobs/ticket");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"pc":"d_4hq8xw2mz7rk3n9p","action":"shareAlbum"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/assistant/jobs/redeem#
The PC accepts a phone's assistant job: it redeems the phone's job ticket before it answers assistant.job, so a ticket that is no good refuses the job at once instead of failing it late (a job queued behind another, or a long selection, no longer outlasts its ticket).
- Auth: registered device of the company (the PC the ticket names).
- Request:
{"jobTicket": "jt_.…", "job": "aj_ 3f9a1c07b2e4d5c6a7b8c9d0"} job: the id the PC gives the job (≤ 64). - Response: 200
{"job": "aj_. The ticket is used now and bound to…", "device": "d_ 7k2mq9pa4zw3n5cx", "action": "shareAlbum", "until": "2026- 10- 23T15:05:00+00:00"} jobuntiluntil(24 hours: the job's life on the PC).device: the phone that took it (the PC checks it is the phone that sent the job);action: the ticket's. While bound, assistant/jobs/album and assistant/jobs/done accept{job, jobTicket}for that job only. - Errors: 400 →
job is required. 403 → `no valid job ticket from a phone for this PC (assistant/jobs/ticket; 15 minutes, redeemed once)` (missing, unknown, for another PC, redeemed already, or expired; the ticket stays as it was). 404 →no such device,the device's member is not active(the phone).
POST /api/assistant/jobs/redeem · from openapi.yaml (postAssistantJobsRedeem)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AssistantRedeemRequestjobTicket string|nulljob string|null |
| 200 | OK → AssistantRedeemView {job: string, device: string, action: string, until: string(date-time)} |
| 400 | job is required<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | no valid job ticket from a phone for this PC (assistant/jobs/ticket; 15 minutes, redeemed once) (missing, unknown, for another PC, redeemed already, or expired; the ticket stays as it was)not an active member of a companythis device is not registered (devices/register) |
| 404 | no such device, the device's member is not active (the phone)no such devicethe device's member is not active |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/assistant/jobs/redeem' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"jobTicket":"jt_…","job":"aj_3f9a1c07b2e4d5c6a7b8c9d0"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/assistant/jobs/redeem",
method="POST",
data=json.dumps({"jobTicket": "jt_…", "job": "aj_3f9a1c07b2e4d5c6a7b8c9d0"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/assistant/jobs/redeem")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"jobTicket":"jt_…","job":"aj_3f9a1c07b2e4d5c6a7b8c9d0"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/assistant/jobs/redeem");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"jobTicket":"jt_…","job":"aj_3f9a1c07b2e4d5c6a7b8c9d0"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/assistant/jobs/album#
The PC running a phone's assistant job (iOS request #61; peer op assistant.job) makes the album the job asked for, owned by the member of that phone. When the member already has an album of their own of that name (trimmed, in any case), the job fills that one instead, as the phone does: its name stays as it is, its own standing filter stays (the job's is set only when it has none), and the calling PC is added to its drives when it is not one. An album of that name someone else shared with the member is never filled this way; a public album neither.
- Auth: registered device of the company (the PC holding the phone's backups; any member's PC).
- Request:
{"device": "d_7k2mq9pa4zw3n5cx", "job": "aj_3f9a1c07b2e4d5c6a7b8c9d0", "jobTicket": "jt_…", "name": "Night Chicago Views", "dest": "e3b0c442", "label": "E:\\", "filter": {"words": "Make an album of my night Chicago views", "content": "view", "night": true, "kind": "photos"}, "share": ["anna@acme.com"]}device: the phone (its device id).jobTicket: the phone's ticket from POST assistant/jobs/ticket, bound tojobby POST assistant/jobs/redeem: taken bydevice, redeemed by the calling PC, formakeAlbumorshareAlbum, within the job's 24 hours. One album per job.jobis required.dest: the PC's own destination for the album (labelits path, for messages).filter: the standing filter, as POST albums/{id}/filter takes it (machines default to the phone); absent or null: none.share: up to 100 emails, as POST albums/{id}/shares (by the owner: members are in at once, someone outside the company is invited). - Response: 201
{"album": "al_x7k2mq9pa4zw3n5c", "name": "Night Chicago Views", "ticket": "at_…", "expires": "2026-10-22T16:05:00+00:00", "filter": true, "shared": ["anna@acme.com"], "invited": false}ticket: accessfilterfor this PC and the phone's items only (filterMachines: [the phone]), an hour; it adds to the album's drives on this PC and is never exchanged for a relay ticket.shareError: the share failed (the album and its filter stay).existing: true: the member's own album of that name was there already and the job fills it (filter: whether it has a standing filter now). The member's devices getchanged: ["albums"](the album's peoplealbum:<id>too when it was there already). - Errors: 400 →
name is required,dest is required,device is required,job is required, a filter's error, `too many emails to share with (at most 100). 404 →no such device(not of the caller's company, or removed),the device's member is not active. 429 →too many invitations today (at most 200 a day)` (the share's invitations to people outside the company, as POST albums/{id}/shares). 403 → `no job ticket bound to this job of that phone on this PC (assistant/jobs/redeem; for the job's 24 hours)` (missing, not redeemed, bound to another job, PC or phone, or the 24 hours over),the job's ticket is for show: it makes no album,this job has made its album already. 409 →the album "<name>" has 8 drives already, none on this PC(the member's own album of that name, which this PC cannot be added to).
POST /api/assistant/jobs/album · from openapi.yaml (postAssistantJobsAlbum)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AssistantAlbumRequestdevice string|nulljob string|nullname string|nulldest string|nulllabel string|nullfilter anyshare string[]jobTicket string|null |
| 201 | `ticket`: access `filter` for this PC and the phone's items only (`filterMachines: [the phone]`), an hour → AssistantAlbumView {album: string, name: string, ticket: string, expires: string(date-time), filter: boolean, shared: string[], invited: boolean, shareError?: string|null, existing?: boolean|null} |
| 400 | name is required, dest is required, device is required, job is required, a filter's error, too many emails to share with (at most 100)too many emails to share with (at most 100)<name> is required<name> is too long<name> must not contain control charactersfilter must be an object or nullfilter: <message>filter.<name> is too long (at most <max>)filter.kind must be all, photos or videosfilter.timeFrom and filter.timeTo go togetherfilter.night and filter.day exclude each otherfilter.timeFrom and timeTo are minutes after midnight (0-1440)filter.place needs lat (-90 to 90) and lon (-180 to 180)filter.place.radiusKm must be above 0 (at most 20000)filter.machines: a name is too longfilter.machines: at most 20filter.machines must name the devices whose new items are judged<name> must be a stringemails must not be emptytoo many emails (at most 100)the album is already <email>'snot a valid email addressbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | no job ticket bound to this job of that phone on this PC (assistant/jobs/redeem; for the job's 24 hours) (missing, not redeemed, bound to another job, PC or phone, or the 24 hours over), the job's ticket is for show: it makes no album, this job has made its album alreadythe job's ticket is for show: it makes no albumthis job has made its album alreadynot an active member of a companythis device is not registered (devices/register)only the album's owner or an admin can share it |
| 404 | no such device (not of the caller's company, or removed), the device's member is not activeno such devicethe device's member is not active<email> is not a member of your company (invite them to the company first)no such album |
| 409 | the album "<name>" has 8 drives already, none on this PC (the member's own album of that name, which this PC cannot be added to)the album "<name>" has 8 drives already, none on this PC |
| 429 | too many invitations today (at most 200 a day) (the share's invitations to people outside the company, as [POST albums/{id}/shares](#post-api-albums-id-shares))too many invitations today (at most 200 a day) |
curl
# answers 201; errors 400, 401, 403, 404, 409, 429
curl -sS -X POST 'https://spacebackup.net/account/api/assistant/jobs/album' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"device":"d_7k2mq9pa4zw3n5cx","job":"aj_3f9a1c07b2e4d5c6a7b8c9d0","jobTicket":"jt_…","name":"Night Chicago Views","dest":"e3b0c442","label":"E:\\","filter":{"words":"Make an album of my night Chicago views","content":"view","night":true,"kind":"photos"},"share":["anna@acme.com"]}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/assistant/jobs/album",
method="POST",
data=json.dumps({"device": "d_7k2mq9pa4zw3n5cx", "job": "aj_3f9a1c07b2e4d5c6a7b8c9d0", "jobTicket": "jt_…", "name": "Night Chicago Views", "dest": "e3b0c442", "label": "E:\\", "filter": {"words": "Make an album of my night Chicago views", "content": "view", "night": True, "kind": "photos"}, "share": ["anna@acme.com"]}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 201; errors 400, 401, 403, 404, 409, 429
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/assistant/jobs/album")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"device":"d_7k2mq9pa4zw3n5cx","job":"aj_3f9a1c07b2e4d5c6a7b8c9d0","jobTicket":"jt_…","name":"Night Chicago Views","dest":"e3b0c442","label":"E:\\","filter":{"words":"Make an album of my night Chicago views","content":"view","night":true,"kind":"photos"},"share":["anna@acme.com"]}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 201; errors 400, 401, 403, 404, 409, 429
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/assistant/jobs/album");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"device":"d_7k2mq9pa4zw3n5cx","job":"aj_3f9a1c07b2e4d5c6a7b8c9d0","jobTicket":"jt_…","name":"Night Chicago Views","dest":"e3b0c442","label":"E:\\","filter":{"words":"Make an album of my night Chicago views","content":"view","night":true,"kind":"photos"},"share":["anna@acme.com"]}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 201; errors 400, 401, 403, 404, 409, 429
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/assistant/jobs/done#
The PC finished an assistant job: the phone's member gets one alert, and their devices re-read the album.
- Auth: registered device of the company.
- Request: `{"device": "d_7k2mq9pa4zw3n5cx", "job": "aj_…", "jobTicket": "jt_…", "album": "al_…", "added": 23, "found": 25,
"needsPhone": 2, "kind": "photos", "failed": false}
.jobTicket`: the phone's ticket bound toCounts only: never the user's words. job(POST assistant/jobs/redeem), so a PC alerts a member only about a job that member's phone sent it.album: the one made for the job; absent for ashowjob.kind:photos/videos(absent: both) for the wording. - Response: 200 `{"title": "Night Chicago Views", "body": "23 photos added · 2 more when your phone backs them up",
"notification": 1042}
. The alert (kindassistant-job) opens the album (target: {type: "album", id}`, so the member's other devices can open it too), or for ashowjob the job ({type: "assistant-, title "Assistant", body "Found 25 photos");job", id: <job>} failed: "Your request could not be finished on your computer. Open Space Backup to try again." The album's owner and members getchanged: ["album:<id>", "albums"]. - Errors: 400 →
job is required,device is required. 403 → `no job ticket bound to this job of that phone on this PC (assistant/jobs/redeem; for the job's 24 hours). 404 →no such device,no such album of that device's member on this PC` (the album is not the job's or the member's, or the caller is not one of its drives).
POST /api/assistant/jobs/done · from openapi.yaml (postAssistantJobsDone)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AssistantDoneRequestdevice string|nulljob string|nullalbum string|nulladded integer|nullfound integer|nullneedsPhone integer|nullkind string|nullfailed boolean|nulljobTicket string|null |
| 200 | OK → AssistantDoneView {title: string, body: string, notification: integer(int64)} |
| 400 | job is required, device is required<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | no job ticket bound to this job of that phone on this PC (assistant/jobs/redeem; for the job's 24 hours)not an active member of a companythis device is not registered (devices/register) |
| 404 | no such device, no such album of that device's member on this PC (the album is not the job's or the member's, or the caller is not one of its drives)no such album of that device's member on this PCno such devicethe device's member is not active |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/assistant/jobs/done' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"device":"d_7k2mq9pa4zw3n5cx","job":"aj_…","jobTicket":"jt_…","album":"al_…","added":23,"found":25,"needsPhone":2,"kind":"photos","failed":false}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/assistant/jobs/done",
method="POST",
data=json.dumps({"device": "d_7k2mq9pa4zw3n5cx", "job": "aj_…", "jobTicket": "jt_…", "album": "al_…", "added": 23, "found": 25, "needsPhone": 2, "kind": "photos", "failed": False}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/assistant/jobs/done")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"device":"d_7k2mq9pa4zw3n5cx","job":"aj_…","jobTicket":"jt_…","album":"al_…","added":23,"found":25,"needsPhone":2,"kind":"photos","failed":false}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/assistant/jobs/done");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"device":"d_7k2mq9pa4zw3n5cx","job":"aj_…","jobTicket":"jt_…","album":"al_…","added":23,"found":25,"needsPhone":2,"kind":"photos","failed":false}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Album tickets#
A device reads or changes an album on a PC by handing it an album ticket over the peer channel; the PC checks it here. Access is worked out at every check, so an unshare or a deleted album stops being served within the PCs' 5-minute cache.
POST /api/albums/{id}/tickets#
- Auth: registered device of the album's owner or of a member.
- Request: no body.
- Response: 200
{"ticket": "at_Q9xV2bT1rL6sD0fH5jK9eG3uI7oA2cYk3Qm9xP2aZ", "album": "al_x7k2mq9pa4zw3n5c", "name": "Las Vegas", "access": "owner", "expires": "2026-10-18T10:15:00.000+00:00"}access:owner,member(read-only) ormember-add(a member who may add: their owncanAdd, else the album'smembersCanAdd). Valid 1 hour, bound to the calling device. - Errors: 404 →
no such album.
POST /api/albums/{id}/tickets · from openapi.yaml (postAlbumsIdTickets)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | `access`: `owner`, `member` (read-only) or `member-add` (a member who may add: their own `canAdd`, else the album's `membersCanAdd`) → AlbumTicketView {ticket: string, album: string, name: string, access: string, expires: string(date-time)} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
| 404 | no such albumno such album |
curl
# answers 200; errors 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/tickets' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/tickets",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/tickets")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/al_x7k2mq9pa4zw3n5c/tickets");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/album-tickets/check#
A PC asks what an album ticket allows now.
- Auth: registered device of the album's company (the PC).
- Request:
{"ticket": "at_…"}(or anar_…relay ticket). - Response: 200
{"requesterDevice": "d_7pz4wn5cq2am3k9x", "requesterName": "Bobs-iPhone", "requesterEmail": "bob@acme.com", "album": "al_x7k2mq9pa4zw3n5c", "albumName": "Las Vegas", "ownerEmail": "anna@acme.com", "access": "member-add", "destinations": [{"device": "d_4f2a7cqm3xk9wz2b", "deviceName": "ANNA-PC", "dest": "e3b0c442", "label": "Backup disk"}], "expires": "2026-10-18T10:15:00.000+00:00", "deleted": false, "memberDevices": ["Bobs-iPhone", "BOB-PC"]}accessMeaning ownerthe album's owner membera member, read-only member-adda member who may add; memberDeviceslists the names of every device that member registered in the company (removed ones too), so the PC can tell which items are theirsguestsomeone outside the company (guests); requesterKeycarries the guest device's registered public keyrelaya relay ticket: the PC carrying transfer jobs is the requester. deleted: truefor a deleted album (serves only the delete). A member's relay ticket addsmemberandmemberDevicesfiltera filter's ticket (albums/auto): the PC that judged adds the items of filterMachines(the filter's machines that are the owner's devices);album.putonlylinkan lk_…ticket of a public link: the account service itself reads the link's items on the guest channel.requesterKeyis the service's link key,linkis{"id", "machine", "items": [{"album"?, "id", "date"?}], "album"?}(machine: the device whose own backups the items withoutalbumare in;album: a whole album's link, with no items)requesterKey,member,memberDevices,filterMachinesandlinkare optional. A filter's ticket and a relay ticket exchanged for one are good while the album's filter is active. For a device's public album (iOS request #42) the answer also has"public": trueand"publicDevice": "<the owning device's name>": the PC takes the phone-shapedalbum.putonly from that device (10-api-peer.md); both are absent for any other album. - Errors: 404 →
no such album for that ticket (expired, the album deleted or no longer shared)(also when the requester device or its member was removed); for a link ticketno such link for that ticket (revoked or expired).
POST /api/album-tickets/check · from openapi.yaml (postAlbumTicketsCheck)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumTicketCheckticket string|null |
| 200 | | `access` | Meaning | |---|---| | `owner` | the album's owner | | `member` | a member, read-only | | `member-add` | a member who may add → AlbumTicketCheckView {requesterDevice: string, requesterName: string, requesterEmail: string, album: string, albumName: string, ownerEmail: string, access: string, destinations: AlbumDestinationView[], expires: string(date-time), requesterKey?: string|null, deleted: boolean, member?: string|null, filterMachines?: string[], memberDevices?: string[], link?: LinkScopeView|null, public?: boolean, publicDevice?: string|null, faces: boolean} |
| 400 | Bad Request<name> is required<name> is too long<name> must not contain control characters<name> must be a stringbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
| 404 | no such album for that ticket (expired, the album deleted or no longer shared) (also when the requester device or its member was removed); for a link ticket no such link for that ticket (revoked or expired)no such link for that ticket (revoked or expired) |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/album-tickets/check' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"ticket":"at_…"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/album-tickets/check",
method="POST",
data=json.dumps({"ticket": "at_…"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/album-tickets/check")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"ticket":"at_…"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/album-tickets/check");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"ticket":"at_…"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/album-tickets/relay#
A source PC exchanges a good ticket for a relay ticket bound to itself, valid 30 days, to finish transfer jobs to album drives that are offline. Renew it by sending the relay ticket itself.
- Auth: registered device (the source PC).
- Request:
{"ticket": "at_…"}(an owner's ticket, amember-addticket, or afilterticket of this PC) or{"ticket": "ar_…"}(renewal). - Response: 200
{"ticket": "ar_. From aM2c…", "album": "al_ …", "name": "Las Vegas", "access": "relay", "expires": "…"} member-addticket the relay ticket is a member's relay ticket (it carries that member's adds and removes, never a delete, and stops once the member may no longer add); it is only given to a PC that is one of the album's PCs or is not one of that member's own devices. From afilterticket it is a filter's relay ticket (filterMachinesin its check;album.putonly, while the filter is active). - Errors: 404 →
no such album for that ticket (expired, the album deleted, or not the owner's)(also a guest's ticket, a plainmemberticket, or another PC's relay ticket).
POST /api/album-tickets/relay · from openapi.yaml (postAlbumTicketsRelay)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AlbumTicketCheckticket string|null |
| 200 | OK → AlbumTicketView {ticket: string, album: string, name: string, access: string, expires: string(date-time)} |
| 400 | Bad Request<name> is required<name> is too long<name> must not contain control characters<name> must be a stringbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register) |
| 404 | no such album for that ticket (expired, the album deleted, or not the owner's) (also a guest's ticket, a plain member ticket, or another PC's relay ticket) |
curl
# answers 200; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/album-tickets/relay' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"ticket":"at_…"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/album-tickets/relay",
method="POST",
data=json.dumps({"ticket": "at_…"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/album-tickets/relay")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"ticket":"at_…"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/album-tickets/relay");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"ticket":"at_…"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Invitations & guests#
Sharing an album with someone outside the company sends them an invitation; once they accept they are a
guest of that album: they may view it and save copies, nothing else. A guest may be in another company or in none.
A member of the company who turned off autoAcceptCompany gets an invitation too, and is a
plain member once they accept. See Guests and
Invitations from outside the company.
- An invitation is accepted, declined or left pending (to answer later). A pending one does not expire (since
2026-10-31): it stays until the invitee answers, the owner withdraws it or the album is deleted. A declined one stays
listed for the invitee (
state: "declined") and can still be accepted, until the owner withdraws it or deletes the album. - The invitee gets a mail with a link
https:/(GET /invite/{id}) and a push on every device of theirs that has a push token./ spacebackup. net/ account/ invite/ <id> - Trusted senders (invitations from outside the invitee's company only): an invitee can accept with
trustSender: true; that sender's later albums then make them a guest at once, with no invitation.
GET /api/albums/invitations#
The caller's open invitations: pending first, then declined, each newest first.
- Auth: signed in (in a company or not).
- Response: 200
[{"id": "inv_c4n7zq2m9xa3kw5p", "album": "al_x7k2mq9pa4zw3n5c", "albumName": "Las Vegas", "fromEmail": "anna@acme.com", "created": "2026-10-17T10:00:00.000+00:00", "state": "pending", "fromName": "Anna Smith", "company": "Acme"}, {"id": "inv_p2w8kx4m7qa9zc3n", "album": "al_m4q8zx2c7pa9kw3n", "albumName": "Team lunch", "fromEmail": "zoe@acme.com", "created": "2026-10-30T12:00:00.000+00:00", "state": "declined", "company": "Acme", "sameCompany": true, "decided": "2026-10-30T12:05:00.000+00:00"}]state:pendingordeclined.fromName,companyanddecided(when declined) are optional.sameCompany(optional,true): from the caller's own company (they turned offautoAcceptCompany); don't offer "trust the sender" for it. Noexpiresany more.
GET /api/albums/invitations · from openapi.yaml (getAlbumsInvitations)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | `state`: `pending` or `declined`. `fromName`, `company` and `decided` (when declined) are *optional*. `sameCompany` (*optional*, `true`): from the caller's own company (they turned off `autoAcceptCompany`) → array of InvitationView {id: string, album: string, albumName: string, fromEmail: string, created: string(date-time), state: string, fromName?: string|null, company?: string|null, sameCompany?: boolean, decided?: string(date-time)|null} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
curl
# answers 200; errors 401
curl -sS -X GET 'https://spacebackup.net/account/api/albums/invitations' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/invitations",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/invitations")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/albums/invitations");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/invitations/{id}/accept#
- Auth: signed in, with the invited email.
- Request: optional
{"trustSender": true}. Accepts a pending or declined invitation.
- Response: 204. The caller is now in the album's
memberswithguest: true(a plain member if they are an active member of the album's company),shown: true. The inviter gets aninvitation-acceptednotification.trustSenderis ignored for an invitation from the caller's own company. - Errors: 404 →
no such invitation (accepted already, withdrawn, or the album was deleted)(also another person's).
POST /api/albums/invitations/{id}/accept · from openapi.yaml (postAlbumsInvitationsIdAccept)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json InvitationAnswertrustSender boolean|null |
| 204 | No Content |
| 400 | Bad Request<name> must be a string<name> is too longbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 404 | no such invitation (accepted already, withdrawn, or the album was deleted) (also another person's)no such invitation (accepted already, withdrawn, or the album was deleted) |
curl
# answers 204; errors 400, 401, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/invitations/inv_c4n7zq2m9xa3kw5p/accept' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"trustSender":true}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/invitations/inv_c4n7zq2m9xa3kw5p/accept",
method="POST",
data=json.dumps({"trustSender": True}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/invitations/inv_c4n7zq2m9xa3kw5p/accept")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"trustSender":true}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/invitations/inv_c4n7zq2m9xa3kw5p/accept");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"trustSender":true}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/albums/invitations/{id}/decline#
- Auth: signed in, with the invited email.
- Request: no body.
- Response: 204: the invitation is
declined, still listed for the caller (who may accept it later) and in the album'sinvitedfor the owner. Declining a declined one again: 204, nothing changes. - Errors: 404 →
no such invitation (accepted already, withdrawn, or the album was deleted)(also another person's).
POST /api/albums/invitations/{id}/decline · from openapi.yaml (postAlbumsInvitationsIdDecline)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | The invitation is `declined`, still listed for the caller (who may accept it later) and in the album's `invited` for the owner |
| 400 | Bad Request<name> must be a string<name> is too long |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 404 | no such invitation (accepted already, withdrawn, or the album was deleted) (also another person's)no such invitation (accepted already, withdrawn, or the album was deleted) |
curl
# answers 204; errors 400, 401, 404
curl -sS -X POST 'https://spacebackup.net/account/api/albums/invitations/inv_c4n7zq2m9xa3kw5p/decline' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/albums/invitations/inv_c4n7zq2m9xa3kw5p/decline",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/albums/invitations/inv_c4n7zq2m9xa3kw5p/decline")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/albums/invitations/inv_c4n7zq2m9xa3kw5p/decline");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/me/trusted-senders#
- Auth: signed in.
- Response: 200
[{"email": "anna@acme.(com", "since": "2026- 10- 17T10:05:00. 000+00:00", "name": "Anna Smith"}] nameoptional).
GET /api/me/trusted-senders · from openapi.yaml (getMeTrustedSenders)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | `[{"email": "anna@acme.com", "since": "2026-10-17T10:05:00.000+00:00", "name": "Anna Smith"}]` (`name` *optional*) → array of TrustedSenderView {email: string, since: string(date-time), name?: string|null} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
curl
# answers 200; errors 401
curl -sS -X GET 'https://spacebackup.net/account/api/me/trusted-senders' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/me/trusted-senders",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/me/trusted-senders")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/me/trusted-senders");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/me/trusted-senders/remove#
- Auth: signed in.
- Request:
{"email": "anna@acme.com"} - Response: 204 (also when not trusted). That sender's next album is an invitation again.
- Errors: 400 →
not a valid email address.
POST /api/me/trusted-senders/remove · from openapi.yaml (postMeTrustedSendersRemove)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json TrustedSenderRequestemail string|null |
| 204 | (also when not trusted) |
| 400 | not a valid email addressnot a valid email addressbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
curl
# answers 204; errors 400, 401
curl -sS -X POST 'https://spacebackup.net/account/api/me/trusted-senders/remove' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"email":"anna@acme.com"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/me/trusted-senders/remove",
method="POST",
data=json.dumps({"email": "anna@acme.com"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/me/trusted-senders/remove")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"email":"anna@acme.com"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/me/trusted-senders/remove");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"email":"anna@acme.com"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/guest/devices/register#
Registers the device of someone in no company, so it can read albums it is a guest of. (A device in a company uses
POST / and needs nothing else.)
- Auth: a device token (not a web session) whose email is not an active member of a company.
- Request:
{"name": "Carols-;iPhone", "publicKey": "<base64 P- 256 SubjectPublicKeyInfo>"} namea machine name (as indevices/register). - Response: 200
{"deviceId": "gd_. Again on the same session: its name and key are replaced.n5c7xq2m4ka9pz3w"} - Errors: 400 →
name must be a machine name: …,publicKey must be a base64 P-. 403 →256 SubjectPublicKeyInfo only a device's own session registers it. 409 →you are in a company: register the device there (devices/.register)
POST /api/guest/devices/register · from openapi.yaml (postGuestDevicesRegister)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json GuestDeviceRequestname string|nullpublicKey string|null |
| 200 | OK → GuestDeviceRegistered {deviceId: string} |
| 400 | name must be a machine name: …, publicKey must be a base64 P-256 SubjectPublicKeyInfoname must be a machine name: 1-64 ASCII letters, digits, '-', '_' or '.'publicKey must be a base64 P-256 SubjectPublicKeyInfo<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only a device's own session registers itonly a device's own session registers it |
| 409 | you are in a company: register the device there (devices/register)you are in a company: register the device there (devices/register) |
curl
# answers 200; errors 400, 401, 403, 409
curl -sS -X POST 'https://spacebackup.net/account/api/guest/devices/register' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"name":"Carols-iPhone","publicKey":"<base64 P-256 SubjectPublicKeyInfo>"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/guest/devices/register",
method="POST",
data=json.dumps({"name": "Carols-iPhone", "publicKey": "<base64 P-256 SubjectPublicKeyInfo>"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/guest/devices/register")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"name":"Carols-iPhone","publicKey":"<base64 P-256 SubjectPublicKeyInfo>"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/guest/devices/register");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"name":"Carols-iPhone","publicKey":"<base64 P-256 SubjectPublicKeyInfo>"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/guest/pass#
Everything a guest's device needs to reach the albums it is a guest of: per album a ticket and the album's PCs with their public keys, and per company a relay pass for Space Relay. Valid 1 hour; ask again when less than 10 minutes are left, or after a refusal.
- Auth: a registered device (a guest device, or a device registered in a company).
- Request: no body.
- Response: 200
{ "expires": "2026-10-18T10:20:00.000+00:00", "companies": [{"id": "c_k3xq7m2pa9fz4w8r", "name": "Acme", "relay": "gp1.9xQ2…"}], "albums": [ {"id": "al_x7k2mq9pa4zw3n5c", "name": "Las Vegas", "ownerEmail": "anna@acme.com", "company": "c_k3xq7m2pa9fz4w8r", "itemCount": 42, "updated": "2026-10-17T21:02:45.930+00:00", "ticket": "at_Q9xV2b…", "expires": "2026-10-18T10:20:00.000+00:00", "pcs": [{"device": "d_4f2a7cqm3xk9wz2b", "deviceName": "ANNA-PC", "publicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…", "dests": ["e3b0c442"]}], "ownerName": "Anna Smith", "cover": null, "shown": true} ] }shown: false: the guest turned it off (show); list it only where they can turn it on, and download nothing of it (its ticket stays good, so turning it on needs no new pass). One album entry per album the caller is a guest of now (accepted, not removed, the album not deleted); an album with no drive haspcs: [].relayis an opaque pass only the relay can open, ornullwhen that company has no relay group linked yet. A guest removed from every album getsalbums: []. - Errors: 403 →
this device is not registered (devices/.register, or guest/ devices/ register outside a company)
POST /api/guest/pass · from openapi.yaml (postGuestPass)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | `shown: false`: the guest turned it off (show) → GuestPassView {expires: string(date-time), companies: GuestCompanyView[], albums: GuestAlbumView[]} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | this device is not registered (devices/register, or guest/devices/register outside a company)this device is not registered (devices/register, or guest/devices/register outside a company) |
curl
# answers 200; errors 401, 403
curl -sS -X POST 'https://spacebackup.net/account/api/guest/pass' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/guest/pass",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/guest/pass")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/guest/pass");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/guest/albums/{id}/leave#
- Auth: signed in (the guest).
- Request: no body.
- Response: 204 (also when not a guest of it). Takes effect at the next pass and at the PCs' next ticket check (at most 5 minutes).
POST /api/guest/albums/{id}/leave · from openapi.yaml (postGuestAlbumsIdLeave)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | (also when not a guest of it) |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
curl
# answers 204; errors 401
curl -sS -X POST 'https://spacebackup.net/account/api/guest/albums/al_x7k2mq9pa4zw3n5c/leave' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/guest/albums/al_x7k2mq9pa4zw3n5c/leave",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/guest/albums/al_x7k2mq9pa4zw3n5c/leave")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/guest/albums/al_x7k2mq9pa4zw3n5c/leave");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 401
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Notifications & push#
Every event the service tells someone about is kept in their inbox for 90 days and pushed to their phones unless they turned that kind off. The desktop apps read the inbox and long-poll it. See Notification history and Notification settings.
kind | Sent to | About | target.type |
|---|---|---|---|
album-added | everyone in the album but the adder | photos or videos added (one unread entry per album and adder, its count summed) | album |
shared | the recipient | an album or a device's backups shared with you, or stopped; an album invitation | album, share, device, invitation |
key-waiting | owners/admins | a device has waited 2 minutes for the company key (read for all once resolved) | key-release |
device-joined | owners/admins | a new device joined (not your own) | device |
restore-approval | owners/admins | a restore asks for a data key (read for all once decided) | datakey-request |
relay-credit | owners/admins | relay credit low (below 10 % of the last pack, auto top-up off) or used up | relay |
invitation-accepted | the inviter | a company or album invitation was accepted | member, album |
remove-request | the album's owner | a member asks to remove a photo (read once the item leaves the album) | album-item |
album-auto-added | everyone in an album its filter added to (owner and members) | the morning summary, once a day at 08:00 their time (filters) | album, albums |
assistant-job | the member whose phone sent an assistant job | the job finished on a PC: "Night Chicago Views" / "23 photos added", or "Found 25 photos" (assistant jobs) | album, assistant-job |
An inbox is per email: in the caller's company, plus entries that belong to no company (a guest's).
GET /api/notifications#
The history, newest first.
- Auth: signed in.
- Query:
before=<id>? (older than that id, for paging),limit=<1–200>? (default 50). - Response: 200 Notification list:
{"notifications": [ {"id": 1842, "time": "2026-10-18T08:40:11.500+00:00", "kind": "album-added", "title": "Las Vegas", "body": "Bob Jones added 12 photos and videos", "target": {"type": "album", "id": "al_x7k2mq9pa4zw3n5c"}, "read": false, "quiet": false}, {"id": 1839, "time": "2026-10-18T07:02:30.000+00:00", "kind": "device-joined", "title": "New device ANNA-LAPTOP", "body": "ANNA-LAPTOP (macOS 26.0) of anna@acme.com joined Acme", "target": {"type": "device", "id": "d_2kq9wz3xa5npe7hd"}, "read": true, "quiet": false}], "unread": 1, "latest": 1842} - Errors: 400 →
limit must be 1 to 200.
GET /api/notifications · from openapi.yaml (getNotifications)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| query | before integer(int64)|null (optional) |
| query | limit integer|null (optional) |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | Notification list → NotificationList {notifications: NotificationView[], unread: integer, latest: integer(int64), update?: UpdateNews|null} |
| 400 | limit must be 1 to 200limit must be 1 to 200 |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
curl
# answers 200; errors 400, 401
curl -sS -X GET 'https://spacebackup.net/account/api/notifications?before=120&limit=50' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/notifications?before=120&limit=50",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/notifications?before=120&limit=50")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/notifications?before=120&limit=50");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/notifications/read#
- Auth: signed in.
- Request:
{"ids": [1842, 1839]}or{"all": true}. Ids of someone else are ignored. - Response: 200
{"unread": 0}. - Errors: 400 →
ids or all is required,at most 1000 ids at a time.
POST /api/notifications/read · from openapi.yaml (postNotificationsRead)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json NotificationsReadRequestids integer(int64)[]all boolean|null |
| 200 | OK → NotificationsUnread {unread: integer} |
| 400 | ids or all is required, at most 1000 ids at a timeids or all is requiredat most 1000 ids at a timebad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
curl
# answers 200; errors 400, 401
curl -sS -X POST 'https://spacebackup.net/account/api/notifications/read' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"ids":[1842,1839]}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/notifications/read",
method="POST",
data=json.dumps({"ids": [1842, 1839]}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/notifications/read")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"ids":[1842,1839]}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/notifications/read");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"ids":[1842,1839]}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/notifications/wait#
The long-poll: answers as soon as there is a notification newer than after.
- Auth: signed in.
- Query:
after=<id>,timeout=<seconds>? (default 25, at most 55),update=<ms>? (desktop apps: thepublishedof the last update push they had,0for none). - Response: 200 Notification list with the notifications newer than
after, oldest first (up to 200), as soon as there is one; with none after the timeout. Withoutafterit answers at once, withlatestto wait after. Withupdate=it also answers at once when the update feed has a newer version for the device's platform than that publication (an update push, auto-update), carrying"update": {"version": "0.: the version of the feed for the device's16. 158", "published": 1762640000000} os(windows,linux,macos; other devices never get it) and when the service saw it published (Unix ms, the next poll'supdate=). The app then checks the feed itself, with its usual rules. Thesynccarries the sameupdate, so a PC offline at the moment hears it at its first sync back. A desktop keeps one open at a time; one it misses shows in the nextsync(notifications.latest). The hold is the timeout to the second; give the call your own limit of the timeout plus 10-15 s, and when that runs out simply ask again (a dropped connection, not an error).
curl -s "https://spacebackup.net/account/api/notifications/wait?after=1842&timeout=55" \
-H "Authorization: Bearer $TOKEN" -H "X-SpaceBackup-Version: 1.8.2"
GET /api/notifications/wait · from openapi.yaml (getNotificationsWait)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| query | after integer(int64)|null (optional) |
| query | timeout number|null (optional) |
| query | update integer(int64)|null (optional) |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | Notification list with the notifications newer than `after`, oldest first (up to 200), as soon as there is one → NotificationList {notifications: NotificationView[], unread: integer, latest: integer(int64), update?: UpdateNews|null} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
curl
# answers 200; errors 401
curl -sS -X GET 'https://spacebackup.net/account/api/notifications/wait?after=41&timeout=25&update=1' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/notifications/wait?after=41&timeout=25&update=1",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/notifications/wait?after=41&timeout=25&update=1")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/notifications/wait?after=41&timeout=25&update=1");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/me/notifications#
Which kinds are pushed and popped up (the history keeps everything).
- Auth: signed in (for someone in no company the setting is kept per email).
- Response: 200
{"albumAdds": true, "kinds": {"album-added": true, "shared": true, "key-waiting": true, "device-joined": false, "restore-approval": true, "relay-credit": true, "invitation-accepted": true, "remove-request": true, "album-auto-added": true, "assistant-job": true, "album-job": true, "drive-nearly-full": true, "vision-coverage": true, "vision-attention": true}}All kinds default to on.
albumAddsis the same setting askinds["album-added"].
GET /api/me/notifications · from openapi.yaml (getMeNotifications)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | All kinds default to on. `albumAdds` is the same setting as `kinds["album-added"]` → NotificationsView {albumAdds: boolean, kinds: map<string,boolean>} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
curl
# answers 200; errors 401
curl -sS -X GET 'https://spacebackup.net/account/api/me/notifications' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/me/notifications",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/me/notifications")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/me/notifications");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");PUT /api/me/notifications#
- Auth: signed in.
- Request:
{"albumAdds"?: false, "kinds"?: {"device-; only the kinds given change. Turning album adds off also drops the album pushes waiting for the caller.joined": false}} - Response: 200, the same shape as GET.
- Errors: 400 →
albumAdds or kinds is required,unknown notification kind x (one of album-,added, shared, …) albumAdds and kinds["album-.added"] disagree
PUT /api/me/notifications · from openapi.yaml (putMeNotifications)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json NotificationsRequestalbumAdds boolean|nullkinds map<string,boolean> |
| 200 | The same shape as GET → NotificationsView {albumAdds: boolean, kinds: map<string,boolean>} |
| 400 | albumAdds or kinds is required, unknown notification kind x (one of album-added, shared, …), albumAdds and kinds["album-added"] disagreealbumAdds and kinds["album-added"] disagreealbumAdds or kinds is requiredbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
curl
# answers 200; errors 400, 401
curl -sS -X PUT 'https://spacebackup.net/account/api/me/notifications' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"albumAdds":false,"kinds":{"device-joined":false}}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/me/notifications",
method="PUT",
data=json.dumps({"albumAdds": False, "kinds": {"device-joined": False}}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/me/notifications")!)
req.httpMethod = "PUT"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"albumAdds":false,"kinds":{"device-joined":false}}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Put, "https://spacebackup.net/account/api/me/notifications");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"albumAdds":false,"kinds":{"device-joined":false}}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/me/settings#
The member's own settings (Vladimir 2026-10-31).
- Auth: signed in (someone who is not an active member of a company gets the defaults).
- Response: 200
{"autoAcceptCompany": true, "languages": ["ru", "en"], "companyLanguages": ["en", "ru", "fr"], "selectAllSkipsWork": false}autoAcceptCompany(defaulttrue): Automatically accept albums shared by people in my company. On, an album shared by someone of the member's company is theirs at once; off, it arrives as an invitation (Invitations & guests), like albums from outside the company. Invitations from outside are not affected (trusted senders stay for them).languages(2026-11-05): the languages the member reads, up to 3, in their order; **the first is also the apps' interface language**. The codes are Agent Voice Mode's 14:en,fr,es,de,it,pt,pl,sv,nl,tr,ru,uk,zh,ja.[]: none picked (the apps keep the device's language; search and the assistant answer in English and the request's language). Photos and videos get their keywords, descriptions and video moments in these languages (the company's PCs writecompanyLanguages, the union of its members', at most 5, English first); search and the assistant answer the member in them (docs/languages.md).selectAllSkipsWork(2026-11-08, defaultfalse): the date separator's Select all › Exclude work photos switch, remembered for the member on every app: on, Select all skips every item whose label is work (the user's work mark first, else Space Vision'swork.conf >= 0.6), photos and videos alike. Absent from an older service:false.
GET /api/me/settings · from openapi.yaml (getMeSettings)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | `autoAcceptCompany` (default `true`): Automatically accept albums shared by people in my company → MeSettingsView {autoAcceptCompany: boolean, languages: string[], companyLanguages: string[], selectAllSkipsWork: boolean} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
curl
# answers 200; errors 401
curl -sS -X GET 'https://spacebackup.net/account/api/me/settings' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/me/settings",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/me/settings")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/me/settings");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");PUT /api/me/settings#
- Auth: an active member.
- Request:
{"autoAcceptCompany": false, "languages": ["ru", "en"], "selectAllSkipsWork": true}; a field left out keeps its setting. TurningautoAcceptCompanyon does not accept the invitations already there (they stay pending or declined).languages: 1 to 3 codes, no repeats (case and a region tag are ignored:pt-BRispt);[]clears them. The member's other devices get achangedpush (settings); when the company's languages change with it, every device of the company getslanguages, and its PCs write the new language for the items they already did, once, in the background. - Response: 200, the same shape as GET.
- Errors: 400 →
unknown language "ko" (one of en, fr, …),"ru" is given twice,at most 3 languages a member. 403 →only an active member of a company has these settings.
PUT /api/me/settings · from openapi.yaml (putMeSettings)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json MeSettingsRequestautoAcceptCompany boolean|nulllanguages string[]selectAllSkipsWork boolean|null |
| 200 | The same shape as GET → MeSettingsView {autoAcceptCompany: boolean, languages: string[], companyLanguages: string[], selectAllSkipsWork: boolean} |
| 400 | unknown language "ko" (one of en, fr, …), "ru" is given twice, at most 3 languages a memberbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only an active member of a company has these settingsonly an active member of a company has these settings |
curl
# answers 200; errors 400, 401, 403
curl -sS -X PUT 'https://spacebackup.net/account/api/me/settings' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"autoAcceptCompany":false,"languages":["ru","en"],"selectAllSkipsWork":true}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/me/settings",
method="PUT",
data=json.dumps({"autoAcceptCompany": False, "languages": ["ru", "en"], "selectAllSkipsWork": True}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/me/settings")!)
req.httpMethod = "PUT"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"autoAcceptCompany":false,"languages":["ru","en"],"selectAllSkipsWork":true}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Put, "https://spacebackup.net/account/api/me/settings");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"autoAcceptCompany":false,"languages":["ru","en"],"selectAllSkipsWork":true}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");PUT /api/devices/push#
Sets the calling device's push token: an iPhone's or iPad's Apple push (APNs) token, or an Android phone's Firebase Cloud Messaging (FCM) registration token.
- Auth: the device's own device token (a registered device, or a guest device). A web session gets 401; an unregistered or removed device 403.
- Request:
{"token": "<hex APNs device token>", "env": "production", "app"?: "net..spacebackup. ios", "tz"?: "America/ Chicago"} tz: the phone's time zone, as X-SpaceBackup-TimeZone.envis the APNs environment the app was built for (sandboxorproduction);appthe bundle id (the APNs topic; defaultnet.spacebackup.ios).{"token": null}removes the token. Android:{"token": "<FCM registration token>", "provider": "fcm", "app"?: "net.(spacebackup. android", "tz"?: "Europe/ Berlin"} envunused; the token is URL-safe text up to 4096 characters,A–Za–z0–9_-:., kept as it is).providerabsent (orapns) is an APNs token, as before. - Response: 204. A token that another device still held (the app reinstalled) moves to the caller, so a phone gets
one push. Tokens are dropped when APNs or FCM answers that they are gone (APNs 410, FCM
UNREGISTEREDor 404), or when the device is removed. - Errors: 400 →
token must be the APNs device token in hex,env must be sandbox or production,app must be the app's bundle id,provider must be apns or fcm,token must be the FCM registration token (URL-.safe text, at most 4096 characters)
PUT /api/devices/push · from openapi.yaml (putDevicesPush)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json PushTokenRequesttoken string|nullenv string|nullapp string|nulltz string|nullprovider string|null |
| 204 | No Content |
| 400 | token must be the APNs device token in hex, env must be sandbox or production, app must be the app's bundle id, provider must be apns or fcm, token must be the FCM registration token (URL-safe text, at most 4096 characters)token must be the FCM registration token (URL-safe text, at most 4096 characters)token must be the APNs device token in hexenv must be sandbox or productionprovider must be apns or fcmapp must be the app's bundle idbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a companythis device is not registered (devices/register, or guest/devices/register outside a company)this device is not registered (devices/register) |
curl
# answers 204; errors 400, 401, 403
curl -sS -X PUT 'https://spacebackup.net/account/api/devices/push' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"token":"<hex APNs device token>","env":"production","app":"net.spacebackup.ios","tz":"America/Chicago"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/push",
method="PUT",
data=json.dumps({"token": "<hex APNs device token>", "env": "production", "app": "net.spacebackup.ios", "tz": "America/Chicago"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/push")!)
req.httpMethod = "PUT"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"token":"<hex APNs device token>","env":"production","app":"net.spacebackup.ios","tz":"America/Chicago"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Put, "https://spacebackup.net/account/api/devices/push");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"token":"<hex APNs device token>","env":"production","app":"net.spacebackup.ios","tz":"America/Chicago"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Push payloads#
What a phone receives (APNs, apns-push-type: alert):
| Event | Payload | Collapse id |
|---|---|---|
| photos added to an album | {"aps": {"alert": {"title": "Las Vegas", "body": "Bob Jones added 12 photos and videos"}, "sound": "default", "thread- (one: "added 1 photo or video"; at most one per album per 5 minutes) | album-<id> |
| an album shared with you | {"aps": {"alert": {"title": "Las Vegas", "body": "Anna Smith shared an album with you"}, "sound": "default"}, "album": "al_ | album-<id> |
| an album invitation | {"aps": {"alert": {"title": "Las Vegas", "body": "Anna Smith invited you to a shared album"}, "sound": "default"}, "invite": "inv_ | invite-<id> |
| every other kind | {"aps": {"alert": {"title", "body"}, "sound": "default"}, "notification": 1842, "kind": "key- | <type>-<id> |
The name in a body is the person's display name, else their email.
Android (FCM) gets the same pushes, to the same people with the same coalescing and opt-outs, as FCM HTTP v1 **data
messages** (no notification part: the app builds the notification and its tap target itself). Every value is a string:
title, body, kind (album-added, shared for a share or an invitation, else the notification's kind), and the
payload's other keys as they are (album, invite, notification; target as its JSON, {"type":"key-).
Alerts go with "android": {"priority": "high", "collapse_, for example
`{"message": {"token": "…", "data": {"kind": "album-added", "title": "Las Vegas", "body": "Bob Jones added 12 photos and
videos", "album": "al_…"}, "android": {"priority": "high", "collapse_key": "album-al_…"}}}`. A changed push (below) is
{"data": {"changed": "albums,album:al_ (the topics comma-separated; v as its
JSON when it has one).
Changed pushes#
Besides the alerts, every change a phone shows sends a silent background push (iOS request #56) to each device of each member concerned, so an open app re-reads that part at once:
{"aps": {"content-available": 1}, "changed": ["albums", "album:al_…"]}
It goes with apns- and apns-priority: 5, no alert, sound or badge, and holds topics only:
never a name, a title, an email or a count. The device that made the change is left out; only devices with a push token
get one. A TV (a Fire TV has no FCM) gets the same topics of its member, forms excepted, on its long poll
tv/changed/wait while it is open, never a push: "to the member" below means the member's
listening TVs too (a PC's backups/vision for a device: that device's member's TVs). A PC (no push token either)
gets them the same way on devices/changed/wait while its window is open, and its
window re-reads that part at once.
| Topic | When | To |
|---|---|---|
albums | an album made, renamed, deleted; its cover, destinations, who may add; shared, unshared, left, turned off or on by a member; an invitation to it made, answered or withdrawn; a public link to the whole album made, changed or revoked | the owner and every member (a guest on all their devices) |
album:<id> | items added (albums/{id}/added), the item count or removed items reported, the cover, who may add; a remove request (to the owner) | the owner and the members |
shares | a device's backups shared or stopped; a member removed (their shares end) | the recipient, the device's member, whoever shared or stopped it; everyone in the company for a removal |
shares (2026-11-03) | a single device removed: the shares of its backups end | everyone its backups were shared with, and the device's member |
shares (2026-11-03) | a restore request decided (approved, denied, or released at once to the same member's device; me/approvals, the admin page, a mailed link) | the requester's devices (the requesting one too), the source device's member and the owners/admins |
invitations | an album invitation made, accepted, declined, withdrawn, or its album deleted | the invitee |
groups | the member's groups made, changed, deleted (Coworkers hidden or shown) | the member |
devices | a device joined, renamed, labelled, removed, got the company key (first ack, or a key release approved) | owners/admins and the device's member |
devices (2026-11-03) | a member's name set (by them or an admin), a join approved, a member removed, the company's name or Recognize faces changed | every device of every active member of the company |
devices (2026-11-03) | a member's role changed or join denied; a TV paired, removed or signed out; an iCloud source added or removed | owners/admins and that member |
devices (2026-11-03) | a key handed to a device that waits for it (devices/deliver) | that device |
devices (2026-11-03) | the company key set or rotated (company/key); a device's signing key replaced (devices/{id}/signing-key, a new key only) | every device of every active member of the company |
backups | a date of this device became complete on a PC (the PC reports it: POST /) | that device |
vision | a vision pass over this device's items finished (the PC reports it) | that device |
forms | a PC asks this phone for another form on one of its drives (Encrypt… / Don't encrypt…; the PC reports it, the phone reads forms) | that device |
backups:<device> | items of that device's backups moved to Deleted or Archived, put back, or deleted for good (the PC reports it with its v) | every device of that device's member and of everyone its backups are shared with |
faces | the member's people book changed: a name given, a merge, split, move, reject, hide, delete or stranger, from a phone, the PC's window or CLI (the PC where it was made reports it; a book taken from another PC is not reported again; iOS request #84) | the member's other devices: of from's member, else of the PC's member; the device that made it and the PC left out |
faces (2026-11-03) | the company's face names on the service: a new name, its spelling, its member or its other names (POST faces/names; one more use of a name: none), a name or all of them forgotten (DELETE faces/names) | every device of every active member of the company |
computers (2026-11-03) | a PC's setup others read: a backed-up folder added or removed, its frequency, destinations, retention or encryption (folders add/remove/set, Backed-up folders…); an iCloud source added, removed or set (icloud add/remove/set); a Google Drive account added, removed, moved or set (gdrive add/); a setting others read (settings set max-backups, frequency, night-window, incoming, name-first, scrub, rearrange-wait-days, dead-run-hours, album-put-max-gb). The PC reports it with company: true; re-read that PC's folders, sources and keep count | every device of every active member of the company |
destinations | a destination of a PC added, removed or changed (LAN path, drive kind), or another PC's destination forgotten on one (the PC reports it with company: true); re-read destinations, copy counts and storage | every device of every active member of the company |
notifications | the inbox changed with no alert: read on another device, resolved, a quiet kind, an album add (its alert is coalesced) | the member |
pictures | a member's own picture set or removed (PUT /api/me/picture, DELETE; requests #125); re-read GET /api/people (and GET /api/me) and the pictures whose version changed | every device of every active member of the company (in no company: the member's other devices) |
languages (2026-11-05) | the company's languages changed: a member picked, changed or cleared their languages and the union (company.languages) is another; re-read GET /api/me/settings (companyLanguages) or the session | every device of every active member of the company |
work (2026-11-08) | a member marked items work or not work (POST /api/work/marks, changed > 0); re-read GET / | every device of every active member of the company, the marking device too |
links (2026-11-08) | a public link to items (kind item or selection) made, its end changed (PATCH) or revoked; re-read GET /api/links (Settings › Public links, About's Create public link) | the link's maker's devices, and the caller's own other devices when an owner/admin changed someone else's link; the device that made the change left out |
settings | the member's own settings (me/settings: autoAcceptCompany, languages, selectAllSkipsWork), notification settings (me/notifications), trusted senders or own birth (PUT /api/me) changed on another of their devices or the web page | the member |
Coalescing: a topic goes to a device at once, then at most once every 10 seconds (push.changedSeconds); a topic
a PC reports with topics (backups, vision, forms) at most once every 5 minutes (push.changedPcSeconds); faces,
a person's own change, keeps the 10 seconds. Changes
meanwhile go in one push at the end of the window, each topic once. Different topics do not hold each other up. At most
20 topics go in one push (more go in the next).
Change counters (#70): when a PC reports a batch of changes to one part (backups:<device>, or an album's items as
album:<id>) with its counter, the push also carries v, the part's new counter at that PC, and still no item id:
{"aps": {"content-available": 1}, "changed": ["album:al_…"], "v": {"album:al_…": "pc_7f3a:42"}}
The device asks that PC for the changes since the counter it holds (album.changes / backups.changes, over the
relay); the ids travel only between devices and PCs. A newer counter queued before the push goes replaces the older; a
change of the same topic without a counter (made on the service) drops it, and the device reads the part as before.
POST /api/devices/changed#
A PC reports what it finished for a device, so that device's app updates at once (a changed push, above).
- Auth: a device token of an active member (a web session gets 403
only a device reports its changes). - Request:
{"topics": ["backups"], "device"?: "d_.…"} topics:backups(a date of the device became complete on this PC: replication, rearrangement) and/orvision(a vision pass over its items finished; once per pass, not per item) and/orforms(the PC asks the device for another form on a drive: it reads peerforms) and/orfaces(a member's people book changed on this PC, #84).device: the device it was for (any active device of the caller's company); without it, the caller's own member's other devices. faces(iOS request #84):{"topics": ["faces"], "from"?: "d_, once per book change made on this PC (…"} faces.name,merge,split,move,reject,hide,delete,stranger), not for a book taken from another PC (faces.book.put: the PC where it was made reported it).from: the device that made the change (a phone over the relay; any active device of the caller's company): its member's other devices getfaces, that device and the calling PC left out. Withoutfrom(the PC's own window or CLI): the PC's member's other devices.fromgoes withfacesalone, never withdevice. Only the member's own devices: the people a photo is shared with see the new names at their next read.facesto the whole company (docs/faces.md#member-names, 0.16.54): `{"topics": ["faces"], "from"?: "d_…", "company": true}` when a change made on the PC made, changed or removed a person's link to a member (that member's name is seen by everyone in the company): every device of every active member of the company getsfaces, the calling PC andfromleft out.companygoes withfaces,destinationsorcomputers, never withdevice.destinationsto the whole company (2026-11-03, the standard rule: every change notifies):{"topics": ["destinations"], "company": true}when a destination of the PC was added, removed or changed (its LAN path, its drive kind) or another PC's destination was forgotten there: every device of every active member of the company getsdestinations, the calling PC left out, and re-reads its destinations, copy counts and storage (peerstat/status).destinationsgoes withcompany: truealone. The other PCs hear it at once from the PC's announcement (LAN and Space Relay), not from the service.computersto the whole company (2026-11-03, the same rule):{"topics": ["computers"], "company": true}when the PC's setup others read changed: a backed-up folder added or removed, or its frequency, destinations, retention or encryption; an iCloud source or a Google Drive account added, removed, moved or set; a setting ofIdentityService.(the keep count peerSettingsOthersRead statusanswers, when and how backups run, the dated layout). Changes within 2 s go in one call. Every device of every active member of the company getscomputers, the calling PC left out.computersgoes withcompany: truealone.- Or (#70) one part and its counter:
{"topic": "backups:d_or `{"topic": "album:al_…", "v": "<pc>:42"}…", "v": "<pc>:17"} , one call per batch of changes made on the PC.backups:<device>` goes to every device of that device's member and of everyone its backups are shared with,album:<id>to the album's owner and members; the calling PC is left out, and the push carriesv(above). Never the item ids. - Response: 204, also when push is off (nothing is kept then).
- Errors: 400 →
topics is required,unknown topic x (one of backups, vision, forms, faces, destinations, computers),from goes with the topic faces alone,company goes with the topics faces, destinations, computers alone,destinations goes with company: true(orcomputers …),v is required as "<pc>:<n>",unknown topic x (backups:<device> or album:<id>). 404 →no such album(unknown, deleted, or of another company). 404 →no such device(unknown, removed, or of another company). 429 →too many change reports (at most 30 a minute)(per calling device,push.).changedCallsPerMinute - The PCs (0.13.3): each PC posts
{"topics":["backups"],"device":<the phone's id>}once per date of a device that became complete on it (the device's own run, a replica from the primary, a rearrangement, a dead run it closed) and{"topics":["vision"],"device":…}once per vision pass that rewrote that device's month index; any PC of the company may report for any device of it. The id comes fromGET devices/key?name=(kept an hour). Best-effort: the call never holds up a run; a failure (the service unreachable, a 429) is logged and not retried.
POST /api/devices/changed · from openapi.yaml (postDevicesChanged)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json DeviceChangedRequesttopics string[]device string|nulltopic string|nullv string|nullfrom string|nullcompany boolean|null |
| 204 | Also when push is off (nothing is kept then) |
| 400 | topics is required, unknown topic x (one of backups, vision, forms, faces, destinations, computers), from goes with the topic faces alone, company goes with the topics faces, destinations, computers alone, destinations goes with company: true (or computers …), v is required as "<pc>:<n>", unknown topic x (backups:<device> or album:<id>)topics is requireddevice too longfrom too longfrom goes with the topic faces alone<only> goes with company: truev is required as "<pc>:<n>"unknown topic <topic> (backups:<device> or album:<id>)bad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddenonly a device reports its changesnot an active member of a companythis device is not registered (devices/register) |
| 404 | no such album (unknown, deleted, or of another company)no such deviceno such album |
| 429 | too many change reports (at most 30 a minute) (per calling device, push.changedCallsPerMinute)too many change reports (at most <changedCallsPerMinute> a minute) |
curl
# answers 204; errors 400, 401, 403, 404, 429
curl -sS -X POST 'https://spacebackup.net/account/api/devices/changed' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"topics":["backups"],"device":"d_…"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/changed",
method="POST",
data=json.dumps({"topics": ["backups"], "device": "d_…"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403, 404, 429
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/changed")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"topics":["backups"],"device":"d_…"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403, 404, 429
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/devices/changed");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"topics":["backups"],"device":"d_…"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403, 404, 429
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/devices/changed/wait#
The changed pushes for a PC: a computer has no APNs or FCM token, so while its Space Backup window is
open (the window's own long poll on the PC, GET /api/changed/wait; the desktop app)
the PC keeps this long poll open, as an open TV keeps tv/changed/wait. The service holds
the request up to 25 seconds and answers as soon as something its member's devices are pushed changes (the same topics,
coalesced the same way; forms excepted); the changes this PC made or reported itself are left out (it knows them). The
PC asks again at once and its window re-reads those parts. A newer wait of the same device ends the older (204). Changes
are queued for a PC only while it listens (a wait open, or one ended within the last 40 seconds); a PC whose window is
closed gets nothing, and the window reads everything when it opens. Kept in memory only.
- Auth: a device's token (a TV's: 403).
- Response: 200
{"changed": ["albums", "album:al_, or 204 when nothing changed.5k2m9x7q3w1c8v4b"], "v": null} - Errors: 403 →
for a device's token only; 403 →this device is not registered (devices/(removed).register)
POST /api/devices/changed/wait · from openapi.yaml (postDevicesChangedWait)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | Or 204 when nothing changed |
| 204 | 200 {...}, or 204 when nothing changed |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | for a device's token only;for a device's token onlythis device is not registered (devices/register) |
curl
# answers 200, 204; errors 401, 403
curl -sS -X POST 'https://spacebackup.net/account/api/devices/changed/wait' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/changed/wait",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200, 204; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/changed/wait")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200, 204; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/devices/changed/wait");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200, 204; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/devices/notify#
A PC says that one of its drives a device backs up to is nearly full (nearly full drives): the device's member gets one alert, in the inbox and as an APNs push to their devices.
- Auth: a device token of an active member (a web session gets 403
only a device reports its drives). - Request: `{"device": "d_…", "kind": "drive-nearly-full", "drive": "mars-001 /home/space", "freeBytes": 65485598720,
"totalBytes": 2000398934016, "text": "Space Backup: mars-001 /home/space is nearly full (61 GB left). New backups go to your other drives until space is freed."}`.
device: a device of the caller's company whose backups are on the drive.drive: the PC and drive in words, at most 200 characters.text: the alert's words (at most 300 characters; without it the service writes them fromdriveandfreeBytes). - What the member gets: a notification of kind
drive-nearly-full(title "<drive>is nearly full", bodytext,target: {type: "destination", id: <drive>}), pushed unless they turned the kind off. An unread one about the same drive from the last 24 hours is not repeated (two phones of one member get one alert). - Response: 204.
- Errors: 400 →
unknown kind x (one of drive-,nearly- full, vision- coverage, vision- attention, vision- open) device is required,drive is required. 404 → `no such device(unknown, removed, or of another company).too many change reports (at most 30 a minute)` (shared with429 → devices/changed). - The PCs (0.16.10): the PC whose drive it is posts once per phone with backups on the drive and per episode (the drive became nearly full; again only after it cleared and filled again); a failure is tried again 10 minutes later.
- Kind
vision-attention(the watch, 0.16.169): a PC says photo analysis needs the user, in plain words: `{"device": "<the PC itself>", "kind": "vision-attention", "drive": "<the finding's key, e.g. no-worker, holder|CHIA3>", "text": "No PC with a suitable graphics card is online: 120 photos wait to be analysed. …"}(text` at most 400 characters). Only what the PCs cannot end themselves, once it lasted (no worker 30 min, a PC holding backups quiet 2 h, analysis stuck 1 h, a PC not updated 6 h; and a damaged backup copy its device answered gone or damaged there too, or did not answer in 3 days (re-send): keyresend|gone|<device>,resend|same|<device>,resend|failed|<device>orresend|unanswered|<device>, naming the files, told once, titled "Damaged backup copies" and never resolved byvision-open: it stands until read); routine self-healing and what the PCs gave up on (a bug of ours) never come here. The company's owners get a notification of kindvision-attention(title "Photo analysis needs you", bodytext,target: {type: "vision", id: <key>}), pushed unless they turned the kind off; an unread one about the same key from the last 24 hours is not repeated. One PC of the company sends it (the first by name of those running the watch). 400 →drive (the finding's key) is required,text is required. - Kind
vision-open(the watch, 0.16.187; Vladimir, 2026-11-10): the PC that tells the watch's attentions says which findings still stand, after a check that heard every PC holding phone backups:{"device": "<the PC itself>", "kind": "vision-(an empty list: none stands). Every unreadopen", "open": ["audit|damaged|Marinas- iPad", …]} vision-attentionof the company whose key is not inopenis resolved: marked read, its title becomes "Photo analysis: resolved" and its body "Resolved: <its words>", and each of its owners' devices gets the silentnotificationspush (iOS, Android, the TVs' long poll, the PCs' windows re-read the inbox: the unread count and the alert go on every app). Sent when the findings change, else once an hour. 400 → `open (the findings that still stand) is required`.
POST /api/devices/notify · from openapi.yaml (postDevicesNotify)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json DeviceNotifyRequestdevice string|nullkind string|nulldrive string|nullfreeBytes integer(int64)|nulltotalBytes integer(int64)|nulltext string|nullopen string[] |
| 204 | No Content |
| 400 | unknown kind x (one of drive-nearly-full, vision-coverage, vision-attention, vision-open), device is required, drive is requiredunknown kind <kind> (one of <driveNearlyFull>, <visionCoverage>, <visionAttention>, <visionOpenKind>)device is requireddrive is requireddrive (the host PC) is requiredtext is requireddrive (the finding's key) is requiredopen (the findings that still stand) is required<name> must be a string<name> is too longbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddenonly a device reports its drivesnot an active member of a companyonly a device reports its coveragethis device is not registered (devices/register)only a device reports what its photo analysis needs |
| 404 | no such device (unknown, removed, or of another company)no such device |
| 429 | too many change reports (at most 30 a minute) (shared with devices/changed)too many change reports (at most <changedCallsPerMinute> a minute) |
curl
# answers 204; errors 400, 401, 403, 404, 429
curl -sS -X POST 'https://spacebackup.net/account/api/devices/notify' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"device":"d_…","kind":"drive-nearly-full","drive":"mars-001 /home/space","freeBytes":65485598720,"totalBytes":2000398934016,"text":"Space Backup: mars-001 /home/space is nearly full (61 GB left). New backups go to your other drives until space is freed."}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/devices/notify",
method="POST",
data=json.dumps({"device": "d_…", "kind": "drive-nearly-full", "drive": "mars-001 /home/space", "freeBytes": 65485598720, "totalBytes": 2000398934016, "text": "Space Backup: mars-001 /home/space is nearly full (61 GB left). New backups go to your other drives until space is freed."}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403, 404, 429
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/devices/notify")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"device":"d_…","kind":"drive-nearly-full","drive":"mars-001 /home/space","freeBytes":65485598720,"totalBytes":2000398934016,"text":"Space Backup: mars-001 /home/space is nearly full (61 GB left). New backups go to your other drives until space is freed."}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403, 404, 429
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/devices/notify");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"device":"d_…","kind":"drive-nearly-full","drive":"mars-001 /home/space","freeBytes":65485598720,"totalBytes":2000398934016,"text":"Space Backup: mars-001 /home/space is nearly full (61 GB left). New backups go to your other drives until space is freed."}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403, 404, 429
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Space Relay billing#
Space Relay carries traffic between a company's devices when they cannot reach each other directly. Each company gets
5 GB free per calendar month (UTC; relayed in + out; 1 GB = 10^9 bytes), then uses prepaid packs that never
expire: sb_pack_500 (500 GB, $9), sb_pack_2000 (2 TB, $25), sb_pack_5000 (5 TB, $49). Optional auto top-up
buys the chosen pack again when the balance drops below 10 % of it. What people see: Billing.
POST /api/relay/group#
Links the device's relay group to the caller's company, so its relayed bytes are counted to the company. The group id is derived from the company key (only a holder of the key knows it). The apps call it after sign-in and whenever the company key changes.
- Auth: active member.
- Request:
{"groupId": "<64 lower-case hex digits>"} - Response: 204 (also when it was linked already).
- Errors: 400 →
groupId must be 64 lower-. 409 →case hex digits this relay group belongs to another company.
POST /api/relay/group · from openapi.yaml (postRelayGroup)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json RelayGroupRequestgroupId string|null |
| 204 | (also when it was linked already) |
| 400 | groupId must be 64 lower-case hex digitsgroupId must be 64 lower-case hex digitsbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
| 409 | this relay group belongs to another companythis relay group belongs to another company |
curl
# answers 204; errors 400, 401, 403, 409
curl -sS -X POST 'https://spacebackup.net/account/api/relay/group' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"groupId":"<64 lower-case hex digits>"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/relay/group",
method="POST",
data=json.dumps({"groupId": "<64 lower-case hex digits>"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/relay/group")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"groupId":"<64 lower-case hex digits>"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/relay/group");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"groupId":"<64 lower-case hex digits>"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/relay/balance#
- Auth: active member.
- Response: 200
{"month": "2026-10", "freeBytes": 5000000000, "freeUsedBytes": 3210000000, "prepaidBytes": 87000000000, "activationNeeded": false, "autoTopUp": true, "autoTopUpPack": "sb_pack_500", "paymentsEnabled": true, "prepaidTotalBytes": 500000000000, "lowBytes": 50000000000, "usedBytes": 3210000000, "unlimitedUntil": null, "usageLine": "Space Relay this month: 3.2 GB used · 1.8 GB of 5 GB free left · balance 87 GB", "packs": [{"id": "sb_pack_500", "bytes": 500000000000, "cents": 900, "currency": "usd", "name": "Space Relay 500 GB"}, {"id": "sb_pack_2000", "bytes": 2000000000000, "cents": 2500, "currency": "usd", "name": "Space Relay 2 TB"}, {"id": "sb_pack_5000", "bytes": 5000000000000, "cents": 4900, "currency": "usd", "name": "Space Relay 5 TB"}]}Field Meaning monththe current month, YYYY-MM(UTC)freeBytesthe free allowance per month; null= unlimitedfreeUsedBytesfree bytes used this month prepaidBytesthe prepaid balance left (never below 0 here) activationNeededthe month's free bytes are used up and the balance is empty: relayed connections stop until credit is bought (connections on the same network keep working) autoTopUp,autoTopUpPackauto top-up on, and its pack ( nullwhen off)paymentsEnabledthe server can take payments now prepaidTotalByteswhat the prepaid balance was after the last purchase or auto top-up (never below prepaidBytes;0: nothing bought). The apps draw the prepaid bar asprepaidBytesleft of thislowBytesthe "little relay credit is left" mark: a tenth of prepaidTotalBytes(where auto top-up buys again), at least 1 GB. The apps show the balance in red whenprepaidBytes < lowBytespacksthe packs on sale now, as the buy screen sells them: id(the pack),bytes(1 GB = 10^9 bytes),cents(the price),currency(lower case,usd),name. The apps say what relay traffic costs from theseusedBytesthis month's whole relayed traffic: free, prepaid and unlimited unlimitedUntilthe last month ( YYYY-MM) of the company's unlimited relay months (given by the operator, see "Unlimited months" in docs/account-service.md), back-to-back grants joined;null: none covers this month. Until then nothing is taken from the free allowance or the balance andactivationNeededisfalse; the traffic is still counted (usedBytes)usageLinethe line at the top of every app, in English (each app shows it as it is, worded part by part by its string tables): "Space Relay this month: 32 GB used · 18 GB of 50 GB free left" (" · balance 87 GB" when some was bought), "… · 50 GB free used up · balance 38 GB left" / "· no balance left", "Space Relay this month: 110 GB used, no limit" with no free limit, and in unlimited months "Space Relay: unlimited until March 31, 2027 · 125 GB used this month" The apps show it as "Free this month: 3.2 / 5 GB · Prepaid: 87 GB", as bars in Settings › Space Relay, and once the month's free traffic is used, "Relay balance: 87 GB left" at the top of every screen (red when low).
GET /api/relay/balance · from openapi.yaml (getRelayBalance)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | | Field | Meaning | |---|---| | `month` | the current month, `YYYY-MM` (UTC) | | `freeBytes` | the free allowance per month → RelayBalanceView {month: string, freeBytes: integer(int64)|null, freeUsedBytes: integer(int64), prepaidBytes: integer(int64), activationNeeded: boolean, autoTopUp: boolean, autoTopUpPack: string|null, paymentsEnabled: boolean, prepaidTotalBytes: integer(int64), lowBytes: integer(int64), packs: PackView[], usedBytes: integer(int64), unlimitedUntil: string|null, usageLine: string} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
curl
# answers 200; errors 401, 403
curl -sS -X GET 'https://spacebackup.net/account/api/relay/balance' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/relay/balance",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/relay/balance")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/relay/balance");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/relay/buy-link#
A one-time link that opens the buy screen in a browser, already signed in as the device's user.
- Auth: active member.
- Request: no body.
- Response: 200
{"url": "https:/. Single use, valid 15 minutes. Opening it (GET /relay/open) gives the browser a web session for that email, only while it is still an active member of the company./ spacebackup. net/ account/ relay/ open?t= Mq7…", "expiresAt": "2026- 10- 18T09:42:00. 000+00:00"}
POST /api/relay/buy-link · from openapi.yaml (postRelayBuyLink)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | OK → BuyLinkView {url: string, expiresAt: string(date-time)} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
curl
# answers 200; errors 401, 403
curl -sS -X POST 'https://spacebackup.net/account/api/relay/buy-link' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/relay/buy-link",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/relay/buy-link")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/relay/buy-link");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /internal/relay/report#
The relay's usage report. Only the relay running on the same server calls it (it is not reachable through the public web server); integrators never do. Listed for completeness.
- Auth: the header
X-, with the secret the service and the relay share; the timestamp must be within 5 minutes.SpaceRelay- Signature: t= <unix seconds>,v1= <hex HMAC- SHA256(secret, "<t>. <body>")> - Request: every 10 seconds,
{"id": "rep-20261018-091200-0001", "month": "2026-10", "usage": [{"group": "<64 hex>", "bytes": 12884901}], "groups": ["<64 hex>", "<64 hex>"]}usage: bytes relayed (in + out) per group since the relay's last report; applied once perid(a report sent again unchanged changes nothing), the month's free bytes first, then the balance.groups: the groups connected now. - Response: 200, the state of the linked groups only:
{"groups": {"<64 hex>": {"company": "c_k3xq7m2pa9fz4w8r", "activationNeeded": false, "remainingBytes": 88790000000}}}remainingBytes= free bytes left + balance;null= unlimited. A report that takes bytes from the balance can start an auto top-up. - Errors: 400 →
bad JSON: …,empty report, and the checks of the report's content (month must be YYYY-MM,too many groups,bytes must not be negative; these three come back as an HTML error page, since the route is not under/api). 401 →bad signature. 404 → the call came through the public web server. 503 →relay secret not set up (spaceaccount init).
POST /internal/relay/report · from openapi.yaml (postInternalRelayReport)
| Auth | X-SpaceRelay-Signature header (HMAC of the body with the relay secret; only from spacerelay on the same machine) |
|---|---|
| Body | application/json RelayReportid string|nullmonth string|nullusage RelayUsageDelta[]groups string[] |
| 200 | The state of the linked groups only: `remainingBytes` = free bytes left + balance → RelayReportAnswer {groups: map<string,RelayGroupState>} |
| 400 | bad JSON: …, empty report, and the checks of the report's content (month must be YYYY-MM, too many groups, bytes must not be negative; these three come back as an HTML error page, since the route is not under /api)month must be YYYY-MMtoo many groupsbytes must not be negative<name> is required<name> is too long<name> must not contain control charactersempty report |
| 401 | bad signaturebad signature |
| 404 | the call came through the public web servernot found |
| 503 | relay secret not set up (spaceaccount init)relay secret not set up (spaceaccount init) |
curl
# answers 200; errors 400, 401, 404, 503
curl -sS -X POST 'https://spacebackup.net/account/internal/relay/report' \
-H "X-SpaceRelay-Signature: $RELAY_SIGNATURE" \
-H "Content-Type: application/json" \
--data '{"id":"rep-20261018-091200-0001","month":"2026-10","usage":[{"group":"<64 hex>","bytes":12884901}],"groups":["<64 hex>","<64 hex>"]}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/internal/relay/report",
method="POST",
data=json.dumps({"id": "rep-20261018-091200-0001", "month": "2026-10", "usage": [{"group": "<64 hex>", "bytes": 12884901}], "groups": ["<64 hex>", "<64 hex>"]}).encode(),
headers={"X-SpaceRelay-Signature": os.environ["RELAY_SIGNATURE"], "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 404, 503
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let relaySignature = ProcessInfo.processInfo.environment["RELAY_SIGNATURE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/internal/relay/report")!)
req.httpMethod = "POST"
req.setValue("\(relaySignature)", forHTTPHeaderField: "X-SpaceRelay-Signature")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"id":"rep-20261018-091200-0001","month":"2026-10","usage":[{"group":"<64 hex>","bytes":12884901}],"groups":["<64 hex>","<64 hex>"]}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 404, 503
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/internal/relay/report");
req.Headers.TryAddWithoutValidation("X-SpaceRelay-Signature", Environment.GetEnvironmentVariable("RELAY_SIGNATURE"));
req.Content = new StringContent("""{"id":"rep-20261018-091200-0001","month":"2026-10","usage":[{"group":"<64 hex>","bytes":12884901}],"groups":["<64 hex>","<64 hex>"]}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 404, 503
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /stripe/webhook#
Stripe's events about payments. Only Stripe calls it.
- Auth: the
Stripe-Signatureheader, checked with the endpoint's signing secret (HMAC-SHA256 oft.payload, anyv1, timestamp within 5 minutes). - Request: a Stripe event. Handled:
checkout.,session. completed checkout.,session. async_ payment_ succeeded checkout.,session. async_ payment_ failed checkout.session.expired,payment_intent.succeeded,payment_; others are acknowledged and ignored.intent. payment_ failed - Response: 200
{"received": true}. Each event id is handled once, and a purchase is credited once whatever arrives (a retried event, the session and its payment, the success page). A paid amount below the pack's price is not credited (the purchase is kept for review). - Errors: 400
{"received": false}→ a bad or old signature, or not an event. 503{"received": false}→ the webhook secret is not set up on the server.
POST /stripe/webhook · from openapi.yaml (postStripeWebhook)
| Auth | Stripe-Signature header (Stripe's HMAC of the payload with the webhook secret) |
|---|---|
| Body | application/json |
| 200 | OK |
curl
# answers 200
curl -sS -X POST 'https://spacebackup.net/account/stripe/webhook' \
-H "Stripe-Signature: $STRIPE_SIGNATURE" \
-H "Content-Type: application/json" \
--data '{}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/stripe/webhook",
method="POST",
data=json.dumps({}).encode(),
headers={"Stripe-Signature": os.environ["STRIPE_SIGNATURE"], "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let stripeSignature = ProcessInfo.processInfo.environment["STRIPE_SIGNATURE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/stripe/webhook")!)
req.httpMethod = "POST"
req.setValue("\(stripeSignature)", forHTTPHeaderField: "Stripe-Signature")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/stripe/webhook");
req.Headers.TryAddWithoutValidation("Stripe-Signature", Environment.GetEnvironmentVariable("STRIPE_SIGNATURE"));
req.Content = new StringContent("""{}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Assistant#
The iPhone assistant runs on Apple's on-device model where it can. Phones without Apple Intelligence send the
request here instead. The service only plans: it turns the words into the app's own actions and returns them; the
phone shows say and runs the actions only after the person confirms. See Assistant.
POST /api/assistant#
- Auth: a registered device of an active member, by its device token. In developer mode also the admin page's web
session (cookie
sa_sessionplusX-CSRF-Token): that is the page's Developers box. - Request:
{"text": "back up all photos from my last Chicago trip", "today": "2026-10-14", "context": {"places": [{"name": "Chicago", "count": 412}], "trips": [{"name": "Chicago, Sep 2026", "place": "Chicago", "from": "2026-09-03", "to": "2026-09-06", "count": 412}], "kinds": {"photo": 5000, "video": 300}}}Field Rules text1–1,000 characters; line breaks become spaces todaythe phone's local date, YYYY-MM-DD(relative dates count from it)mode?developer: a developer's question about the APIs (see below);todaymay then be left out.select-assist: a computer's photo selection box; planned exactly as a phone's request, counted apart in the usagelanguage?the code sample's language in developer mode: curl(default),python,swiftorcsharpcontext?the phone's place names and found trips, newest first. At most 200 places and 100 trips are used; names are cut to 80 characters; dates that are not YYYY-MM-DDare dropped.kindsis any small JSON value (up to 2,000 characters, else left out).appCommands([{"id", "what"}], at most 100) are the app's own commands it runs as anapp_commandaction, andpcs(names, at most 50) the company's computers, forpc_space.history([{"q", "a"}], the chat's exchanges before this request, oldest first; the last 3 are used,acut at 800 characters) makes the request a follow-up: it is read, searched in the manual and cached with them.appSettings(names, at most 100) are the app's own settings; an answer about one names it exactly so.languages(codes, first first, at most 3 of the 14 ofme/settings; unknown ones dropped) are the asker's languages, which the answer is in; absent: the member's ownme/settingslanguages.geo:1when the app readsshow_items'geofilter (below); the bareplaceis then left out wherevergeohas it
- Response: 200
{"actions": [ {"tool": "add_backup_rule", "input": {"type": "picked", "place": "Chicago", "from": "2026-09-03", "to": "2026-09-06", "kind": "photo"}}, {"tool": "start_backup", "input": {}}], "say": "Back up the photos from your Chicago trip, 3 to 6 Sep 2026."}or only
{"say": "I can't change where backups go; that is set in the Backup tab.when nothing fits (no"} actionskey).sayis one plain line, at most 300 characters.The tools a plan may use (dates
YYYY-MM-DD, inclusive;kindisphoto,videoorany):Tool Input What the phone does find_tripsplace?,last?lists the person's trips, newest first count_itemsplace?,from?,to?,kindcounts photos and videos add_backup_ruletype(place|period|picked),place?,from?,to?,back?,unit? (day|month|year),kind?place: everything at the place from now on;period: between two dates, or going backbackunits;picked: a one-time pick (kindonly here)show_itemsscope(own|shared),place?,from?,to?,kind?,content?,exclude?,people?,exclude_people?opens the Photos tab or Shared with me, filtered ( people: the names fromcontext.peoplethe items must show;exclude_people: those they must not)start_backupnone backs up now (still under the Wi-Fi rule) make_albumname,place?,from?,to?,kind?,trips? (all|last),content?,exclude?,people?,exclude_people?makes an album and fills it with the matching items app_commandid,pc?runs one of the app's own commands the request's context.appCommandsoffered: opens a place, answers from the app's data, or presses a buttonapp_command(iOS request #109): apps that can open their own places, answer from their own data and press their own buttons send them ascontext.appCommands, for examplebalance,free_tier,top_up,relay_price,processed_photos,processed_videos,processed_faces,albums,backup_space,pc_space(withpc) andopen_<place>(open_notifications,open_workers,open_relay,open_drives, …), each withwhatit does in words. "How much room is left on chia2?" plans{"tool": "app_(command", "input": {"id": "pc_ space", "pc": "chia2"}} pcas the app spells it incontext.pcs; left out when none). Only an id the request offered comes back; an app that sends none never gets anapp_command.top_uponly opens the purchase page: nothing is bought without the person.Geography (docs/geography.md):
show_items,make_albumandcount_itemsalso carrygeo, the filter for the place, region, water, band of latitude or hemisphere the words name (`{"place": {"level", "id", "name"}, "region", "continent", "water": {"kind", "name"}, "lat": {"min", "max"}, "lon": {"min", "max"}, "hemi"}, every key optional, all must hold;lon` withmin>maxcrosses ±180°),geoLabel("Las Vegas area") and, for an ambiguous name,geoCandidates([{"geo", "label"}], the first is the one used, the request'scontext.placesfirst: "Paris, Texas" before "Paris, France" when the photos are there). A place written as the phones keep it ("Paris, Texas, United States") is its first part, of the rest; a first part the geography does not know keeps the bareplace. "Masha in Vegas" plans `{"scope": "own", "people": ["Masha"], "geo": {"place": {"level": "metro", "id": "geonames:5506956", "name": "Las Vegas"}}, "geoLabel": "Las Vegas area"}; "north of the Arctic Circle""geo": {"lat": {"min": 66.56}}` with the words taken out ofcontent.placestays when nothing resolves, and for an app withoutcontext.geo.contentis what the items show, free text in the person's words ("night views", "photos of my dog", "screenshots", "red cars"), matched by the phone against its own recognition of the photos; place and dates are still taken out of the words. "Create an album called night Chicago and put all the night views of Chicago in it" plans{"tool": "make_with the sentence "Make the album night Chicago with the night views of Chicago."album", "input": {"name": "night Chicago", "place": "Chicago", "kind": "any", "content": "night views"}} Nothing about destinations, encryption or deleting exists; for such requests the answer is a
sayexplaining where to do it.A question about the app comes back as
{"kind": "answer", "text", "links": [{"title", "url"}], "say"}(one link; the service sends the manual's best sections for the words with the request, so it is one model call). A developer question (developer mode, or an API question from any client) is answered from openapi.yaml, the peer and relay protocol schemas and chapters 9-11: the exact route, headers, status codes and error bodies, and a code sample inlanguage, in a fenced block; what the specs do not state is answered "The spec does not say …".{"text": "What does POST albums/{id}/remove-requests return on a repeat?", "mode": "developer", "language": "python"} - Errors: 400 →
text is required,text is too long (at most 1000 characters),today must be a date (YYYY-,MM- DD) mode must be developer, select-,assist or left out language must be curl, python, swift or csharp. 403 →the assistant is for signed-,in devices not an active member of a company, `this device is not registered (devices/register). 429 →Too many assistant requests in a short time (at most 20 a minute from one device and 200 an hour for a company). Please wait a minute and try again.` There is no daily limit: this is an abuse guard a person never reaches (assistant.,devicePerMinute assistant.companyPerHour; every request counts, one the app gave up on too). 503 →The assistant is not available on this server., `The assistant is busy right now. Please try again in a minute.` - Usage: every request that reaches Claude is recorded for the company's usage page with its counts
only: time, company, device, kind (
phone,developer,select-assist), the tools planned, rounds, tokens in, out, cache read and written, the cost in USD from the model's price, the time it took and the outcome (plan,answer,refusal,error,abort). The words asked and the reply are never stored.
POST /api/assistant · from openapi.yaml (postAssistant)
| Auth | Authorization: Bearer <device token>, or the admin page's web session (cookie sa_session) plus X-CSRF-Token |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json AssistantRequesttext string|null · 1–1,000 characters; line breaks become spacestoday string|null · the phone's local date, `YYYY-MM-DD` (relative dates count from it)context AssistantContext|null · the phone's place names and found trips, newest first. At most 200 places and 100 trips are used; names are cut to 80 characters; dates that are not `YYYY-MM-DD` are dropped. `kinds` is any small JSON value (up to 2,000 characters, else left out). `appCommands` (`[{"id", "what"}]`, at most 100) are the app's own commands it runs as an `app_command` action, and `pcs` (names, at most 50) the company's computers, for `pc_space`. `history` (`[{"q", "a"}]`, the chat's exchanges before this request, oldest first; the last 3 are used, `a` cut at 800 characters) makes the request a follow-up: it is read, searched in the manual and cached with them. `appSettings` (names, at most 100) are the app's own settings; an answer about one names it exactly so. `languages` (codes, first first, at most 3 of the 14 of `me/settings`; unknown ones dropped) are the asker's languages, which the answer is in; absent: the member's own `me/settings` languages. `geo`: `1` when the app reads `show_items`' `geo` filter (below); the bare `place` is then left out wherever `geo` has itmode string|null · `developer`: a developer's question about the APIs (see below); `today` may then be left out. `select-assist`: a computer's photo selection box; planned exactly as a phone's request, counted apart in the usagelanguage string|null · the code sample's language in developer mode: `curl` (default), `python`, `swift` or `csharp` |
| 200 | Or only {...} when nothing fits (no `actions` key). `say` is one plain line, at most 300 characters → AssistantReply {actions?: AssistantAction[], say: string, kind: string, text?: string|null, links?: AssistantLink[]} |
| 400 | text is required, text is too long (at most 1000 characters), today must be a date (YYYY-MM-DD), mode must be developer, select-assist or left out, language must be curl, python, swift or csharpmode must be developer, select-assist or left outlanguage must be curl, python, swift or csharptoday must be a date (YYYY-MM-DD)text is requiredtext is too long (at most 1000 characters)bad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | the assistant is for signed-in devices, not an active member of a company, this device is not registered (devices/register)not an active member of a companythe assistant is for signed-in devicesthis device is not registered (devices/register)missing CSRF token |
| 429 | Too many assistant requests in a short time (at most 20 a minute from one device and 200 an hour for a company). Please wait a minute and try again. There is no daily limit: this is an abuse guard a person never reaches (assistant.devicePerMinute, assistant.companyPerHour; every request counts, one the app gave up on too) |
| 503 | The assistant is not available on this server., The assistant is busy right now. Please try again in a minuteThe assistant is not available on this server.The assistant is busy right now. Please try again in a minute. |
curl
# answers 200; errors 400, 401, 403, 429, 503
curl -sS -X POST 'https://spacebackup.net/account/api/assistant' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"text":"back up all photos from my last Chicago trip","today":"2026-10-14","context":{"places":[{"name":"Chicago","count":412}],"trips":[{"name":"Chicago, Sep 2026","place":"Chicago","from":"2026-09-03","to":"2026-09-06","count":412}],"kinds":{"photo":5000,"video":300}}}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/assistant",
method="POST",
data=json.dumps({"text": "back up all photos from my last Chicago trip", "today": "2026-10-14", "context": {"places": [{"name": "Chicago", "count": 412}], "trips": [{"name": "Chicago, Sep 2026", "place": "Chicago", "from": "2026-09-03", "to": "2026-09-06", "count": 412}], "kinds": {"photo": 5000, "video": 300}}}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 429, 503
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/assistant")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"text":"back up all photos from my last Chicago trip","today":"2026-10-14","context":{"places":[{"name":"Chicago","count":412}],"trips":[{"name":"Chicago, Sep 2026","place":"Chicago","from":"2026-09-03","to":"2026-09-06","count":412}],"kinds":{"photo":5000,"video":300}}}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 429, 503
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/assistant");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"text":"back up all photos from my last Chicago trip","today":"2026-10-14","context":{"places":[{"name":"Chicago","count":412}],"trips":[{"name":"Chicago, Sep 2026","place":"Chicago","from":"2026-09-03","to":"2026-09-06","count":412}],"kinds":{"photo":5000,"video":300}}}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 429, 503
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/geo/resolve#
- Auth: a registered device of an active member (or the web session).
- Query:
words(the words as said: "Vegas", "the States", "Скандинавия", "north of the Arctic Circle"),langs(optional, codes comma-separated, first first: the labels' language). - Response: 200, the same answer as a computer's
GET /api/geo/resolve(the same resolver and data: GeoNames cities of 15,000+ people, Natural Earth countries and seas, docs/geography-regions.tsv and -aliases.tsv), without the photo counts that order a computer's candidates: `{"geo", "label", "matched", "candidates": [{"geo", "label", "count"}]}, the first candidate isgeo`; readings of one name are labelled with their state or country.{"geo": null, "candidates": []}when the words name no geography. For a phone with no computer reachable; with one, the computer's answer counts the photos.{"geo": {"place": {"level": "metro", "id": "geonames:2988507", "name": "Paris"}}, "label": "Paris, France", "matched": "paris", "candidates": [{"geo": {"place": {"level": "metro", "id": "geonames:2988507", "name": "Paris"}}, "label": "Paris, France", "count": 0}, {"geo": {"place": {"level": "metro", "id": "geonames:4717560", "name": "Paris"}}, "label": "Paris, Texas", "count": 0}]} - Errors: 401 without a session; 403 →
not an active member of a company, `this device is not registered (devices/register)`.
GET /api/geo/resolve · from openapi.yaml (getGeoResolve)
| Auth | Authorization: Bearer <device token>, or the admin page's web session (cookie sa_session) plus X-CSRF-Token |
|---|---|
| query | words string|null (optional) |
| query | langs string|null (optional) |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | not an active member of a company, this device is not registered (devices/register)missing CSRF token |
curl
# answers ; errors 401, 403
curl -sS -X GET 'https://spacebackup.net/account/api/geo/resolve?words=1&langs=1' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/geo/resolve?words=1&langs=1",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/geo/resolve?words=1&langs=1")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/geo/resolve?words=1&langs=1");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers ; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Usage#
The apps report how they are used, as counts and outcomes, for the company's usage page and the service's operator (iOS request #59). Nothing in a report may name a person, a place, a file or a photo, and nothing but the fields below is stored. Raw events are kept 90 days, the daily totals 13 months.
POST /api/usage#
A batch of events, sent at most every few minutes and when the app goes to the background.
Phones send it now;
computers will send the same shape. The device's type (from the os it registered with: ios, android, macos,
windows, linux, other) is recorded with each event, so the usage pages can show each type apart.
- Auth: a registered device of an active member, by its device token (a web session gets 401).
- Request:
{"events": [{"t": 1792058400000, "kind": "open"}, {"t": 1792058431000, "kind": "backup_run", "outcome": "tapped", "ms": 93000}, {"t": 1792058431000, "kind": "backup_items", "n": 412}, {"t": "2026-10-22T09:21:07Z", "kind": "select_job", "n": 900, "outcome": "done", "ms": 5200}]}Field Rules events0–500 events ( usage.maxEvents)twhen it happened: Unix milliseconds (a number below 10^11 is taken as seconds) or an ISO 8601 string. Older than 7 days: dropped; in the future: taken as now kindone of the kinds below na count, 0 to 10^12; exactly on the kinds that carry it outcomeexactly on the kinds that carry it, one of their values mshow long it took, 0 to 86,400,000; exactly on the kinds that carry it kindnoutcomemsopenbackup_runauto,tapped,stoppedorfailedyes backup_itemsfiles sent album_createalbum_additems added okorproblemssharepeople link_createitems albumfor an album's link, else nonerestorephotos and videos ok,problemsorstoppedselect_jobcandidates doneor the failure reason (no-worker,signed-out,worker-busy,error...): letters, digits,_and-, 1–32 charactersyes crashcrashes Any other field is ignored and never stored.
- Response: 204, no body.
- Errors: 400 →
events is required,too many events (at most 500 in one report), `events[1].kind must be one of open, backup_run, backup_items, album_create, album_add, share, link_create, restore, select_job, crash,events[0].t must be a time (Unix milliseconds or ISO 8601),events[0].n is required for crash,events[0]: open has no n`,events[0].,n must be a count from 0 to 1000000000000 events[0]., `events[0]: share has no msms is required for backup_ run ,events[0].ms must be from 0 to 86400000,events[0].outcome is required for album_add,events[0]: open has no outcome,events[0].outcome of restore must be ok or problems or stopped,events[0].outcome must be a short word (letters, digits, _ and -, at most 32)`: the whole batch is refused; drop it rather than send it again. 403 →usage is reported by signed-,in devices not an active member of a company, `this device is not registered (devices/register). 429 →Too many usage reports from this device (at most 60 an hour). Send them batched, at most every few minutes.(usage.reportsPerHour`; keep the batch and send it later).
POST /api/usage · from openapi.yaml (postUsage)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json UsageReportevents UsageEvent|null[] · 0–500 events (`usage.maxEvents`) |
| 204 | No body |
| 400 | events is required, too many events (at most 500 in one report), events[1].kind must be one of open, backup_run, backup_items, album_create, album_add, share, link_create, restore, select_job, crash, events[0].t must be a time (Unix milliseconds or ISO 8601), events[0].n is required for crash, events[0]: open has no n, events[0].n must be a count from 0 to 1000000000000, events[0].ms is required for backup_run, events[0]: share has no ms, events[0].ms must be from 0 to 86400000, events[0].outcome is required for album_add, events[0]: open has no outcome, events[0].outcome of restore must be ok or problems or stopped, events[0].outcome must be a short word (letters, digits, _ and -, at most 32): the whole batch is refused; drop it rather than send it againevents is requiredtoo many events (at most <max> in one report)events[<i>] is emptyevents[<i>].t must be a time (Unix milliseconds or ISO 8601)events[<i>].n is required for <kind>events[<i>]: <kind> has no nevents[<i>].n must be a count from 0 to 1000000000000events[<i>].ms is required for <kind>events[<i>]: <kind> has no msevents[<i>].ms must be from 0 to 86400000events[<i>]: <kind> has no outcomeevents[<i>].outcome is required for <kind>events[<i>].outcome must be a short word (letters, digits, _ and -, at most 32)bad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | usage is reported by signed-in devices, not an active member of a company, this device is not registered (devices/register)usage is reported by signed-in devicesnot an active member of a companythis device is not registered (devices/register) |
| 429 | Too many usage reports from this device (at most 60 an hour). Send them batched, at most every few minutes. (usage.reportsPerHour; keep the batch and send it later)Too many usage reports from this device (at most <reportsPerHour> an hour). Send them batched, at most every few minutes. |
curl
# answers 204; errors 400, 401, 403, 429
curl -sS -X POST 'https://spacebackup.net/account/api/usage' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"events":[{"t":1792058400000,"kind":"open"},{"t":1792058431000,"kind":"backup_run","outcome":"tapped","ms":93000},{"t":1792058431000,"kind":"backup_items","n":412},{"t":"2026-10-22T09:21:07Z","kind":"select_job","n":900,"outcome":"done","ms":5200}]}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/usage",
method="POST",
data=json.dumps({"events": [{"t": 1792058400000, "kind": "open"}, {"t": 1792058431000, "kind": "backup_run", "outcome": "tapped", "ms": 93000}, {"t": 1792058431000, "kind": "backup_items", "n": 412}, {"t": "2026-10-22T09:21:07Z", "kind": "select_job", "n": 900, "outcome": "done", "ms": 5200}]}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 400, 401, 403, 429
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/usage")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"events":[{"t":1792058400000,"kind":"open"},{"t":1792058431000,"kind":"backup_run","outcome":"tapped","ms":93000},{"t":1792058431000,"kind":"backup_items","n":412},{"t":"2026-10-22T09:21:07Z","kind":"select_job","n":900,"outcome":"done","ms":5200}]}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 400, 401, 403, 429
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/usage");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"events":[{"t":1792058400000,"kind":"open"},{"t":1792058431000,"kind":"backup_run","outcome":"tapped","ms":93000},{"t":1792058431000,"kind":"backup_items","n":412},{"t":"2026-10-22T09:21:07Z","kind":"select_job","n":900,"outcome":"done","ms":5200}]}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 204; errors 400, 401, 403, 429
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Web pages & forms#
The account pages are server-rendered HTML in the site's style. They are for people, not for programs, but every one is
listed here. All form posts are application/ and carry the csrf field
(Web sessions and CSRF); a missing or wrong token answers 403. A form post without a web session
redirects to /account/. A form post that succeeds redirects (302) back to its page with ?msg=<what was done>, which
the page shows at the top. An error is shown as a page with the same status codes as the API. See
The admin page.
Sign-in pages.
GET /#
The sign-in page (an email field). Signed in, it redirects to /account/admin for the owner and admins and to
/account/me for everyone else; ?next=relay redirects to the relay buy screen instead.
GET / · from openapi.yaml (get)
| Auth | none |
|---|---|
| query | next string|null (optional) |
| 200 | OK |
| 302 | Found (redirect) |
| 400 | Bad Request<name> must be a string<name> is too long |
curl
# answers 200; errors 302, 400
curl -sS -X GET 'https://spacebackup.net/account/'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 302, 400
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 302, 400
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/");
using var res = await http.SendAsync(req); // answers 200; errors 302, 400
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /signin#
Form: email. Starts a sign-in for "a web browser (Firefox)" and the like, keeps the browser's secret in the sa_signin
cookie, and redirects to /account/signin/wait. A bad address (400), too many requests (429) or a mail failure (503)
shows the sign-in page again with the error.
- Errors: 400 →
not a valid email address. 403 →This form has expired.(a missing or wrongGo back, reload the page and try again. csrf). 429 →too many sign-. 503 →in requests; try again later could not send the sign-.in mail; try again later
POST /signin · from openapi.yaml (postSignin)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedcsrf stringemail string |
| 200 | OK |
| 302 | Found (redirect) |
| 400 | not a valid email addresssecretHash must be base64 of a SHA-256not a valid email address<name> is required<name> is too long<name> must not contain control characters |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf)This form has expired. Go back, reload the page and try again. |
| 429 | too many sign-in requests; try again latertoo many sign-in requests; try again later |
| 503 | could not send the sign-in mail; try again latercould not send the sign-in mail; try again later |
curl
# answers 200; errors 302, 400, 403, 429, 503
curl -sS -X POST 'https://spacebackup.net/account/signin' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"'&email=…'Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/signin",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"], "email": "…"}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 302, 400, 403, 429, 503
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/signin")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)&email=…"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 302, 400, 403, 429, 503
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/signin");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")!, ["email"] = "…" });
using var res = await http.SendAsync(req); // answers 200; errors 302, 400, 403, 429, 503
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /signin/wait#
The waiting page: "Check your email", a field for the 6-digit code, and a script that polls POST /
every 2 seconds. Without a sign-in in progress it redirects to /account/.
GET /signin/wait · from openapi.yaml (getSigninWait)
| Auth | none |
|---|---|
| 200 | OK |
| 302 | Found (redirect) |
curl
# answers 200; errors 302
curl -sS -X GET 'https://spacebackup.net/account/signin/wait'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/signin/wait",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 302
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/signin/wait")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 302
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/signin/wait");
using var res = await http.SendAsync(req); // answers 200; errors 302
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /signin/code#
Form: code. A right code signs the browser in (sets sa_session) and redirects to /account/; a wrong one shows the
waiting page with "Wrong code; 3 attempt(s) left." (400). Without a sign-in in progress it redirects to /account/.
- Errors: 400 → the waiting page with
Wrong code; 3 attempt(s) left.403 →This form has expired.(a missing or wrongGo back, reload the page and try again. csrf). 404 →no such sign-in request(the browser's sign-in is gone). 410 →this sign-,in was already used this sign-,in has expired; start again too many wrong codes; start again. 404 and 410 are error pages; start the sign-in again.
POST /signin/code · from openapi.yaml (postSigninCode)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedcode stringcsrf string |
| 200 | OK |
| 302 | Found (redirect) |
| 400 | the waiting page with Wrong code; 3 attempt(s) leftwrong code<name> is required<name> is too long<name> must not contain control characters |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf)This form has expired. Go back, reload the page and try again. |
| 404 | no such sign-in request (the browser's sign-in is gone)no such sign-in request |
| 410 | this sign-in was already used, this sign-in has expired; start again, too many wrong codes; start again. 404 and 410 are error pages; start the sign-in againthis sign-in was already usedthis sign-in has expired; start againtoo many wrong codes; start again |
curl
# answers 200; errors 302, 400, 403, 404, 410
curl -sS -X POST 'https://spacebackup.net/account/signin/code' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'code=…&csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/signin/code",
method="POST",
data=urllib.parse.urlencode({"code": "…", "csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 302, 400, 403, 404, 410
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/signin/code")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"code=…&csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 302, 400, 403, 404, 410
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/signin/code");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["code"] = "…", ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers 200; errors 302, 400, 403, 404, 410
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /signin/poll#
The waiting page's poll. Header X-CSRF-Token (else 403 {"error": "missing CSRF token"}); no body. Answers JSON
{"status": "pending"}, {"status": "approved"} (the session cookie is set; reload), {"status": "expired"} (start
again) or {"status": "none"} (no sign-in in progress).
POST /signin/poll · from openapi.yaml (postSigninPoll)
| Auth | the sign-in cookie sa_signin plus the header X-CSRF-Token |
|---|---|
| 200 | OK |
| 400 | Bad Requestwrong code<name> is required<name> is too long<name> must not contain control characters |
| 403 | Forbiddenmissing CSRF token |
curl
# answers 200; errors 400, 403
curl -sS -X POST 'https://spacebackup.net/account/signin/poll' \
-H "Cookie: sa_signin=$SA_COOKIE" \
-H "X-CSRF-Token: $SA_CSRF"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/signin/poll",
method="POST",
headers={"Cookie": "sa_signin=" + os.environ["SA_COOKIE"], "X-CSRF-Token": os.environ["SA_CSRF"]},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCsrf = ProcessInfo.processInfo.environment["SA_CSRF"]!
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/signin/poll")!)
req.httpMethod = "POST"
req.setValue("sa_signin=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("\(saCsrf)", forHTTPHeaderField: "X-CSRF-Token")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/signin/poll");
req.Headers.TryAddWithoutValidation("Cookie", "sa_signin=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Headers.TryAddWithoutValidation("X-CSRF-Token", Environment.GetEnvironmentVariable("SA_CSRF"));
using var res = await http.SendAsync(req); // answers 200; errors 400, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /signin/confirm#
The mailed link: ?r=. Shows "Sign in <device name>?" with the email, when it was asked, and
a Sign in button (it does not sign in by itself, so mail scanners cannot use the link up). An expired or used link
shows "Link expired".
GET /signin/confirm · from openapi.yaml (getSigninConfirm)
| Auth | none |
|---|---|
| query | r string|null (optional) |
| query | t string|null (optional) |
| 200 | OK |
curl
# answers 200
curl -sS -X GET 'https://spacebackup.net/account/signin/confirm?r=r_2mxq7k4a9fz3wn5c&t=<link+token>'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/signin/confirm?r=r_2mxq7k4a9fz3wn5c&t=<link+token>",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/signin/confirm?r=r_2mxq7k4a9fz3wn5c&t=<link+token>")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/signin/confirm?r=r_2mxq7k4a9fz3wn5c&t=<link+token>");
using var res = await http.SendAsync(req); // answers 200
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /signin/confirm#
Form: r, t. Approves the sign-in. In the browser that asked, it signs in at once and redirects to /account/;
anywhere else it says "ANNA-PC is signed in as anna@acme.com now. You can close this tab." and the device (or the
original browser tab) picks up its token with its next poll. An unknown, expired or used link shows "Link expired" (200).
- Errors: 403 →
This form has expired.(a missing or wrongGo back, reload the page and try again. csrf).
POST /signin/confirm · from openapi.yaml (postSigninConfirm)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedcsrf stringr stringt string |
| 200 | OK |
| 302 | Found (redirect) |
| 400 | Bad Requestwrong code<name> is required<name> is too long<name> must not contain control characters |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf)This form has expired. Go back, reload the page and try again. |
curl
# answers 200; errors 302, 400, 403
curl -sS -X POST 'https://spacebackup.net/account/signin/confirm' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"'&r=…&t=…'Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/signin/confirm",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"], "r": "…", "t": "…"}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 302, 400, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/signin/confirm")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)&r=…&t=…"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 302, 400, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/signin/confirm");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")!, ["r"] = "…", ["t"] = "…" });
using var res = await http.SendAsync(req); // answers 200; errors 302, 400, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /signout#
Form: only csrf. Ends the web session and redirects to /account/.
The member's page.
POST /signout · from openapi.yaml (postSignout)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedcsrf string |
| 200 | OK |
| 302 | Found (redirect) |
| 400 | Bad Request<name> must be a string<name> is too long |
| 403 | ForbiddenThis form has expired. Go back, reload the page and try again. |
curl
# answers 200; errors 302, 400, 403
curl -sS -X POST 'https://spacebackup.net/account/signout' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/signout",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 302, 400, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/signout")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 302, 400, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/signout");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers 200; errors 302, 400, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /me#
The member's own page, for any signed-in email: first and last name, Your devices (rename, remove), **Shared
backups (the shares of their own devices only, also for the owner and admins), Shared with me, Shared albums**
(the setting "Automatically accept albums shared by people in my company", the invitations waiting with Accept /
Decline, declined ones with Accept, and the albums shared with them, of their company and as a guest of others,
each On or Off with Turn off / Turn on), Your groups (read-only), Space Relay credit and **Sign
out**. Someone who is not an active member sees why (not in a company yet, or waiting for approval), and their
Shared albums without the setting. Not signed in: redirects to /account/.
GET /me · from openapi.yaml (getMe)
| Auth | none |
|---|---|
| query | msg string|null (optional) |
| 200 | OK |
| 302 | Found (redirect) |
| 400 | Bad Request<name> must be a string<name> is too long |
| 403 | Forbiddennot an active member of a company |
curl
# answers 200; errors 302, 400, 403
curl -sS -X GET 'https://spacebackup.net/account/me'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/me",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 302, 400, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/me")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 302, 400, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/me");
using var res = await http.SendAsync(req); // answers 200; errors 302, 400, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /me/name#
Form: firstName, lastName (empty clears). The rules of PUT /api/me.
POST /me/name · from openapi.yaml (postMeName)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedcsrf stringfirstName stringlastName string |
| 302 | Found (redirect) |
| 400 | Bad Requestfirst name is required with a last name<what> is too long (at most 40 characters)<what> must not contain control characters |
| 403 | Forbiddennot an active member of a companyThis form has expired. Go back, reload the page and try again. |
curl
# answers ; errors 302, 400, 403
curl -sS -X POST 'https://spacebackup.net/account/me/name' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"'&firstName=…&lastName=…'Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/me/name",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"], "firstName": "…", "lastName": "…"}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 400, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/me/name")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)&firstName=…&lastName=…"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 400, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/me/name");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")!, ["firstName"] = "…", ["lastName"] = "…" });
using var res = await http.SendAsync(req); // answers ; errors 302, 400, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /me/devices/{id}/label#
Form: label (empty resets). Renames one of the caller's own devices, as POST /.
- Errors: 400 →
the name is too long (at most 64 characters),the name must not contain control characters. 403 →This form has expired.(a missing or wrongGo back, reload the page and try again. csrf);not an active member of a company. 404 →no such device(not one of the caller's own).
POST /me/devices/{id}/label · from openapi.yaml (postMeDevicesIdLabel)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf stringlabel string |
| 302 | Found (redirect) |
| 400 | the name is too long (at most 64 characters), the name must not contain control charactersthe name is too long (at most 64 characters)the name must not contain control characters |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf); not an active member of a companynot an active member of a companyThis form has expired. Go back, reload the page and try again. |
| 404 | no such device (not one of the caller's own)no such device |
curl
# answers ; errors 302, 400, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/me/devices/d_4f2a7cqm3xk9wz2b/label' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"'&label=…'Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/me/devices/d_4f2a7cqm3xk9wz2b/label",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"], "label": "…"}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 400, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/me/devices/d_4f2a7cqm3xk9wz2b/label")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)&label=…"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 400, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/me/devices/d_4f2a7cqm3xk9wz2b/label");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")!, ["label"] = "…" });
using var res = await http.SendAsync(req); // answers ; errors 302, 400, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /me/devices/{id}/remove#
Removes one of the caller's own active devices (the page asks first); the company key is then replaced, as
POST /.
- Errors: 403 →
This form has expired.(a missing or wrongGo back, reload the page and try again. csrf);not an active member of a company. 404 →no such device(not one of the caller's own active devices).
POST /me/devices/{id}/remove · from openapi.yaml (postMeDevicesIdRemove)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf); not an active member of a companynot an active member of a companyonly the company's owner or an admin (or the device's member) may remove a deviceThis form has expired. Go back, reload the page and try again. |
| 404 | no such device (not one of the caller's own active devices)no such device |
curl
# answers ; errors 302, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/me/devices/d_4f2a7cqm3xk9wz2b/remove' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/me/devices/d_4f2a7cqm3xk9wz2b/remove",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/me/devices/d_4f2a7cqm3xk9wz2b/remove")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/me/devices/d_4f2a7cqm3xk9wz2b/remove");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /me/agents/{id}/remove#
Disconnects an AI agent the caller allowed (AI agents on /me, the page asks first): its access and refresh tokens
end at once, and the company's audit log gets a line. The OAuth endpoints themselves (/account/oauth/authorize,
token, register, revoke), the MCP endpoint /account/mcp and the discovery documents under /.well-known/ are
described in docs/mcp.md "Remote" and on spacebackup.net/developers.
- Errors: 403 →
This form has expired.(a missing or wrongGo back, reload the page and try again. csrf). 404 →no such connection.
POST /me/agents/{id}/remove · from openapi.yaml (postMeAgentsIdRemove)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf)This form has expired. Go back, reload the page and try again. |
| 404 | no such connectionno such connection |
curl
# answers ; errors 302, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/me/agents/x_k3xq7m2pa9fz4w8r/remove' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/me/agents/x_k3xq7m2pa9fz4w8r/remove",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/me/agents/x_k3xq7m2pa9fz4w8r/remove")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/me/agents/x_k3xq7m2pa9fz4w8r/remove");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /me/tvs/{id}/remove#
Disconnects one of the caller's TVs (Your TVs on /me, the page asks first), as POST /.
- Errors: 403 →
This form has expired.(a missing or wrongGo back, reload the page and try again. csrf). 404 →no such TV.
POST /me/tvs/{id}/remove · from openapi.yaml (postMeTvsIdRemove)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf)not an active member of a companya TV cannot do thisThis form has expired. Go back, reload the page and try again. |
| 404 | no such TVno such TV |
curl
# answers ; errors 302, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/me/tvs/x_k3xq7m2pa9fz4w8r/remove' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/me/tvs/x_k3xq7m2pa9fz4w8r/remove",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/me/tvs/x_k3xq7m2pa9fz4w8r/remove")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/me/tvs/x_k3xq7m2pa9fz4w8r/remove");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /tv#
The TV code page (the TV shows https:/, which nginx sends here; ?code= from its QR code fills
the code in). Not signed in: the sign-in page ("Sign in to connect your TV."), which comes back here with the code after
the sign-in. Signed in: the code box and Continue.
GET /tv · from openapi.yaml (getTv)
| Auth | none |
|---|---|
| query | code string|null (optional) |
| 200 | OK |
| 400 | Bad Request<name> must be a string<name> is too long |
curl
# answers 200; errors 400
curl -sS -X GET 'https://spacebackup.net/account/tv?code=1'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/tv?code=1",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/tv?code=1")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/tv?code=1");
using var res = await http.SendAsync(req); // answers 200; errors 400
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /tv/{code}#
The TV's QR code (https:/, a universal link the iPhone app claims; without the app the
service redirects it here). Signed in on the web: the code page with the code filled in, as GET /tv?code=. Not signed
in: only "Open Space Backup on your iPhone to sign in this TV", the code, and where to get the app (Android: the Android
app's link when there is one). No sign-in form, and the code is not looked up. Not a code: redirects to /tv. The
site's / (application/json) claims /tv/* for the iPhone app.
GET /tv/{code} · from openapi.yaml (getTvCode)
| Auth | none |
|---|---|
| path | code string |
| 200 | OK |
| 302 | Found (redirect) |
| 400 | Bad Request<name> must be a string<name> is too long |
curl
# answers 200; errors 302, 400
curl -sS -X GET 'https://spacebackup.net/account/tv/x_k3xq7m2pa9fz4w8r'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/tv/x_k3xq7m2pa9fz4w8r",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 302, 400
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/tv/x_k3xq7m2pa9fz4w8r")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 302, 400
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/tv/x_k3xq7m2pa9fz4w8r");
using var res = await http.SendAsync(req); // answers 200; errors 302, 400
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /tv#
The code typed (form code, csrf): the TV it names (name, model, when it asked) with a name box, Approve and **Not
my TV**.
- Errors: 404 →
no TV is showing that code; check it, or show a new one on the TV; 429 → `too many wrong codes; wait a few minutes(the code page again, with the message); 403 →This form has expired. Go back, reload the page and try again.`
POST /tv · from openapi.yaml (postTv)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedcode stringcsrf string |
| 200 | OK |
| 302 | Found (redirect) |
| 400 | Bad Request<name> must be a string<name> is too long |
| 403 | This form has expired. Go back, reload the page and try againThis form has expired. Go back, reload the page and try again.not an active member of a companya TV cannot do this |
| 404 | no TV is showing that code; check it, or show a new one on the TV;no TV is showing that code; check it, or show a new one on the TV |
| 429 | too many wrong codes; wait a few minutes (the code page again, with the message);too many wrong codes; wait a few minutes |
curl
# answers 200; errors 302, 400, 403, 404, 429
curl -sS -X POST 'https://spacebackup.net/account/tv' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'code=…&csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/tv",
method="POST",
data=urllib.parse.urlencode({"code": "…", "csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 302, 400, 403, 404, 429
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/tv")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"code=…&csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 302, 400, 403, 404, 429
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/tv");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["code"] = "…", ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers 200; errors 302, 400, 403, 404, 429
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /tv/approve#
Form code, name, csrf: approves the pairing (as POST /); "<name> is connected".
- Errors: 404 →
no TV is showing that code; check it, or show a new one on the TV; 429 → `too many wrong codes; wait a few minutes(the code page again, with the message); 403 →This form has expired. Go back, reload the page and try again.`
POST /tv/approve · from openapi.yaml (postTvApprove)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedcode stringcsrf stringname string |
| 200 | OK |
| 302 | Found (redirect) |
| 400 | Bad Request<name> must be a string<name> is too long |
| 403 | This form has expired. Go back, reload the page and try againThis form has expired. Go back, reload the page and try again.not an active member of a companya TV cannot do this |
| 404 | no TV is showing that code; check it, or show a new one on the TV;no TV is showing that code; check it, or show a new one on the TV |
| 429 | too many wrong codes; wait a few minutes (the code page again, with the message);too many wrong codes; wait a few minutes |
curl
# answers 200; errors 302, 400, 403, 404, 429
curl -sS -X POST 'https://spacebackup.net/account/tv/approve' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'code=…&csrf='"$SA_CSRF"'&name=…'Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/tv/approve",
method="POST",
data=urllib.parse.urlencode({"code": "…", "csrf": os.environ["SA_CSRF"], "name": "…"}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 302, 400, 403, 404, 429
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/tv/approve")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"code=…&csrf=\#(saCsrf)&name=…"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 302, 400, 403, 404, 429
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/tv/approve");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["code"] = "…", ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")!, ["name"] = "…" });
using var res = await http.SendAsync(req); // answers 200; errors 302, 400, 403, 404, 429
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /tv/deny#
Form code, csrf: declines it (as POST /); the TV shows that it was declined.
- Errors: 403 →
This form has expired.Go back, reload the page and try again.
POST /tv/deny · from openapi.yaml (postTvDeny)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedcode stringcsrf string |
| 200 | OK |
| 302 | Found (redirect) |
| 400 | Bad Request<name> must be a string<name> is too long |
| 403 | This form has expired. Go back, reload the page and try againThis form has expired. Go back, reload the page and try again.not an active member of a companya TV cannot do this |
curl
# answers 200; errors 302, 400, 403
curl -sS -X POST 'https://spacebackup.net/account/tv/deny' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'code=…&csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/tv/deny",
method="POST",
data=urllib.parse.urlencode({"code": "…", "csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 302, 400, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/tv/deny")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"code=…&csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 302, 400, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/tv/deny");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["code"] = "…", ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers 200; errors 302, 400, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /me/approvals/{id}/approve, POST /me/approvals/{id}/deny#
Approve / Deny under Restore requests: decides a request to restore one of the caller's own devices, as POST /api/me/approvals/{id}/approve|deny.
- Errors: 403 →
This form has expired.(a missing or wrongGo back, reload the page and try again. csrf);not an active member of a company. 404 →no such request to restore a device of yours,no such data-key request. 409 →this request was already approved|denied.
POST /me/approvals/{id}/approve · from openapi.yaml (postMeApprovalsIdApprove)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf); not an active member of a companynot an active member of a companyThis form has expired. Go back, reload the page and try again. |
| 404 | no such request to restore a device of yours, no such data-key requestno such request to restore a device of yoursno such data-key request |
| 409 | this request was already approved|deniedthis request was already <state> |
curl
# answers ; errors 302, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/me/approvals/dr_z3k7xq2ma9pw4n5c/approve' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/me/approvals/dr_z3k7xq2ma9pw4n5c/approve",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/me/approvals/dr_z3k7xq2ma9pw4n5c/approve")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/me/approvals/dr_z3k7xq2ma9pw4n5c/approve");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /me/approvals/{id}/deny · from openapi.yaml (postMeApprovalsIdDeny)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf); not an active member of a companynot an active member of a companyThis form has expired. Go back, reload the page and try again. |
| 404 | no such request to restore a device of yours, no such data-key requestno such request to restore a device of yoursno such data-key request |
| 409 | this request was already approved|deniedthis request was already <state> |
curl
# answers ; errors 302, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/me/approvals/dr_z3k7xq2ma9pw4n5c/deny' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/me/approvals/dr_z3k7xq2ma9pw4n5c/deny",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/me/approvals/dr_z3k7xq2ma9pw4n5c/deny")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/me/approvals/dr_z3k7xq2ma9pw4n5c/deny");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /me/shares#
Form: device (one of the caller's own devices), email. Shares that device's backups, as POST /api/shares.
- Errors: 400 →
not a valid email address,these backups are already <email>'s. 403 →This form has expired.(a missing or wrongGo back, reload the page and try again. csrf); the 403s ofPOST /api/shares. 404 →no such device,<email> is not a member of your company.
POST /me/shares · from openapi.yaml (postMeShares)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedcsrf stringdevice stringemail string |
| 302 | Found (redirect) |
| 400 | not a valid email address, these backups are already <email>'sthese backups are already <email>'s<name> is required<name> is too long<name> must not contain control charactersnot a valid email address |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf); the 403s of POST /api/sharesnot an active member of a companyonly the device's owner or an admin can share its backupsyou cannot share <name>'s backups with yourself: ask to restore them instead, which <email> or another owner or admin approvesThis form has expired. Go back, reload the page and try again. |
| 404 | no such device, <email> is not a member of your companyno such device<email> is not a member of your company |
curl
# answers ; errors 302, 400, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/me/shares' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"'&device=…&email=…'Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/me/shares",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"], "device": "…", "email": "…"}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 400, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/me/shares")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)&device=…&email=…"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 400, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/me/shares");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")!, ["device"] = "…", ["email"] = "…" });
using var res = await http.SendAsync(req); // answers ; errors 302, 400, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /me/settings#
Form: autoAcceptCompany (on when ticked; an unticked box sends nothing, which turns it off). As
PUT /api/me/settings.
- Errors: 403 →
This form has expired.(a missing or wrongGo back, reload the page and try again. csrf);only an active member of a company has these settings.
POST /me/settings · from openapi.yaml (postMeSettings)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedautoAcceptCompany stringcsrf string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf); only an active member of a company has these settingsonly an active member of a company has these settingsThis form has expired. Go back, reload the page and try again. |
curl
# answers ; errors 302, 403
curl -sS -X POST 'https://spacebackup.net/account/me/settings' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'autoAcceptCompany=…&csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/me/settings",
method="POST",
data=urllib.parse.urlencode({"autoAcceptCompany": "…", "csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/me/settings")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"autoAcceptCompany=…&csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/me/settings");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["autoAcceptCompany"] = "…", ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /me/languages#
Form: lang1, lang2, lang3 (codes; an empty one is left out). Your languages on the account page, as
PUT /api/me/settings languages.
- Errors: 400 as PUT /api/me/settings; 403 →
This form has expired.(a missing or wrongGo back, reload the page and try again. csrf);only an active member of a company has these settings.
POST /me/languages · from openapi.yaml (postMeLanguages)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedcsrf stringlang1 stringlang2 stringlang3 string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf); only an active member of a company has these settingsonly an active member of a company has these settingsThis form has expired. Go back, reload the page and try again. |
curl
# answers ; errors 302, 403
curl -sS -X POST 'https://spacebackup.net/account/me/languages' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"'&lang1=…&lang2=…&lang3=…'Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/me/languages",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"], "lang1": "…", "lang2": "…", "lang3": "…"}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/me/languages")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)&lang1=…&lang2=…&lang3=…"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/me/languages");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")!, ["lang1"] = "…", ["lang2"] = "…", ["lang3"] = "…" });
using var res = await http.SendAsync(req); // answers ; errors 302, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /me/albums/{id}/show#
Form: on (1 turns the album on, anything else off). Turn off / Turn on under Shared albums, as
POST /api/albums/{id}/show.
- Errors: 403 → `This form has expired. Go back, reload the page and try
again.
(a missing or wrongcsrf). 404 →no such album`.
POST /me/albums/{id}/show · from openapi.yaml (postMeAlbumsIdShow)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf stringon string |
| 302 | Found (redirect) |
| 400 | Bad Requeston is required (true or false) |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf)This form has expired. Go back, reload the page and try again. |
| 404 | no such albumno such album |
curl
# answers ; errors 302, 400, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/me/albums/al_x7k2mq9pa4zw3n5c/show' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"'&on=…'Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/me/albums/al_x7k2mq9pa4zw3n5c/show",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"], "on": "…"}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 400, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/me/albums/al_x7k2mq9pa4zw3n5c/show")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)&on=…"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 400, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/me/albums/al_x7k2mq9pa4zw3n5c/show");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")!, ["on"] = "…" });
using var res = await http.SendAsync(req); // answers ; errors 302, 400, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /me/invitations/{id}/accept#
Accept under Shared albums: accepts a pending or declined invitation, as POST /api/albums/invitations/{id}/accept (without trusting the sender).
- Errors: 403 →
This form has expired.(a missing or wrongGo back, reload the page and try again. csrf). 404 →no such invitation (accepted already, withdrawn, or the album was deleted).
POST /me/invitations/{id}/accept · from openapi.yaml (postMeInvitationsIdAccept)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 400 | Bad Request<name> must be a string<name> is too long |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf)This form has expired. Go back, reload the page and try again. |
| 404 | no such invitation (accepted already, withdrawn, or the album was deleted)no such invitation (accepted already, withdrawn, or the album was deleted) |
curl
# answers ; errors 302, 400, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/me/invitations/x_k3xq7m2pa9fz4w8r/accept' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/me/invitations/x_k3xq7m2pa9fz4w8r/accept",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 400, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/me/invitations/x_k3xq7m2pa9fz4w8r/accept")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 400, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/me/invitations/x_k3xq7m2pa9fz4w8r/accept");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 400, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /me/invitations/{id}/decline#
Decline under Shared albums, as POST /api/albums/invitations/{id}/decline; it stays listed, declined, with Accept.
- Errors: 403 →
This form has expired.(a missing or wrongGo back, reload the page and try again. csrf). 404 →no such invitation (accepted already, withdrawn, or the album was deleted).
POST /me/invitations/{id}/decline · from openapi.yaml (postMeInvitationsIdDecline)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 400 | Bad Request<name> must be a string<name> is too long |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf)This form has expired. Go back, reload the page and try again. |
| 404 | no such invitation (accepted already, withdrawn, or the album was deleted)no such invitation (accepted already, withdrawn, or the album was deleted) |
curl
# answers ; errors 302, 400, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/me/invitations/x_k3xq7m2pa9fz4w8r/decline' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/me/invitations/x_k3xq7m2pa9fz4w8r/decline",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 400, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/me/invitations/x_k3xq7m2pa9fz4w8r/decline")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 400, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/me/invitations/x_k3xq7m2pa9fz4w8r/decline");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 400, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /me/shares/{id}/remove#
Stops a share of the caller's own device, or removes a share from Shared with me, as POST /.
- Errors: 403 →
This form has expired.(a missing or wrongGo back, reload the page and try again. csrf);not an active member of a company. 404 →no such share.
The admin page.
POST /me/shares/{id}/remove · from openapi.yaml (postMeSharesIdRemove)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf); not an active member of a companynot an active member of a companyThis form has expired. Go back, reload the page and try again. |
| 404 | no such shareno such share |
curl
# answers ; errors 302, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/me/shares/sh_m3k9xq2a7pz4wn5c/remove' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/me/shares/sh_m3k9xq2a7pz4wn5c/remove",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/me/shares/sh_m3k9xq2a7pz4wn5c/remove")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/me/shares/sh_m3k9xq2a7pz4wn5c/remove");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /admin#
The owner's and admins' page: members (name, email, role, status), devices, shared backups, pending restore requests,
devices waiting for the company key, key-recovery requests, the Space Relay panel and the company settings. A plain
member is redirected to /account/me (with its msg); not signed in: to /account/.
Each form below needs an owner or admin; it does what the API route named does, then returns to /account/admin?msg=….
GET /admin · from openapi.yaml (getAdmin)
| Auth | none |
|---|---|
| query | msg string|null (optional) |
| 200 | OK |
| 302 | Found (redirect) |
| 400 | Bad Request<name> must be a string<name> is too long |
| 403 | Forbiddenonly the company's owner or an admin may do thisonly the company's owner or an admin may list every linknot an active member of a companythis device is not registered (devices/register) |
curl
# answers 200; errors 302, 400, 403
curl -sS -X GET 'https://spacebackup.net/account/admin'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 302, 400, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 302, 400, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/admin");
using var res = await http.SendAsync(req); // answers 200; errors 302, 400, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /admin/invite#
Form: email, role (member or admin). As POST /api/members/invite.
- Errors: 400 →
not a valid email address,role must be admin or member. 403 →This form has expired.,Go back, reload the page and try again. only the company's owner or an admin may do this. 409 →bob@acme.,com is already a member bob@acme..com belongs to another company
POST /admin/invite · from openapi.yaml (postAdminInvite)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedcsrf stringemail stringrole string |
| 302 | Found (redirect) |
| 400 | not a valid email address, role must be admin or memberrole must be admin or membernot a valid email address |
| 403 | This form has expired. Go back, reload the page and try again., only the company's owner or an admin may do thisonly the company's owner or an admin may do thisThis form has expired. Go back, reload the page and try again. |
| 409 | bob@acme.com is already a member, bob@acme.com belongs to another company<e> is already a member<e> belongs to another company |
curl
# answers ; errors 302, 400, 403, 409
curl -sS -X POST 'https://spacebackup.net/account/admin/invite' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"'&email=…&role=…'Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/invite",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"], "email": "…", "role": "…"}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 400, 403, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/invite")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)&email=…&role=…"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 400, 403, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/admin/invite");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")!, ["email"] = "…", ["role"] = "…" });
using var res = await http.SendAsync(req); // answers ; errors 302, 400, 403, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /admin/members/{id}/role#
Form: role (admin or member; never the owner). As POST /.
- Errors: 400 →
role must be admin or member. 403 →This form has expired.,Go back, reload the page and try again. only the company's owner or an admin may do this. 404 →no such member. 409 →the owner's role cannot be changed.
POST /admin/members/{id}/role · from openapi.yaml (postAdminMembersIdRole)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf stringrole string |
| 302 | Found (redirect) |
| 400 | role must be admin or memberrole must be admin or member |
| 403 | This form has expired. Go back, reload the page and try again., only the company's owner or an admin may do thisonly the company's owner or an admin may do thisThis form has expired. Go back, reload the page and try again. |
| 404 | no such memberno such member |
| 409 | the owner's role cannot be changedthe owner's role cannot be changed |
curl
# answers ; errors 302, 400, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/role' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"'&role=…'Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/role",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"], "role": "…"}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 400, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/role")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)&role=…"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 400, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/role");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")!, ["role"] = "…" });
using var res = await http.SendAsync(req); // answers ; errors 302, 400, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /admin/members/{id}/name#
Form: firstName, lastName, or name alone (split at its first space); empty clears. As POST /.
- Errors: 400 → the name rules of
POST /. 403 →api/ members/ {id}/ name This form has expired.,Go back, reload the page and try again. only the company's owner or an admin may do this. 404 →no such member.
POST /admin/members/{id}/name · from openapi.yaml (postAdminMembersIdName)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf stringfirstName stringlastName stringname string |
| 302 | Found (redirect) |
| 400 | the name rules of POST /api/members/{id}/namefirst name is required with a last name<what> is too long (at most 40 characters)<what> must not contain control characters |
| 403 | This form has expired. Go back, reload the page and try again., only the company's owner or an admin may do thisonly the company's owner or an admin may do thisThis form has expired. Go back, reload the page and try again. |
| 404 | no such memberno such member |
curl
# answers ; errors 302, 400, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/name' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"'&firstName=…&lastName=…&name=…'Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/name",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"], "firstName": "…", "lastName": "…", "name": "…"}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 400, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/name")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)&firstName=…&lastName=…&name=…"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 400, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/name");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")!, ["firstName"] = "…", ["lastName"] = "…", ["name"] = "…" });
using var res = await http.SendAsync(req); // answers ; errors 302, 400, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /admin/members/{id}/approve#
Lets a pending person join. As POST /.
- Errors: 403 →
This form has expired.,Go back, reload the page and try again. only the company's owner or an admin may do this. 404 →no such member. 409 →bob@acme.,com is active, not waiting for approval bob@acme..com belongs to another company now
POST /admin/members/{id}/approve · from openapi.yaml (postAdminMembersIdApprove)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try again., only the company's owner or an admin may do thisonly the company's owner or an admin may do thisThis form has expired. Go back, reload the page and try again. |
| 404 | no such memberno such member |
| 409 | bob@acme.com is active, not waiting for approval, bob@acme.com belongs to another company now<email> is <status>, not waiting for approval<email> belongs to another company now |
curl
# answers ; errors 302, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/approve' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/approve",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/approve")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/approve");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /admin/members/{id}/deny#
As POST /.
- Errors: 403 →
This form has expired.,Go back, reload the page and try again. only the company's owner or an admin may do this. 404 →no such member. 409 →bob@acme.,com is active, not waiting for approval bob@acme..com belongs to another company now
POST /admin/members/{id}/deny · from openapi.yaml (postAdminMembersIdDeny)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try again., only the company's owner or an admin may do thisonly the company's owner or an admin may do thisThis form has expired. Go back, reload the page and try again. |
| 404 | no such memberno such member |
| 409 | bob@acme.com is active, not waiting for approval, bob@acme.com belongs to another company now<email> is <status>, not waiting for approval<email> belongs to another company now |
curl
# answers ; errors 302, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/deny' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/deny",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/deny")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/deny");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /admin/members/{id}/remove#
Removes a member with their devices (never the owner); the company key is then replaced. As POST /.
- Errors: 403 →
This form has expired.,Go back, reload the page and try again. only the company's owner or an admin may do this. 404 →no such member. 409 →the owner cannot be removed.
POST /admin/members/{id}/remove · from openapi.yaml (postAdminMembersIdRemove)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try again., only the company's owner or an admin may do thisonly the company's owner or an admin may do thisThis form has expired. Go back, reload the page and try again. |
| 404 | no such memberno such member |
| 409 | the owner cannot be removedthe owner cannot be removed |
curl
# answers ; errors 302, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/remove' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/remove",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/remove")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/admin/members/m_7hd2kq9wz3xa5npe/remove");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /admin/devices/{id}/remove#
Remove device; the company key is then replaced. As POST /.
- Errors: 403 →
This form has expired., `only the company's owner or an admin (or the device's member) may remove a deviceGo back, reload the page and try again. ,not an active member of a company. 404 →no such device`.
POST /admin/devices/{id}/remove · from openapi.yaml (postAdminDevicesIdRemove)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try again., only the company's owner or an admin (or the device's member) may remove a device, not an active member of a companyonly the company's owner or an admin (or the device's member) may remove a devicenot an active member of a companyThis form has expired. Go back, reload the page and try again. |
| 404 | no such deviceno such device |
curl
# answers ; errors 302, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/admin/devices/d_4f2a7cqm3xk9wz2b/remove' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/devices/d_4f2a7cqm3xk9wz2b/remove",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/devices/d_4f2a7cqm3xk9wz2b/remove")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/admin/devices/d_4f2a7cqm3xk9wz2b/remove");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /admin/datakey-requests/{id}/approve#
Approves a restore request: the requesting device (only) may then read the source's encrypted backups.
- Errors: 403 →
This form has expired.,Go back, reload the page and try again. only the company's owner or an admin may do this. 404 →no such data-key request. 409 →this request was already approved|denied.
POST /admin/datakey-requests/{id}/approve · from openapi.yaml (postAdminDatakeyRequestsIdApprove)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try again., only the company's owner or an admin may do thisonly the company's owner or an admin may do thisThis form has expired. Go back, reload the page and try again. |
| 404 | no such data-key requestno such data-key request |
| 409 | this request was already approved|deniedthis request was already <state> |
curl
# answers ; errors 302, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/admin/datakey-requests/dr_z3k7xq2ma9pw4n5c/approve' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/datakey-requests/dr_z3k7xq2ma9pw4n5c/approve",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/datakey-requests/dr_z3k7xq2ma9pw4n5c/approve")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/admin/datakey-requests/dr_z3k7xq2ma9pw4n5c/approve");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /admin/datakey-requests/{id}/deny#
Denies a restore request.
- Errors: 403 →
This form has expired.,Go back, reload the page and try again. only the company's owner or an admin may do this. 404 →no such data-key request. 409 →this request was already approved|denied.
POST /admin/datakey-requests/{id}/deny · from openapi.yaml (postAdminDatakeyRequestsIdDeny)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try again., only the company's owner or an admin may do thisonly the company's owner or an admin may do thisThis form has expired. Go back, reload the page and try again. |
| 404 | no such data-key requestno such data-key request |
| 409 | this request was already approved|deniedthis request was already <state> |
curl
# answers ; errors 302, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/admin/datakey-requests/dr_z3k7xq2ma9pw4n5c/deny' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/datakey-requests/dr_z3k7xq2ma9pw4n5c/deny",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/datakey-requests/dr_z3k7xq2ma9pw4n5c/deny")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/admin/datakey-requests/dr_z3k7xq2ma9pw4n5c/deny");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /admin/key-release/{id}/approve#
Approves a device waiting for the company key. As POST /.
- Errors: 403 → the 403s of
POST /, `This form has expired. Go back, reload the page and try again.api/ key- release/ {id}/ approve 404 →no such key request. 409 →ANNA-LAPTOP already has the company key,that device was removed`,the company has no recovery copy of its key. 503 → `the recovery copy cannot be opened with this service's recovery key; try again after the operator has fixed it`.
POST /admin/key-release/{id}/approve · from openapi.yaml (postAdminKeyReleaseIdApprove)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 403 | the 403s of POST /api/key-release/{id}/approve, This form has expired. Go back, reload the page and try againa device cannot approve itself: approve it from the email we sent, or from another signed-in device or the admin pageonly the company's owner or an admin may do thisonly the company's owner or an admin may approve thisThis form has expired. Go back, reload the page and try again. |
| 404 | no such key requestno such key request |
| 409 | ANNA-LAPTOP already has the company key, that device was removed, the company has no recovery copy of its keythat device was removed<name> already has the company keythe company has no recovery copy of its key |
| 503 | the recovery copy cannot be opened with this service's recovery key; try again after the operator has fixed itthe recovery copy cannot be opened with this service's recovery key; try again after the operator has fixed it |
curl
# answers ; errors 302, 403, 404, 409, 503
curl -sS -X POST 'https://spacebackup.net/account/admin/key-release/kq_w2m7zx4qa9k3pn5c/approve' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/key-release/kq_w2m7zx4qa9k3pn5c/approve",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403, 404, 409, 503
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/key-release/kq_w2m7zx4qa9k3pn5c/approve")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403, 404, 409, 503
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/admin/key-release/kq_w2m7zx4qa9k3pn5c/approve");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403, 404, 409, 503
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /admin/links/{id}/revoke#
Revoke in the admin page's Public links: the link stops at once. As POST /.
- Errors: 403 →
This form has expired.404 →Go back, reload the page and try again. no such link.
POST /admin/links/{id}/revoke · from openapi.yaml (postAdminLinksIdRevoke)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try againnot an active member of a companyThis form has expired. Go back, reload the page and try again. |
| 404 | no such linkno such link |
curl
# answers ; errors 302, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/admin/links/x_k3xq7m2pa9fz4w8r/revoke' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/links/x_k3xq7m2pa9fz4w8r/revoke",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/links/x_k3xq7m2pa9fz4w8r/revoke")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/admin/links/x_k3xq7m2pa9fz4w8r/revoke");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /admin/key-recovery/{id}/cancel#
Cancels a company-key recovery. As POST /.
- Errors: 403 →
This form has expired.,Go back, reload the page and try again. only the company's owner or an admin may do this. 404 →no such key recovery request. 409 →the recovery copy was already released.
POST /admin/key-recovery/{id}/cancel · from openapi.yaml (postAdminKeyRecoveryIdCancel)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try again., only the company's owner or an admin may do thisonly the company's owner or an admin may do thisThis form has expired. Go back, reload the page and try again. |
| 404 | no such key recovery requestno such key recovery request |
| 409 | the recovery copy was already releasedthe recovery copy was already released |
curl
# answers ; errors 302, 403, 404, 409
curl -sS -X POST 'https://spacebackup.net/account/admin/key-recovery/kr_p4xq9m2ka7zw3n5c/cancel' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/key-recovery/kr_p4xq9m2ka7zw3n5c/cancel",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/key-recovery/kr_p4xq9m2ka7zw3n5c/cancel")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/admin/key-recovery/kr_p4xq9m2ka7zw3n5c/cancel");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /admin/shares#
Form: device (any device of the company), email. Share a device's backups, as POST /api/shares.
- Errors: 400 →
not a valid email address,these backups are already <email>'s. 403 → `This form has expired. Go back, reload the page and try again.; the 403s ofPOST /api/shares. 404 →no such device`,<email> is not a member of your company.
POST /admin/shares · from openapi.yaml (postAdminShares)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedcsrf stringdevice stringemail string |
| 302 | Found (redirect) |
| 400 | not a valid email address, these backups are already <email>'sthese backups are already <email>'s<name> is required<name> is too long<name> must not contain control charactersnot a valid email address |
| 403 | This form has expired. Go back, reload the page and try again.; the 403s of POST /api/sharesonly the device's owner or an admin can share its backupsyou cannot share <name>'s backups with yourself: ask to restore them instead, which <email> or another owner or admin approvesnot an active member of a companyThis form has expired. Go back, reload the page and try again. |
| 404 | no such device, <email> is not a member of your companyno such device<email> is not a member of your company |
curl
# answers ; errors 302, 400, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/admin/shares' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"'&device=…&email=…'Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/shares",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"], "device": "…", "email": "…"}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 400, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/shares")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)&device=…&email=…"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 400, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/admin/shares");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")!, ["device"] = "…", ["email"] = "…" });
using var res = await http.SendAsync(req); // answers ; errors 302, 400, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /admin/shares/{id}/remove#
Stop sharing, as POST /.
- Errors: 403 →
This form has expired.(a missing or wrongGo back, reload the page and try again. csrf);not an active member of a company. 404 →no such share.
POST /admin/shares/{id}/remove · from openapi.yaml (postAdminSharesIdRemove)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| path | id string |
| Body | application/x-www-form-urlencodedcsrf string |
| 302 | Found (redirect) |
| 403 | This form has expired. Go back, reload the page and try again. (a missing or wrong csrf); not an active member of a companynot an active member of a companyThis form has expired. Go back, reload the page and try again. |
| 404 | no such shareno such share |
curl
# answers ; errors 302, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/admin/shares/sh_m3k9xq2a7pz4wn5c/remove' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"''Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/shares/sh_m3k9xq2a7pz4wn5c/remove",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"]}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/shares/sh_m3k9xq2a7pz4wn5c/remove")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/admin/shares/sh_m3k9xq2a7pz4wn5c/remove");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")! });
using var res = await http.SendAsync(req); // answers ; errors 302, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /admin/settings#
Form: name, autoJoin (on when ticked; ignored when the company has no domain). As POST /.
POST /admin/settings · from openapi.yaml (postAdminSettings)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedautoJoin stringcsrf stringfaces stringname string |
| 302 | Found (redirect) |
| 400 | Bad Requestauto-join needs a company domain; this company has none<name> is required<name> is too long<name> must not contain control characters |
| 403 | Forbiddenonly the company's owner or an admin may do thisThis form has expired. Go back, reload the page and try again. |
curl
# answers ; errors 302, 400, 403
curl -sS -X POST 'https://spacebackup.net/account/admin/settings' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'autoJoin=…&csrf='"$SA_CSRF"'&faces=…&name=…'Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/settings",
method="POST",
data=urllib.parse.urlencode({"autoJoin": "…", "csrf": os.environ["SA_CSRF"], "faces": "…", "name": "…"}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 400, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/settings")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"autoJoin=…&csrf=\#(saCsrf)&faces=…&name=…"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 400, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/admin/settings");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["autoJoin"] = "…", ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")!, ["faces"] = "…", ["name"] = "…" });
using var res = await http.SendAsync(req); // answers ; errors 302, 400, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /admin/relay/auto-topup#
Form: autoTopUp (on when ticked), pack (sb_pack_500, sb_pack_2000 or sb_pack_5000). Turns auto top-up on with
that pack, or off. Turning it on needs a card saved by an earlier purchase; otherwise the page says "Buy a pack once
first: Stripe keeps that card for auto top-up." Returns to /.
- Errors: 400 →
no such pack. 403 →This form has expired., `only the company's owner or an admin may do this`. (Turning it on without a saved card is not an error: it returns to the page with that message.)Go back, reload the page and try again.
Usage pages. Never indexed (X- and the robots meta tag), never cached.
POST /admin/relay/auto-topup · from openapi.yaml (postAdminRelayAutoTopup)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedautoTopUp stringcsrf stringpack string |
| 302 | Found (redirect) |
| 400 | no such packno such pack |
| 403 | This form has expired. Go back, reload the page and try again., only the company's owner or an admin may do this. (Turning it on without a saved card is not an error: it returns to the page with that message.)only the company's owner or an admin may do thisThis form has expired. Go back, reload the page and try again. |
curl
# answers ; errors 302, 400, 403
curl -sS -X POST 'https://spacebackup.net/account/admin/relay/auto-topup' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'autoTopUp=…&csrf='"$SA_CSRF"'&pack=…'Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/relay/auto-topup",
method="POST",
data=urllib.parse.urlencode({"autoTopUp": "…", "csrf": os.environ["SA_CSRF"], "pack": "…"}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 400, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/relay/auto-topup")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"autoTopUp=…&csrf=\#(saCsrf)&pack=…"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 400, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/admin/relay/auto-topup");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["autoTopUp"] = "…", ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")!, ["pack"] = "…" });
using var res = await http.SendAsync(req); // answers ; errors 302, 400, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /admin/usage#
The company's usage, for its owner and admins: the assistant's requests by outcome, tokens and cost, by day and by
device; the apps' events by day (with the active devices) and by device. Query: days = 7, 30 (default), 90 or
395 (13 months). Days are UTC. A plain member is redirected to /account/me; not signed in: to /account/. It shows
counts only: nothing anyone asked the assistant, nothing in the photos.
GET /admin/usage · from openapi.yaml (getAdminUsage)
| Auth | none |
|---|---|
| query | days string|null (optional) |
| 200 | OK |
| 302 | Found (redirect) |
| 400 | Bad Request<name> must be a string<name> is too long |
curl
# answers 200; errors 302, 400
curl -sS -X GET 'https://spacebackup.net/account/admin/usage?days=1'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/admin/usage?days=1",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 302, 400
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/admin/usage?days=1")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 302, 400
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/admin/usage?days=1");
using var res = await http.SendAsync(req); // answers 200; errors 302, 400
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /operator#
All companies' usage, for the operator accounts named in the service settings (usage.operators) only: the assistant's
requests and cost, active devices and companies by day, and per company its active devices, requests, tokens, cost and
app events. Query: days as above. Anyone else, signed in or not, gets 404, the same answer as an address that does
not exist; the link to it shows only in an operator's page header. Its Unlimited Space Relay panel lists the
unlimited relay months of this month or later, with Revoke on each, and gives more (the two forms below).
GET /operator · from openapi.yaml (getOperator)
| Auth | none |
|---|---|
| query | days string|null (optional) |
| query | msg string|null (optional) |
| 200 | OK |
| 400 | Bad Request<name> must be a string<name> is too long |
curl
# answers 200; errors 400
curl -sS -X GET 'https://spacebackup.net/account/operator?days=1'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/operator?days=1",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/operator?days=1")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/operator?days=1");
using var res = await http.SendAsync(req); // answers 200; errors 400
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /operator/relay/grant#
Form company (a company's id, name or domain, or a member's email), months (1–120), note (optional), csrf; the
operator accounts only (anyone else: 404). Gives the company unlimited Space Relay for whole UTC months: from this
month, or on from the end of the months it already has. The same as spaceaccount relay grant on the server. Redirects
to /account/operator with the outcome, an error too ("Not done: …", below).
- Errors: (shown on the operator page) 404 →
no company "<company>". A name two companies share:more than one company is called "<what>": use its id. 400 →months must be 1 to 120. Not an operator: 404 (no page).
POST /operator/relay/grant · from openapi.yaml (postOperatorRelayGrant)
| Auth | none |
|---|---|
| 400 | months must be 1 to 120. Not an operator: 404 (no page)months must be a whole number |
| 403 | ForbiddenThis form has expired. Go back, reload the page and try again. |
| 404 | no company "<company>". A name two companies share: more than one company is called "<what>": use its idno company "<company>" |
curl
# answers ; errors 400, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/operator/relay/grant'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/operator/relay/grant",
method="POST",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 400, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/operator/relay/grant")!)
req.httpMethod = "POST"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 400, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/operator/relay/grant");
using var res = await http.SendAsync(req); // answers ; errors 400, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /operator/relay/revoke#
Form what (a grant's id rg_…, or a company as above: all its grants of this month or later), csrf; the operator
accounts only (anyone else: 404). The company is back on its free allowance and balance at once. The same as
spaceaccount relay revoke. Redirects to /account/operator with the outcome ("Nothing to revoke" when none is left).
- Errors: (shown on the operator page as "Not done: …") 404 →
no company or grant "<what>". A name two companies share:more than one company is called "<what>": use its id. Not an operator: 404 (no page).
Relay credit pages.
POST /operator/relay/revoke · from openapi.yaml (postOperatorRelayRevoke)
| Auth | none |
|---|---|
| 403 | ForbiddenThis form has expired. Go back, reload the page and try again. |
| 404 | no company or grant "<what>". A name two companies share: more than one company is called "<what>": use its id. Not an operator: 404 (no page)no company or grant "<what>" |
curl
# answers ; errors 403, 404
curl -sS -X POST 'https://spacebackup.net/account/operator/relay/revoke'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/operator/relay/revoke",
method="POST",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/operator/relay/revoke")!)
req.httpMethod = "POST"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/operator/relay/revoke");
using var res = await http.SendAsync(req); // answers ; errors 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /relay#
The buy screen, for any active member: the balance, a warning when activation is needed, the three packs with a Buy
button each and the box "Buy this pack again automatically when the balance drops below 10 %". Not signed in: redirects
to /account/?next=relay.
GET /relay · from openapi.yaml (getRelay)
| Auth | none |
|---|---|
| query | msg string|null (optional) |
| 200 | OK |
| 302 | Found (redirect) |
| 403 | Forbiddennot an active member of a company |
curl
# answers 200; errors 302, 403
curl -sS -X GET 'https://spacebackup.net/account/relay'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/relay",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 302, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/relay")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 302, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/relay");
using var res = await http.SendAsync(req); // answers 200; errors 302, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /relay/activate#
The relay's "activation needed" link (?group=) for devices not signed in and older apps. Signed in,
it redirects to /account/relay; otherwise it explains how to sign in.
GET /relay/activate · from openapi.yaml (getRelayActivate)
| Auth | none |
|---|---|
| query | group string|null (optional) |
| 200 | OK |
| 302 | Found (redirect) |
curl
# answers 200; errors 302
curl -sS -X GET 'https://spacebackup.net/account/relay/activate?group=g7k2mq'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/relay/activate?group=g7k2mq",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 302
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/relay/activate?group=g7k2mq")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 302
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/relay/activate?group=g7k2mq");
using var res = await http.SendAsync(req); // answers 200; errors 302
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /relay/open#
The app's buy link (?t=<token> from POST /api/relay/buy-link). Signs the browser in as the device's user and
redirects to /account/relay. A used or expired link shows "Link expired".
GET /relay/open · from openapi.yaml (getRelayOpen)
| Auth | none |
|---|---|
| query | t string|null (optional) |
| 200 | OK |
| 302 | Found (redirect) |
curl
# answers 200; errors 302
curl -sS -X GET 'https://spacebackup.net/account/relay/open?t=<link+token>'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/relay/open?t=<link+token>",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 302
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/relay/open?t=<link+token>")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 302
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/relay/open?t=<link+token>");
using var res = await http.SendAsync(req); // answers 200; errors 302
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /relay/checkout#
Form: pack, autoTopUp (on when ticked). Starts a Stripe Checkout payment for the company and redirects (302) to
Stripe.
- Errors: (as pages) 400 →
no such pack. 403 →This form has expired.,Go back, reload the page and try again. not an active member of a company. 502 → `The payment page could not be opened (Stripe: <message>). Please try again in a minute.503 →Payments are not set up yet. Please try again later.`
POST /relay/checkout · from openapi.yaml (postRelayCheckout)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedautoTopUp stringcsrf stringpack string |
| 302 | Found (redirect) |
| 400 | no such packno such pack |
| 403 | This form has expired. Go back, reload the page and try again., not an active member of a companynot an active member of a companyThis form has expired. Go back, reload the page and try again. |
| 502 | The payment page could not be opened (Stripe: <message>). Please try again in a minuteThe payment page could not be opened (Stripe: <message>). Please try again in a minute. |
| 503 | Payments are not set up yet. Please try again laterPayments are not set up yet. Please try again later. |
curl
# answers ; errors 302, 400, 403, 502, 503
curl -sS -X POST 'https://spacebackup.net/account/relay/checkout' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'autoTopUp=…&csrf='"$SA_CSRF"'&pack=…'Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/relay/checkout",
method="POST",
data=urllib.parse.urlencode({"autoTopUp": "…", "csrf": os.environ["SA_CSRF"], "pack": "…"}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers ; errors 302, 400, 403, 502, 503
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/relay/checkout")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"autoTopUp=…&csrf=\#(saCsrf)&pack=…"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers ; errors 302, 400, 403, 502, 503
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/relay/checkout");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["autoTopUp"] = "…", ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")!, ["pack"] = "…" });
using var res = await http.SendAsync(req); // answers ; errors 302, 400, 403, 502, 503
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /relay/success#
Stripe's return address after paying (?session_id=). Credits the purchase if the webhook has not yet, and says "Space
Relay 500 GB was added to your relay credit" (or that the payment is being confirmed), with the new balance.
GET /relay/success · from openapi.yaml (getRelaySuccess)
| Auth | none |
|---|---|
| query | session_id string|null (optional) |
| 200 | OK |
| 403 | Forbiddennot an active member of a company |
curl
# answers 200; errors 403
curl -sS -X GET 'https://spacebackup.net/account/relay/success?session_id=cs_test_a1b2'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/relay/success?session_id=cs_test_a1b2",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/relay/success?session_id=cs_test_a1b2")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/relay/success?session_id=cs_test_a1b2");
using var res = await http.SendAsync(req); // answers 200; errors 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /relay/cancel#
Stripe's return address after cancelling (?p=<purchase id>): "Payment cancelled. Nothing was charged."
Album invitation link.
GET /relay/cancel · from openapi.yaml (getRelayCancel)
| Auth | none |
|---|---|
| query | p string|null (optional) |
| 200 | OK |
curl
# answers 200
curl -sS -X GET 'https://spacebackup.net/account/relay/cancel?p=p_q7m2xk9a4zw3pn5c'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/relay/cancel?p=p_q7m2xk9a4zw3pn5c",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/relay/cancel?p=p_q7m2xk9a4zw3pn5c")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/relay/cancel?p=p_q7m2xk9a4zw3pn5c");
using var res = await http.SendAsync(req); // answers 200
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /invite/{id}#
The link in an album invitation mail. A page with Open in Space Backup (spacebackup:/, which opens the
app) and a link to get the app. It shows nothing about the invitation itself: the app fetches it with the invitee's own
sign-in (GET /).
GET /invite/{id} · from openapi.yaml (getInviteId)
| Auth | none |
|---|---|
| path | id string |
| 200 | OK |
curl
# answers 200
curl -sS -X GET 'https://spacebackup.net/account/invite/inv_c4n7zq2m9xa3kw5p'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/invite/inv_c4n7zq2m9xa3kw5p",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/invite/inv_c4n7zq2m9xa3kw5p")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/invite/inv_c4n7zq2m9xa3kw5p");
using var res = await http.SendAsync(req); // answers 200
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Mailed approval links#
Every approve, deny or cancel mail carries a link https:/: one single-use
token per recipient, valid 7 days. Restore-request mails add &d=approve or &d=deny to preselect the button.
| Kind | Mailed to | Buttons |
|---|---|---|
| a restore request (data key) | the owner and admins | Approve, Deny |
| a pending join | the owner and admins | Approve, Deny (the person gets a "You joined" mail) |
| a device waiting for the company key | the owner and admins | Approve |
| a company-key recovery | every admin | Cancel the recovery |
The person following the link must still be the owner or an admin when they click; signing in is not needed (the token is the proof).
GET /approve#
Query: t, d? Shows what the link is about ("Restore OLD-LAPTOP's backups?", "Let bob@acme.com join Acme?") with its
buttons, or that it can no longer be used (decided, used or expired). An unknown token: "Link not valid".
GET /approve · from openapi.yaml (getApprove)
| Auth | none |
|---|---|
| query | t string|null (optional) |
| query | d string|null (optional) |
| 200 | OK |
curl
# answers 200
curl -sS -X GET 'https://spacebackup.net/account/approve?t=<link+token>&d=approve'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/approve?t=<link+token>&d=approve",
method="GET",
headers={},
)
try:
with urllib.request.urlopen(req) as r: # answers 200
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/approve?t=<link+token>&d=approve")!)
req.httpMethod = "GET"
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/approve?t=<link+token>&d=approve");
using var res = await http.SendAsync(req); // answers 200
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /approve#
Form: t, d (approve, deny or cancel), csrf. Decides and shows the result ("Approved: the requesting device
can now restore those backups.").
- Errors: (as pages) 400 →
unknown decision(not one of this kind of link's buttons). 403 → `This form has expired. Go back, reload the page and try again.;only the company's owner or an admin may do this` (the link's email is no longer the owner or an admin). 404 →this link is not valid; or the request is gone:no such data-key request,no such member,no such key request,no such key recovery request. 409 → already decided or no longer possible:this request was already approved|denied, the 409s of the approve routes above (`bob@acme.com is active, not waiting for approval,that device was removed,the recovery copy was already released, …). 410 →this link was already used or has expired. 503 →the recovery copy cannot be opened with this service's recovery key; try again after the operator has fixed it` (a device waiting for the company key).
POST /approve · from openapi.yaml (postApprove)
| Auth | the web session (cookie sa_session) and the form field csrf (the value of the sa_csrf cookie) |
|---|---|
| Body | application/x-www-form-urlencodedcsrf stringd stringt string |
| 200 | OK |
| 400 | unknown decision (not one of this kind of link's buttons)unknown decision |
| 403 | This form has expired. Go back, reload the page and try again.; only the company's owner or an admin may do this (the link's email is no longer the owner or an admin)This form has expired. Go back, reload the page and try again.only the company's owner or an admin may do thisonly the company's owner or an admin may approve this |
| 404 | this link is not valid; or the request is gone: no such data-key request, no such member, no such key request, no such key recovery requestthis link is not validno such data-key requestno such memberno such key requestno such key recovery request |
| 409 | already decided or no longer possible: this request was already approved|denied, the 409s of the approve routes above (bob@acme.com is active, not waiting for approval, that device was removed, the recovery copy was already released, …)this request was already <state><email> is <status>, not waiting for approval<email> belongs to another company nowthat device was removed<name> already has the company keythe company has no recovery copy of its keythe recovery copy was already released |
| 410 | this link was already used or has expiredthis link was already used or has expired |
| 503 | the recovery copy cannot be opened with this service's recovery key; try again after the operator has fixed it (a device waiting for the company key)the recovery copy cannot be opened with this service's recovery key; try again after the operator has fixed it |
curl
# answers 200; errors 400, 403, 404, 409, 410, 503
curl -sS -X POST 'https://spacebackup.net/account/approve' \
-H "Cookie: sa_session=$SA_COOKIE" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data 'csrf='"$SA_CSRF"'&d=…&t=…'Python (stdlib)
import json, os, urllib.parse, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/approve",
method="POST",
data=urllib.parse.urlencode({"csrf": os.environ["SA_CSRF"], "d": "…", "t": "…"}).encode(),
headers={"Cookie": "sa_session=" + os.environ["SA_COOKIE"], "Content-Type": "application/x-www-form-urlencoded"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 403, 404, 409, 410, 503
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let saCookie = ProcessInfo.processInfo.environment["SA_COOKIE"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/approve")!)
req.httpMethod = "POST"
req.setValue("sa_session=\(saCookie)", forHTTPHeaderField: "Cookie")
req.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"csrf=\#(saCsrf)&d=…&t=…"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 403, 404, 409, 410, 503
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/approve");
req.Headers.TryAddWithoutValidation("Cookie", "sa_session=" + Environment.GetEnvironmentVariable("SA_COOKIE"));
req.Content = new FormUrlEncodedContent(new Dictionary<string, string> { ["csrf"] = Environment.GetEnvironmentVariable("SA_CSRF")!, ["d"] = "…", ["t"] = "…" });
using var res = await http.SendAsync(req); // answers 200; errors 400, 403, 404, 409, 410, 503
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");Public links#
A public link is a URL anyone can open in a browser, no app and no account: one photo or video (kind: "item"), or a
selection of them (kind: "selection", a page of thumbnails), or a whole album (kind: "album", a page of what the
album holds when the link is opened). It is deliberately public until it expires or is revoked:
whoever has the URL sees the items. See Public links and the design in
docs/public-links.md.
- A link names items, never files on the service: an album's item (
{"album": "al_), or an asset of the creating device's own Not encrypted backups (…", "id": "<item id>"} {"id": "<index id>", "date": "2026-;10- 18"} dateis the date folder to look in first and may be left out). Albums are always plain copies. An item that is only in an encrypted backup is first copied, plain, into the device's own album "Shared publicly" by the phone itself (it decrypts and sends the file; no key is ever lent), and the link names that album's item. Nothing of an encrypted date is ever served. - The bytes come from one of the company's PCs that is online, through Space Relay, when someone opens the link: the
service is a guest of the company's relay group and reads the item on the PC's guest channel with its own link key
and a link ticket (
access: "link"in album-tickets/check). Nothing is stored on the service. The bytes count to the company's relay traffic. - Default expiry 7 days, at most 90; or a date up to 10 years ahead (
until), or never (never: true:expiresisnull, the link works until it is revoked; iOS request #50). The end of an existing link can be changed (PATCH /api/links/{id}). A link also stops when its device is removed or its member leaves the company; a whole album's link also when the album is deleted.
POST /api/links#
Makes a public link.
- Auth: a registered device of an active member (the link's device).
- Request:
{"items": [{"album": "al_x7k2mq9pa4zw3n5c", "id": "4F2A-77B1"}, {"id": "9C1D-0E3F", "date": "2026-10-18"}], "kind": "selection", "expiresDays": 7, "title": "Las Vegas, day 2"}items: 1 to 200; an item withalbummust be in an album of the company the caller may see (owner or member);kindoptional (itemfor one item, elseselection);expiresDaysoptional, 1 to 90 (default 7);titleoptional, shown on a selection's page.The end (iOS request #50), at most one of:
expiresDays(ordays) 1 to 90 from now;"until": "2027-06-30", a dateyyyy-MM-ddfrom today to 10 years ahead, the link working through that whole day (UTC:expiresis the next day 00:00 UTC), or an ISO 8601 time with an offset,"until": "2027-(the end of the phone's local day;06- 30T23:59:59- 04:00" Zor±hh:mm, seconds and fractions optional; a time without an offset: 400), the link ending at that instant: later than now and at most the end of the farthest date (10 years ahead, 00:00 UTC the day after);"never": true, no end (expires: null,never: truein the answer), until it is revoked. More than one of them: 400. None: 7 days."never": falseis the same as leaving it out.The short form the phone sends: `{"kind": "selection", "album": "al_x7k2mq9pa4zw3n5c", "ids": ["4F2A-77B1", "4F2A-77B2"], "days": 7}
.ids*optional*: items of onealbum, or (withdate` instead) of the device's Not encrypted backups of that date folder;albumanddatenot both.daysoptional: the same asexpiresDays. Given withitems, both sets of items are kept.A whole album (iOS request #47): `{"kind": "album", "album": "al_x7k2mq9pa4zw3n5c", "days": 30, "title": "Las Vegas"}
, noitems,idsordate`, and no 200-item cap. Only the album's owner, or the company's **owner or an admin**, may make one. The link names the album, not its items: its page shows what the album holds whenever it is opened (items added later appear, removed ones disappear).titleoptional (default: the album's name at the time it is opened). - Response: 201
{"id": "ln_c4n7zq2m9xa3kw5p", "url": "https://spacebackup.net/l/q2Xv9KpL3mN8rT5wY7zA1bC4dEf", "kind": "selection", "title": "Las Vegas, day 2", "device": "d_7pz4wn5cq2am3k9x", "deviceName": "Annas-iPhone", "email": "anna@acme.com", "created": "2026-10-20T10:00:00.000+00:00", "expires": "2026-10-27T10:00:00.000+00:00", "revoked": null, "views": 0, "lastView": null, "state": "active", "items": [{"album": "al_x7k2mq9pa4zw3n5c", "id": "4F2A-77B1"}, {"id": "9C1D-0E3F", "date": "2026-10-18"}], "token": "q2Xv9KpL3mN8rT5wY7zA1bC4dEf", "never": false, "count": 2}expires: when the link stops;nullfor a link that never ends, and thenneveristrue(neveris always given).token: the last part ofurl.count: the number of items. When every item is in the same album,albumandidsare given too; when every item is of the same backup date,dateandids; when none is in an album,ids.A whole album's link answers
"kind": "album","album": "al_…","albumName": "<its name now>"(absent once the album is deleted),"count": the album's item count as the service has it,"items": []and noids. - Errors: 400 →
items (or ids) is required,give album or date, not both,items must name at least one item,a link holds at most 200 items,kind must be item, selection or album,a link of kind item names exactly one item,expiresDays must be 1 to 90,give only one of never, until or expiresDays,until must be a date, yyyy-,MM- dd, or an ISO 8601 time with an offset until must be today or later,until must be later than now,until must be at most 10 years ahead,items[].,date must be a date folder, yyyy- MM- dd album is required for a link of kind album, `a link of kind album names the album only (no items, ids or date). 403 →this device is not registered (devices/register)`,the album … is not shared with you, `only the album's owner or the company's owner or an admin may make a public link to the whole album. 404 →no such album: …`.
POST /api/links · from openapi.yaml (postLinks)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json LinkCreateitems LinkItemRequest[]kind string|nullexpiresDays integer|nulltitle string|nullalbum string|nulldate string|nullids string[]days integer|nullnever boolean|nulluntil string|null |
| 201 | `expires`: when the link stops → LinkView {id: string, url: string, kind: string, title: string|null, device: string, deviceName: string, email: string, created: string(date-time), expires: string(date-time)|null, revoked: string(date-time)|null, views: integer(int64), lastView: string(date-time)|null, state: string, items: LinkItemView[], token: string, albumName?: string|null} |
| 400 | items (or ids) is required, give album or date, not both, items must name at least one item, a link holds at most 200 items, kind must be item, selection or album, a link of kind item names exactly one item, expiresDays must be 1 to 90, give only one of never, until or expiresDays, until must be a date, yyyy-MM-dd, or an ISO 8601 time with an offset, until must be today or later, until must be later than now, until must be at most 10 years ahead, items[].date must be a date folder, yyyy-MM-dd, album is required for a link of kind album, a link of kind album names the album only (no items, ids or date)give album or date, not bothitems (or ids) is requireditems must name at least one itema link holds at most 200 itemskind must be item, selection or albuma link of kind item names exactly one itemitems[].date must be a date folder, yyyy-MM-ddalbum is required for a link of kind albuma link of kind album names the album only (no items, ids or date)<name> is required<name> is too long<name> must not contain control charactersbad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | this device is not registered (devices/register), the album … is not shared with you, only the album's owner or the company's owner or an admin may make a public link to the whole albumthe album <name> is not shared with younot an active member of a companyonly the album's owner or the company's owner or an admin may make a public link to the whole albumthis device is not registered (devices/register) |
| 404 | no such album: …no such album: <albumId> |
curl
# answers 201; errors 400, 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/links' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"items":[{"album":"al_x7k2mq9pa4zw3n5c","id":"4F2A-77B1"},{"id":"9C1D-0E3F","date":"2026-10-18"}],"kind":"selection","expiresDays":7,"title":"Las Vegas, day 2"}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/links",
method="POST",
data=json.dumps({"items": [{"album": "al_x7k2mq9pa4zw3n5c", "id": "4F2A-77B1"}, {"id": "9C1D-0E3F", "date": "2026-10-18"}], "kind": "selection", "expiresDays": 7, "title": "Las Vegas, day 2"}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 201; errors 400, 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/links")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"items":[{"album":"al_x7k2mq9pa4zw3n5c","id":"4F2A-77B1"},{"id":"9C1D-0E3F","date":"2026-10-18"}],"kind":"selection","expiresDays":7,"title":"Las Vegas, day 2"}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 201; errors 400, 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/links");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"items":[{"album":"al_x7k2mq9pa4zw3n5c","id":"4F2A-77B1"},{"id":"9C1D-0E3F","date":"2026-10-18"}],"kind":"selection","expiresDays":7,"title":"Las Vegas, day 2"}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 201; errors 400, 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");GET /api/links#
The calling device's links, newest first; ?all=1: every link of the company (owner and admins only). Revoked and
expired links stay listed (with their state) for 30 days. A link that never ends has "expires": null, `"never":
trueand staysactive` until it is revoked. The company's admin page lists the same links (Public links: Expires
Never for those), with a Revoke button.
- Auth: a registered device of an active member;
all=1an owner or admin. - Response: 200
{"links": [<link as in POST /api/ links>]} - Errors: 403 →
only the company's owner or an admin may list every link.
GET /api/links · from openapi.yaml (getLinks)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| query | all string|null (optional) |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 200 | OK → LinkListView {links: LinkView[]} |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | only the company's owner or an admin may list every linkonly the company's owner or an admin may list every linknot an active member of a companythis device is not registered (devices/register) |
curl
# answers 200; errors 401, 403
curl -sS -X GET 'https://spacebackup.net/account/api/links?all=1' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/links?all=1",
method="GET",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 401, 403
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/links?all=1")!)
req.httpMethod = "GET"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 401, 403
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Get, "https://spacebackup.net/account/api/links?all=1");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 200; errors 401, 403
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");PATCH /api/links/{id}#
A new end for an existing link (iOS request #50). Takes the link's id or its token. An expired link works again
(while it is still listed, 30 days); a revoked link stays revoked.
- Auth: the link's member (any of their devices), or the company's owner or an admin.
- Request: exactly one of
{"never": true},{"until": "2027-06-30"}(from today to 10 years ahead, through that day UTC; or a time with an offset,"2027-, as in POST) or06- 30T23:59:59- 04:00" {"expiresDays": 30}(1 to 90 from now;daystoo). - Response: 200, the link as in POST /api/links with its new
expires(nullfor never),neverandstate. - Errors: 400 →
give one of never, until or expiresDays,give only one of never, until or expiresDays,until must be a date, yyyy-,MM- dd, or an ISO 8601 time with an offset until must be today or later,until must be later than now,until must be at most 10 years ahead,expiresDays must be 1 to 90. 404 →no such link. 409 →the link is revoked; make a new one.
PATCH /api/links/{id} · from openapi.yaml (patchLinksId)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| Body | application/json LinkExpiryChangenever boolean|nulluntil string|nullexpiresDays integer|nulldays integer|null |
| 200 | The link as in POST /api/links with its new `expires` (`null` for never), `never` and `state` → LinkView {id: string, url: string, kind: string, title: string|null, device: string, deviceName: string, email: string, created: string(date-time), expires: string(date-time)|null, revoked: string(date-time)|null, views: integer(int64), lastView: string(date-time)|null, state: string, items: LinkItemView[], token: string, albumName?: string|null} |
| 400 | give one of never, until or expiresDays, give only one of never, until or expiresDays, until must be a date, yyyy-MM-dd, or an ISO 8601 time with an offset, until must be today or later, until must be later than now, until must be at most 10 years ahead, expiresDays must be 1 to 90give only one of never, until or expiresDaysuntil must be later than nowuntil must be at most 10 years aheaduntil must be today or latergive one of never, until or expiresDaysexpiresDays must be 1 to <maxDays>bad request: <the JSON parser's message> |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
| 404 | no such linkno such link |
| 409 | the link is revoked; make a new onethe link is revoked; make a new one |
curl
# answers 200; errors 400, 401, 403, 404, 409
curl -sS -X PATCH 'https://spacebackup.net/account/api/links/x_k3xq7m2pa9fz4w8r' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2" \
-H "Content-Type: application/json" \
--data '{"never":true}'Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/links/x_k3xq7m2pa9fz4w8r",
method="PATCH",
data=json.dumps({"never": True}).encode(),
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2", "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as r: # answers 200; errors 400, 401, 403, 404, 409
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/links/x_k3xq7m2pa9fz4w8r")!)
req.httpMethod = "PATCH"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = Data(#"{"never":true}"#.utf8)
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 200; errors 400, 401, 403, 404, 409
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Patch, "https://spacebackup.net/account/api/links/x_k3xq7m2pa9fz4w8r");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
req.Content = new StringContent("""{"never":true}""", Encoding.UTF8, "application/json");
using var res = await http.SendAsync(req); // answers 200; errors 400, 401, 403, 404, 409
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");POST /api/links/{id}/revoke#
Stops a link at once (its URL answers 404 from then on, and the PCs refuse its ticket at their next check).
- Auth: the link's member (any of their devices), or the company's owner or an admin.
- Request: no body.
- Response: 204 (also when it was revoked already).
- Errors: 404 →
no such link.
POST /api/links/{id}/revoke · from openapi.yaml (postLinksIdRevoke)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | (also when it was revoked already) |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
| 404 | no such linkno such link |
curl
# answers 204; errors 401, 403, 404
curl -sS -X POST 'https://spacebackup.net/account/api/links/x_k3xq7m2pa9fz4w8r/revoke' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/links/x_k3xq7m2pa9fz4w8r/revoke",
method="POST",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/links/x_k3xq7m2pa9fz4w8r/revoke")!)
req.httpMethod = "POST"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://spacebackup.net/account/api/links/x_k3xq7m2pa9fz4w8r/revoke");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");DELETE /api/links/{id}#
The same as POST /api/links/{id}/revoke. Both take the link's id or its token.
- Auth: the link's member (any of their devices), or the company's owner or an admin.
- Response: 204 (also when it was revoked already).
- Errors: 404 →
no such link.
DELETE /api/links/{id} · from openapi.yaml (deleteLinksId)
| Auth | Authorization: Bearer <device token> (POST /api/signin/code or /api/signin/poll gives it) |
|---|---|
| path | id string |
| header | X-SpaceBackup-Version string (optional) · The app's version (up to 40 characters), recorded as the device's app version. |
| 204 | (also when it was revoked already) |
| 401 | Unauthorizednot signed innot signed in (token unknown or revoked) |
| 403 | Forbiddennot an active member of a company |
| 404 | no such linkno such link |
curl
# answers 204; errors 401, 403, 404
curl -sS -X DELETE 'https://spacebackup.net/account/api/links/x_k3xq7m2pa9fz4w8r' \
-H "Authorization: Bearer $SPACEBACKUP_TOKEN" \
-H "X-SpaceBackup-Version: 1.8.2"Python (stdlib)
import json, os, urllib.request, urllib.error
req = urllib.request.Request(
"https://spacebackup.net/account/api/links/x_k3xq7m2pa9fz4w8r",
method="DELETE",
headers={"Authorization": "Bearer " + os.environ["SPACEBACKUP_TOKEN"], "X-SpaceBackup-Version": "1.8.2"},
)
try:
with urllib.request.urlopen(req) as r: # answers 204; errors 401, 403, 404
raw = r.read()
print(r.status, json.loads(raw) if raw else None)
except urllib.error.HTTPError as e:
print(e.code, e.read().decode()) # {"error": "..."}Swift (URLSession)
import Foundation
let spacebackupToken = ProcessInfo.processInfo.environment["SPACEBACKUP_TOKEN"]!
var req = URLRequest(url: URL(string: "https://spacebackup.net/account/api/links/x_k3xq7m2pa9fz4w8r")!)
req.httpMethod = "DELETE"
req.setValue("Bearer \(spacebackupToken)", forHTTPHeaderField: "Authorization")
req.setValue("1.8.2", forHTTPHeaderField: "X-SpaceBackup-Version")
let (data, response) = try await URLSession.shared.data(for: req)
let status = (response as! HTTPURLResponse).statusCode // answers 204; errors 401, 403, 404
print(status, String(decoding: data, as: UTF8.self))C# (HttpClient)
using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Delete, "https://spacebackup.net/account/api/links/x_k3xq7m2pa9fz4w8r");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SPACEBACKUP_TOKEN"));
req.Headers.TryAddWithoutValidation("X-SpaceBackup-Version", "1.8.2");
using var res = await http.SendAsync(req); // answers 204; errors 401, 403, 404
Console.WriteLine($"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}");The public pages#
Served by the account service at https:/ (nginx location /l/), no sign-in:
| URL | What |
|---|---|
/l/<token> | an item link: the file itself (Content-Type from its name, inline for photos and videos), or its single view when a browser asks for HTML (Accept: text/html); a selection: the gallery (a grid of thumbnails, each linking to its single view) |
/l/<token>/<n> | item n (from 0) of the link |
/l/<token>/<n>/thumb | its thumbnail (JPEG) |
/l/<token>/<n>/jpg | a HEIC (HEIF, TIFF, RAW) photo as JPEG, converted by the PC that serves it (full size, orientation applied, no location data; named <stem>.jpg); any other item as it is |
/l/<token>/v/<n> | the single view of item n: an HTML page with that item open (its own URL to share or reload) |
/l/<token>?page=<n> | an album link: the gallery of what the album holds now, 60 per page (page from 1), oldest first, with the number of items not shown because no plain copy is on the PC serving it |
/l/<token>/a/<key> | an item of an album link (key: 16 hex characters, from its page; it names no device or id) |
/l/<token>/a/<key>/thumb, /l/<token>/a/<key>/jpg | its thumbnail (JPEG); its JPEG, as above |
/l/<token>/v/<key> | the single view of an album link's item (on the album's page that holds it) |
GETandHEAD; oneRange: bytes=…per request (206 withContent-Range, 416 out of range), so videos stream and seek.- 404 for an unknown, revoked or expired link (and an item no PC has any more); 503 "The owner's computers are
offline. Try again later." (with
Retry-After: 300) when no PC that may hold it is online ("…need a newer Space Backup to share this…" when the online ones are from before public links); 429 beyond the limits below (Retry-After: 60). - An
albumlink's page comes from one online PC holding the album. It shows only items whose plain album copy is on that PC's connected drives, never anything of an encrypted backup; items without one are counted ("N items are not shown"). Items deleted or archived on the phone (as its newest Not encrypted backup on that PC says) are not shown. A removed item's URL answers 404. - Downloads:
?dl=1on any file URL (/l/<token>/<n>?dl=1,/l/<token>/<n>/jpg?dl=1,/a/<key>…?dl=1) answersContent-(the original's name, orDisposition: attachment; filename= "…"; filename*= UTF- 8''… <stem>.jpg); without it photos and videos areinline. The single view offers JPEG and Original (.heic) for a HEIC photo. - The gallery (iOS request #48): the single view has ← / → (buttons, arrow keys, swipe; on an album they go on across pages), full screen (the Fullscreen API; on an iPhone the controls hide until a tap) and a slideshow (3, 5, 10 or 20 s per photo, remembered in the browser; a video plays to its end). All of it is served by the account service: plain HTML, CSS and a small script, nothing from another site.
- A JPEG is made on the PC that serves the item, once per item (cached on that PC, encrypted at rest); a PC from
before this (
links< 3) sends the original instead. - Every opening of an item link from its start (or of its single view), every opening of a selection's page or of a
single view's page (
/v/…), and every opening of an album link's first page counts one view (views,lastView). - Pages and files carry
X-andRobots- Tag: noindex, nofollow Referrer-.Policy: no- referrer
Service settings#
For people running their own account service: the settings file is / (or
spaceaccount -). The values that change what an integrator sees:
| Setting | Default | Effect |
|---|---|---|
publicUrl | https:/ | the base of every mailed link |
recoveryDelayHours | 24 | how long a company-key recovery waits before release |
keyHandoverWaitSeconds | 120 | how long a new device waits for a handover before the owner and admins are mailed |
secureCookies | true | the Secure flag on cookies (off only for local tests) |
relay.freeGbPerMonth | 5 | free relay GB per company per month; null = unlimited |
appStoreUrl | https:/ | where an album invitation sends someone without the app |
assistant., assistant.companyPerHour | 20, 200 | the assistant's abuse guard (there is no daily limit) |
assistant.prices | Haiku 5.5, Haiku 4.5, Sonnet 5.5, Opus 5.5 list prices | USD per million tokens (input, output, cacheRead, cacheWrite) by model, for the cost on the usage pages; a model missing here costs 0 |
alexa.skillIds, alexa.vendorIds | none | the Alexa skill's skill ids (requests of any other refused) and the Amazon vendor ids its account-linking redirects may name (none: linking refused) |
usage.operators | none | the emails that may open /account/operator |
usage.rawDays, usage.dailyMonths | 90, 13 | how long raw usage rows and daily totals are kept |
usage.maxEvents, usage.reportsPerHour | 500, 60 | events in one POST /api/usage, and reports an hour per device |
push.windowMinutes, push.gatherSeconds | 5, 30 | album-add push coalescing |
links.publicBase | https:/ | the base of a public link's URL |
links.defaultDays, links.maxDays | 7, 90 | a public link's expiry in days (until up to 10 years and never are apart) |
links.perLinkPerMinute, links., links.perIpPerMinute | 300, 1200, 600 | requests to the public pages (per link: pages and files; per link: /thumb; per client address: all) |
links.relayAddress | relay. | the relay the service reaches the PCs through |
Secrets (the Stripe key and webhook secret, the assistant's API key, the Alexa skill's client secret if one is used
(SPACEBACKUP_), the SMTP password, the APNs key, the recovery key
and the relay secret) come only from the environment or from files readable by the service; they are never in the
settings file or the repository. Without a Stripe key payments are off (paymentsEnabled: false); without an assistant
key the assistant answers 503; without an APNs key pushes are dropped (the inbox still works).
Errors and limits#
The error shape#
Every error of a /api/… route is JSON:
{"error": "only the company's owner or an admin may do this"}
The error text is a plain sentence that can be shown to a person. Extra fields where said:
| Field | On |
|---|---|
attemptsLeft (int) | 400 wrong sign-in code |
keyVersion (int) | 409 on key/deliver and company/key: the company's current key version |
code (string) | invite_needed (409 company/join), name_invalid (400 devices/register), name_taken (409 devices/register), name_clash (409 PUT devices/state) |
A body that is not valid JSON, or of the wrong shape, answers 400 {"error": "bad request: <details>"}. Errors of the
web pages are HTML pages with the same status codes.
Status codes#
| Status | Meaning |
|---|---|
| 200 | done; the body is the answer |
| 201 | done, something new was made (a group, an album, a share, an invitation, a remove request) |
| 204 | done, no body |
| 302 | (web pages) go to the Location |
| 400 | bad input: a missing or invalid field, JSON that does not parse |
| 401 | no token, or the token is unknown or revoked: sign in again |
| 403 | not allowed: role, not an active member, no registered device, the wrong device, a missing CSRF token |
| 404 | unknown, or not yours to see (the service does not tell the two apart) |
| 409 | conflict: already a member, name taken, the key changed, already decided |
| 410 | gone: a sign-in or invitation expired or was used, a mailed link was used or expired |
| 413 | the request body is too large |
| 415 | PUT /api/devices/state without Content- |
| 429 | a rate limit; try again later |
| 500 | an unexpected server fault (a bug; reported in its log); no route answers it on purpose |
| 502 | (web) Stripe could not be reached for a checkout |
| 503 | the sign-in mail could not be sent; the assistant is unavailable; (web) payments are not set up; (webhook, relay report) not set up; the recovery copy of the company key does not open with the service's recovery key (an operator fault, reported in its log; try again later) |
Size limits#
| What | Limit |
|---|---|
| Request body | 1 MB (413 beyond) |
PUT /api/devices/state body | 12 MB; sealed up to 8 MB decoded |
sealed, recovery, wrapped (key boxes) | 64 KB of base64 |
| Email addresses | 3–254 characters |
| Company names, album names, sign-in device names | 1–100 characters |
| First name, last name | 40 characters each |
| Group names | 40 characters; 500 members; 200 groups per person |
| Device labels | 64 characters |
Machine names (devices/register) | 1–64 characters |
| Album destinations | 8 per album |
| Album share in one request | 100 addresses |
| Album item and cover ids | 200 characters |
notifications page | 1–200 (default 50); notifications/read at most 1,000 ids |
notifications/wait | at most 55 s (default 25 s) |
people?q= | 200 characters; 50 results (all=1: 500) |
Assistant text | 1,000 characters |
POST /api/usage | 500 events; outcome 32 characters |
Rate limits#
| What | Limit | Beyond |
|---|---|---|
POST /api/signin/start (and the web sign-in) | per email: 5 per 15 minutes and 20 per day; per client IP: 30 per hour | 429 too many sign- |
| Wrong sign-in codes | 5 per sign-in request | the request is dead: 410 |
GET /api/people | 60 per minute per person | 429 too many searches; try again in a minute |
| Album invitations (outside the company) | 200 per sender per 24 hours | 429 too many invitations today (at most 200 a day) |
POST / | 50 new requests per person per 24 hours (repeats not counted) | 429 too many remove requests today (at most 50 a day) |
POST /api/assistant | 20 a minute per device and 200 an hour per company (an abuse guard; no daily limit) | 429 Too many assistant requests in a short time (…). |
POST /api/usage | 60 reports an hour per device | 429 Too many usage reports from this device (at most 60 an hour). |
| Album-add pushes | at most one per album per person per 5 minutes (adds are summed) | coalesced, not refused |
Public link pages and files (/l/…, single views and JPEG conversions included) | 300 per minute per link (thumbnails apart: 1200 per minute per link); 600 per minute per client IP over all links | 429 |
The client IP used for the sign-in limit is the address the public web server saw. The service's logs never hold tokens, codes, secrets or sealed boxes.