Returns list with all available backup files.
Only admins can perform this action.
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://127.0.0.1:8090');
...
await pb.admins.authWithPassword('test@example.com', '1234567890');
const backups = await pb.backups.getFullList();
import 'package:pocketbase/pocketbase.dart';
final pb = PocketBase('http://127.0.0.1:8090');
...
await pb.admins.authWithPassword('test@example.com', '1234567890');
final backups = await pb.backups.getFullList();
Param | Type | Description |
---|---|---|
fields | String | Comma separated string of the fields to return in the JSON response (by default returns all fields). Ex.: ?fields=*,expand.relField.name
In addition, the following field modifiers are also supported:
|
[
{
"key": "pb_backup_20230519162514.zip",
"modified": "2023-05-19 16:25:57.542Z",
"size": 251316185
},
{
"key": "pb_backup_20230518162514.zip",
"modified": "2023-05-18 16:25:57.542Z",
"size": 251314010
}
]
{
"code": 400,
"message": "Failed to load backups filesystem.",
"data": {}
}
{
"code": 401,
"message": "The request requires admin authorization token to be set.",
"data": {}
}
{
"code": 403,
"message": "Only admins can perform this action.",
"data": {}
}
Creates a new app data backup.
This action will return an error if there is another backup/restore operation already in progress.
Only admins can perform this action.
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://127.0.0.1:8090');
...
await pb.admins.authWithPassword('test@example.com', '1234567890');
await pb.backups.create('new_backup.zip');
import 'package:pocketbase/pocketbase.dart';
final pb = PocketBase('http://127.0.0.1:8090');
...
await pb.admins.authWithPassword('test@example.com', '1234567890');
await pb.backups.create('new_backup.zip');
Authorization: TOKEN
Param | Type | Description |
---|---|---|
Optional
name |
String | The base name of the backup file to create.
Must be in the format [a-z0-9_-].zip
If not set, it will be auto generated. |
null
{
"code": 400,
"message": "Try again later - another backup/restore process has already been started.",
"data": {}
}
{
"code": 401,
"message": "The request requires admin authorization token to be set.",
"data": {}
}
{
"code": 403,
"message": "You are not allowed to perform this request.",
"data": {}
}
Uploads an existing backup zip file.
Only admins can perform this action.
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://127.0.0.1:8090');
...
await pb.admins.authWithPassword('test@example.com', '1234567890');
await pb.backups.upload({ file: new Blob([...]) });
import 'package:pocketbase/pocketbase.dart';
final pb = PocketBase('http://127.0.0.1:8090');
...
await pb.admins.authWithPassword('test@example.com', '1234567890');
await pb.backups.upload(http.MultipartFile.fromBytes('file', ...));
Authorization: TOKEN
Param | Type | Description |
---|---|---|
Required
file |
File | The zip archive to upload. |
null
{
"code": 400,
"message": "Something went wrong while processing your request.",
"data": {
"file": {
"code": "validation_invalid_mime_type",
"message": "\"test_backup.txt\" mime type must be one of: application/zip."
}
}
}
}
{
"code": 401,
"message": "The request requires admin authorization token to be set.",
"data": {}
}
{
"code": 403,
"message": "You are not allowed to perform this request.",
"data": {}
}
Deletes a single backup by its name.
This action will return an error if the backup to delete is still being generated or part of a restore operation.
Only admins can perform this action.
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://127.0.0.1:8090');
...
await pb.admins.authWithPassword('test@example.com', '1234567890');
await pb.backups.delete('pb_data_backup.zip');
import 'package:pocketbase/pocketbase.dart';
final pb = PocketBase('http://127.0.0.1:8090');
...
await pb.admins.authWithPassword('test@example.com', '1234567890');
await pb.backups.delete('pb_data_backup.zip');
key
Authorization: TOKEN
Param | Type | Description |
---|---|---|
key | String | The key of the backup file to delete. |
null
{
"code": 400,
"message": "Try again later - another backup/restore process has already been started.",
"data": {}
}
{
"code": 401,
"message": "The request requires admin authorization token to be set.",
"data": {}
}
{
"code": 403,
"message": "You are not allowed to perform this request.",
"data": {}
}
Restore a single backup by its name and restarts the current running PocketBase process.
This action will return an error if there is another backup/restore operation already in progress.
Only admins can perform this action.
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://127.0.0.1:8090');
...
await pb.admins.authWithPassword('test@example.com', '1234567890');
await pb.backups.restore('pb_data_backup.zip');
import 'package:pocketbase/pocketbase.dart';
final pb = PocketBase('http://127.0.0.1:8090');
...
await pb.admins.authWithPassword('test@example.com', '1234567890');
await pb.backups.restore('pb_data_backup.zip');
key
/restoreAuthorization: TOKEN
Param | Type | Description |
---|---|---|
key | String | The key of the backup file to restore. |
null
{
"code": 400,
"message": "Try again later - another backup/restore process has already been started.",
"data": {}
}
{
"code": 401,
"message": "The request requires admin authorization token to be set.",
"data": {}
}
{
"code": 403,
"message": "You are not allowed to perform this request.",
"data": {}
}
Downloads a single backup file.
Only admins can perform this action.
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://127.0.0.1:8090');
...
await pb.admins.authWithPassword('test@example.com', '1234567890');
const token = await pb.files.getToken();
const url = pb.backups.getDownloadUrl(token, 'pb_data_backup.zip');
import 'package:pocketbase/pocketbase.dart';
final pb = PocketBase('http://127.0.0.1:8090');
...
await pb.admins.authWithPassword('test@example.com', '1234567890');
final token = await pb.files.getToken();
final url = pb.backups.getDownloadUrl(token, 'pb_data_backup.zip');
key
Param | Type | Description |
---|---|---|
key | String | The key of the backup file to download. |
Param | Type | Description |
---|---|---|
token | String | Admin file token for granting access to the backup file. |
[file resource]
{
"code": 400,
"message": "Filesystem initialization failure.",
"data": {}
}
{
"code": 404,
"message": "The requested resource wasn't found.",
"data": {}
}