PocketBase logo PocketBase v0.28.1
FAQ Documentation
Introduction Going to production Web APIs reference ├ API Records ├ API Realtime ├ API Files ├ API Collections ├ API Settings ├ API Logs ├ API Crons ├ API Backups └ API Health
Extend with
Go
Extend with
JavaScript
Go Overview Go Event hooks Go Routing Go Database Go Record operations Go Collection operations Go Migrations Go Jobs scheduling Go Sending emails Go Rendering templates Go Console commands Go Realtime messaging Go Filesystem Go Logging Go Testing Go Miscellaneous Go Record proxy
JS Overview JS Event hooks JS Routing JS Database JS Record operations JS Collection operations JS Migrations JS Jobs scheduling JS Sending emails JS Rendering templates JS Console commands JS Sending HTTP requests JS Realtime messaging JS Filesystem JS Logging JS Types reference
Web APIs reference - API Backups
API Backups

Returns list with all available backup files.

Only superusers can perform this action.

import PocketBase from 'pocketbase'; const pb = new PocketBase('http://127.0.0.1:8090'); ... await pb.collection("_superusers").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.collection("_superusers").authWithPassword('test@example.com', '1234567890'); final backups = await pb.backups.getFullList();
API details
GET
/api/backups
Query parameters
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

* targets all keys from the specific depth level.

In addition, the following field modifiers are also supported:

  • :excerpt(maxLength, withEllipsis?)
    Returns a short plain text version of the field string value.
    Ex.: ?fields=*,description:excerpt(200,true)
Responses
[ { "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 } ]
{ "status": 400, "message": "Failed to load backups filesystem.", "data": {} }
{ "status": 401, "message": "The request requires valid record authorization token.", "data": {} }
{ "status": 403, "message": "Only superusers 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 superusers can perform this action.

import PocketBase from 'pocketbase'; const pb = new PocketBase('http://127.0.0.1:8090'); ... await pb.collection("_superusers").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.collection("_superusers").authWithPassword('test@example.com', '1234567890'); await pb.backups.create('new_backup.zip');
API details
POST
/api/backups
Requires Authorization:TOKEN
Body Parameters
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.
Body parameters could be sent as JSON or multipart/form-data.
Responses
null
{ "status": 400, "message": "Try again later - another backup/restore process has already been started.", "data": {} }
{ "status": 401, "message": "The request requires valid record authorization token.", "data": {} }
{ "status": 403, "message": "The authorized record is not allowed to perform this action.", "data": {} }

Uploads an existing backup zip file.

Only superusers can perform this action.

import PocketBase from 'pocketbase'; const pb = new PocketBase('http://127.0.0.1:8090'); ... await pb.collection("_superusers").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.collection("_superusers").authWithPassword('test@example.com', '1234567890'); await pb.backups.upload(http.MultipartFile.fromBytes('file', ...));
API details
POST
/api/backups/upload
Requires Authorization:TOKEN
Body Parameters
Param Type Description
Required file
File The zip archive to upload.
Uploading files is supported only via multipart/form-data.
Responses
null
{ "status": 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." } } } }
{ "status": 401, "message": "The request requires valid record authorization token.", "data": {} }
{ "status": 403, "message": "The authorized record is not allowed to perform this action.", "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 superusers can perform this action.

import PocketBase from 'pocketbase'; const pb = new PocketBase('http://127.0.0.1:8090'); ... await pb.collection("_superusers").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.collection("_superusers").authWithPassword('test@example.com', '1234567890'); await pb.backups.delete('pb_data_backup.zip');
API details
DELETE
/api/backups/key
Requires Authorization:TOKEN
Path parameters
Param Type Description
key String The key of the backup file to delete.
Responses
null
{ "status": 400, "message": "Try again later - another backup/restore process has already been started.", "data": {} }
{ "status": 401, "message": "The request requires valid record authorization token.", "data": {} }
{ "status": 403, "message": "The authorized record is not allowed to perform this action.", "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 superusers can perform this action.

import PocketBase from 'pocketbase'; const pb = new PocketBase('http://127.0.0.1:8090'); ... await pb.collection("_superusers").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.collection("_superusers").authWithPassword('test@example.com', '1234567890'); await pb.backups.restore('pb_data_backup.zip');
API details
POST
/api/backups/key/restore
Requires Authorization:TOKEN
Path parameters
Param Type Description
key String The key of the backup file to restore.
Responses
null
{ "status": 400, "message": "Try again later - another backup/restore process has already been started.", "data": {} }
{ "status": 401, "message": "The request requires valid record authorization token.", "data": {} }
{ "status": 403, "message": "The authorized record is not allowed to perform this action.", "data": {} }

Downloads a single backup file.

Only superusers can perform this action.

import PocketBase from 'pocketbase'; const pb = new PocketBase('http://127.0.0.1:8090'); ... await pb.collection("_superusers").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.collection("_superusers").authWithPassword('test@example.com', '1234567890'); final token = await pb.files.getToken(); final url = pb.backups.getDownloadUrl(token, 'pb_data_backup.zip');
API details
GET
/api/backups/key
Path parameters
Param Type Description
key String The key of the backup file to download.
Query parameters
Param Type Description
token String Superuser file token for granting access to the backup file.
Responses
[file resource]
{ "status": 400, "message": "Filesystem initialization failure.", "data": {} }
{ "status": 404, "message": "The requested resource wasn't found.", "data": {} }

Prev: API Crons Next: API Health
FAQ Discussions Documentation
JavaScript SDK Dart SDK
PocketBase
© 2023-2025 PocketBase The Gopher artwork is from marcusolsson/gophers
Crafted by Gani