Skip to content

Backup & Restore API

DRAFT — Internal Developer Use Only

This API reference is for internal development teams.

Overview

What it is: The Backup & Restore API provides endpoints for creating, downloading, and restoring encrypted backups of both the registry (configuration data) and the datastore (entity/identity data). Backups are encrypted ZIP files identified by KSUID.

Sources: src/registry/rest/rest.go, src/datastore/rest/rest.go

Authentication

All endpoints require JWT cookie or API token authentication. User claims (tenant, identity, email) are embedded in backup metadata.

Endpoints

Registry Backup

MethodPathDescription
POST/internal/v1/registry/backupCreate a registry configuration backup
POST/internal/v1/registry/restoreRestore registry from backup file
GET/internal/v1/registry/backup/:node/:backupDownload a registry backup file

Datastore Backup

MethodPathDescription
POST/internal/v1/datastore/backupCreate a datastore entity backup
POST/internal/v1/datastore/restoreRestore datastore from backup file
GET/internal/v1/datastore/backup/:node/:backupDownload a datastore backup file

POST /internal/v1/registry/backup

Create an encrypted backup of all registry configuration data.

Request:

http
POST /internal/v1/registry/backup
Content-Type: application/json
Authorization: Bearer <token>
json
{
  "secret": "strong-encryption-passphrase"
}

Request fields:

FieldTypeRequiredDescription
secretstringYesEncryption passphrase for the backup ZIP. Must meet password complexity requirements.

Response (200):

json
{
  "id": "2GxBsGZA8gGzJDqTnVfYstMeaXd",
  "node": "node-uuid",
  "date": 1707700800000
}

Response fields:

FieldTypeDescription
idstringBackup identifier (KSUID format)
nodestringNode ID where the backup was created
dateint64Backup creation timestamp (ms)

Backup metadata (embedded in ZIP): tenant ID, user identity, user ID, email, and name from the authenticated session.


POST /internal/v1/registry/restore

Restore registry configuration from an encrypted backup file. Uploaded as a multipart form.

Request:

http
POST /internal/v1/registry/restore
Content-Type: multipart/form-data
Authorization: Bearer <token>

Form fields:

FieldTypeDescription
filefileThe backup ZIP file
secretstringDecryption passphrase (must match the one used during backup)

Response (200):

json
{
  "records": 245,
  "failed": 0,
  "error": ""
}

Response fields:

FieldTypeDescription
recordsint64Number of configuration records restored
failedint64Number of records that failed to restore
errorstringError message (empty on success)

GET /internal/v1/registry/backup/:node/:backup

Download a previously created registry backup file.

Request:

http
GET /internal/v1/registry/backup/:node/:backup
Authorization: Bearer <token>

Path parameters:

ParameterDescription
nodeNode ID where the backup was created
backupBackup ID (KSUID)

Response (200): Binary ZIP file.

Response headers:

HeaderValue
Content-Dispositionattachment; filename=hydden-tenant-{id}-{timestamp}.zip
Content-Typeapplication/octet-stream

POST /internal/v1/datastore/backup

Create an encrypted backup of all datastore entity data.

Request:

http
POST /internal/v1/datastore/backup
Content-Type: application/json
Authorization: Bearer <token>
json
{
  "secret": "strong-encryption-passphrase"
}

Response (200):

json
{
  "id": "2GxBsGZA8gGzJDqTnVfYstMeaXd",
  "node": "node-uuid",
  "date": 1707700800000
}

Same structure as registry backup response.


POST /internal/v1/datastore/restore

Restore datastore entity data from an encrypted backup file.

Request:

http
POST /internal/v1/datastore/restore
Content-Type: multipart/form-data
Authorization: Bearer <token>

Form fields: Same as registry restore (file + secret).

Response (200):

json
{
  "stores": 12,
  "records": 45230,
  "failed": 0,
  "error": ""
}

Response fields:

FieldTypeDescription
storesint64Number of data stores restored
recordsint64Number of entity records restored
failedint64Number of records that failed to restore
errorstringError message (empty on success)

GET /internal/v1/datastore/backup/:node/:backup

Download a previously created datastore backup file.

Request:

http
GET /internal/v1/datastore/backup/:node/:backup
Authorization: Bearer <token>

Path parameters: Same as registry backup download.

Response (200): Binary ZIP file.

Response headers:

HeaderValue
Content-Dispositionattachment; filename=hydden-registry-{timestamp}.zip
Content-Typeapplication/octet-stream

Error Responses

StatusDescription
400Invalid request body, weak encryption secret, or corrupt backup file
403Authentication failed or insufficient permissions
404Backup not found (invalid node or backup ID)
500Internal server error during backup/restore operation

Hydden Documentation and Training Hub