curl --request POST \
--url http://localhost:3000/api/backup/restore \
--header 'Content-Type: application/json' \
--header 'Origin: <api-key>' \
--header 'X-Auditor-Admin-Token: <api-key>' \
--data '
{
"version": 1,
"exportedAt": 123,
"apps": [
{
"id": 324684580,
"name": "Spotify - Music and Podcasts",
"url": "https://apps.apple.com/us/app/spotify-music-and-podcasts/id324684580",
"changeCount": 2,
"bundleId": "com.spotify.client",
"developer": "Spotify Ltd.",
"privacyPolicyUrl": "<string>",
"firstSeen": 123
}
]
}
'import requests
url = "http://localhost:3000/api/backup/restore"
payload = {
"version": 1,
"exportedAt": 123,
"apps": [
{
"id": 324684580,
"name": "Spotify - Music and Podcasts",
"url": "https://apps.apple.com/us/app/spotify-music-and-podcasts/id324684580",
"changeCount": 2,
"bundleId": "com.spotify.client",
"developer": "Spotify Ltd.",
"privacyPolicyUrl": "<string>",
"firstSeen": 123
}
]
}
headers = {
"Origin": "<api-key>",
"X-Auditor-Admin-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Origin: '<api-key>',
'X-Auditor-Admin-Token': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
version: 1,
exportedAt: 123,
apps: [
{
id: 324684580,
name: 'Spotify - Music and Podcasts',
url: 'https://apps.apple.com/us/app/spotify-music-and-podcasts/id324684580',
changeCount: 2,
bundleId: 'com.spotify.client',
developer: 'Spotify Ltd.',
privacyPolicyUrl: '<string>',
firstSeen: 123
}
]
})
};
fetch('http://localhost:3000/api/backup/restore', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/backup/restore",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'version' => 1,
'exportedAt' => 123,
'apps' => [
[
'id' => 324684580,
'name' => 'Spotify - Music and Podcasts',
'url' => 'https://apps.apple.com/us/app/spotify-music-and-podcasts/id324684580',
'changeCount' => 2,
'bundleId' => 'com.spotify.client',
'developer' => 'Spotify Ltd.',
'privacyPolicyUrl' => '<string>',
'firstSeen' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Origin: <api-key>",
"X-Auditor-Admin-Token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/api/backup/restore"
payload := strings.NewReader("{\n \"version\": 1,\n \"exportedAt\": 123,\n \"apps\": [\n {\n \"id\": 324684580,\n \"name\": \"Spotify - Music and Podcasts\",\n \"url\": \"https://apps.apple.com/us/app/spotify-music-and-podcasts/id324684580\",\n \"changeCount\": 2,\n \"bundleId\": \"com.spotify.client\",\n \"developer\": \"Spotify Ltd.\",\n \"privacyPolicyUrl\": \"<string>\",\n \"firstSeen\": 123\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Origin", "<api-key>")
req.Header.Add("X-Auditor-Admin-Token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:3000/api/backup/restore")
.header("Origin", "<api-key>")
.header("X-Auditor-Admin-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"version\": 1,\n \"exportedAt\": 123,\n \"apps\": [\n {\n \"id\": 324684580,\n \"name\": \"Spotify - Music and Podcasts\",\n \"url\": \"https://apps.apple.com/us/app/spotify-music-and-podcasts/id324684580\",\n \"changeCount\": 2,\n \"bundleId\": \"com.spotify.client\",\n \"developer\": \"Spotify Ltd.\",\n \"privacyPolicyUrl\": \"<string>\",\n \"firstSeen\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/backup/restore")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Origin"] = '<api-key>'
request["X-Auditor-Admin-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"version\": 1,\n \"exportedAt\": 123,\n \"apps\": [\n {\n \"id\": 324684580,\n \"name\": \"Spotify - Music and Podcasts\",\n \"url\": \"https://apps.apple.com/us/app/spotify-music-and-podcasts/id324684580\",\n \"changeCount\": 2,\n \"bundleId\": \"com.spotify.client\",\n \"developer\": \"Spotify Ltd.\",\n \"privacyPolicyUrl\": \"<string>\",\n \"firstSeen\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"error": "Admin token required"
}{
"error": "Admin token required"
}{
"error": "Admin token required",
"code": "untrusted_backup",
"signaturePresent": true
}{
"error": "Admin token required"
}Restore a backup bundle
Wipes the existing database and reloads from the bundle. There is no
confirm parameter — the typed RESTORE step exists only in the
browser UI, so an API call restores immediately.
Envelopes are HMAC-signed with a key unique to the exporting install.
A bundle from anywhere else fails verification and is rejected with
409 unless allowUntrusted is set.
Rate-limited to 3 attempts per 10 minutes.
curl --request POST \
--url http://localhost:3000/api/backup/restore \
--header 'Content-Type: application/json' \
--header 'Origin: <api-key>' \
--header 'X-Auditor-Admin-Token: <api-key>' \
--data '
{
"version": 1,
"exportedAt": 123,
"apps": [
{
"id": 324684580,
"name": "Spotify - Music and Podcasts",
"url": "https://apps.apple.com/us/app/spotify-music-and-podcasts/id324684580",
"changeCount": 2,
"bundleId": "com.spotify.client",
"developer": "Spotify Ltd.",
"privacyPolicyUrl": "<string>",
"firstSeen": 123
}
]
}
'import requests
url = "http://localhost:3000/api/backup/restore"
payload = {
"version": 1,
"exportedAt": 123,
"apps": [
{
"id": 324684580,
"name": "Spotify - Music and Podcasts",
"url": "https://apps.apple.com/us/app/spotify-music-and-podcasts/id324684580",
"changeCount": 2,
"bundleId": "com.spotify.client",
"developer": "Spotify Ltd.",
"privacyPolicyUrl": "<string>",
"firstSeen": 123
}
]
}
headers = {
"Origin": "<api-key>",
"X-Auditor-Admin-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Origin: '<api-key>',
'X-Auditor-Admin-Token': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
version: 1,
exportedAt: 123,
apps: [
{
id: 324684580,
name: 'Spotify - Music and Podcasts',
url: 'https://apps.apple.com/us/app/spotify-music-and-podcasts/id324684580',
changeCount: 2,
bundleId: 'com.spotify.client',
developer: 'Spotify Ltd.',
privacyPolicyUrl: '<string>',
firstSeen: 123
}
]
})
};
fetch('http://localhost:3000/api/backup/restore', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/backup/restore",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'version' => 1,
'exportedAt' => 123,
'apps' => [
[
'id' => 324684580,
'name' => 'Spotify - Music and Podcasts',
'url' => 'https://apps.apple.com/us/app/spotify-music-and-podcasts/id324684580',
'changeCount' => 2,
'bundleId' => 'com.spotify.client',
'developer' => 'Spotify Ltd.',
'privacyPolicyUrl' => '<string>',
'firstSeen' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Origin: <api-key>",
"X-Auditor-Admin-Token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/api/backup/restore"
payload := strings.NewReader("{\n \"version\": 1,\n \"exportedAt\": 123,\n \"apps\": [\n {\n \"id\": 324684580,\n \"name\": \"Spotify - Music and Podcasts\",\n \"url\": \"https://apps.apple.com/us/app/spotify-music-and-podcasts/id324684580\",\n \"changeCount\": 2,\n \"bundleId\": \"com.spotify.client\",\n \"developer\": \"Spotify Ltd.\",\n \"privacyPolicyUrl\": \"<string>\",\n \"firstSeen\": 123\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Origin", "<api-key>")
req.Header.Add("X-Auditor-Admin-Token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:3000/api/backup/restore")
.header("Origin", "<api-key>")
.header("X-Auditor-Admin-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"version\": 1,\n \"exportedAt\": 123,\n \"apps\": [\n {\n \"id\": 324684580,\n \"name\": \"Spotify - Music and Podcasts\",\n \"url\": \"https://apps.apple.com/us/app/spotify-music-and-podcasts/id324684580\",\n \"changeCount\": 2,\n \"bundleId\": \"com.spotify.client\",\n \"developer\": \"Spotify Ltd.\",\n \"privacyPolicyUrl\": \"<string>\",\n \"firstSeen\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/backup/restore")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Origin"] = '<api-key>'
request["X-Auditor-Admin-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"version\": 1,\n \"exportedAt\": 123,\n \"apps\": [\n {\n \"id\": 324684580,\n \"name\": \"Spotify - Music and Podcasts\",\n \"url\": \"https://apps.apple.com/us/app/spotify-music-and-podcasts/id324684580\",\n \"changeCount\": 2,\n \"bundleId\": \"com.spotify.client\",\n \"developer\": \"Spotify Ltd.\",\n \"privacyPolicyUrl\": \"<string>\",\n \"firstSeen\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"error": "Admin token required"
}{
"error": "Admin token required"
}{
"error": "Admin token required",
"code": "untrusted_backup",
"signaturePresent": true
}{
"error": "Admin token required"
}Authorizations
Same-origin CSRF check. The Origin header must match the request host;
enforced for every mutating verb (POST, PUT, PATCH, DELETE).
Required when AUDITOR_ADMIN_TOKEN is set in the environment, and — on a
network-exposed instance — on the sensitive read prefixes listed on the
Overview page. Verified with
crypto.timingSafeEqual. Missing or wrong token returns 401. Failed
attempts are recorded in audit_log with IP + user agent.
Browser callers may send the pt_admin_token HttpOnly cookie instead;
it is accepted everywhere this header is. Obtain it from
POST /api/auth/admin-token/login.
Query Parameters
Restore a bundle whose signature doesn't match this install.
Equivalent to the x-allow-untrusted-backup header.
1, true Body
Versioned export of every app, label, snapshot, annotation, notification, focus state, and feature-flag override. Restorable into any release that understands this bundle format or a later one.
Exported envelopes also carry a signature object (HMAC-SHA256 over
the canonicalised envelope, keyed per install). Restoring a bundle
whose signature doesn't match the target install requires
allowUntrusted — see POST /api/backup/restore.
Response
Restore complete.