What is AgentSecrets?
The Zero-Knowledge Difference
How AgentSecrets Works
Installation
Quick Start
Migrating from .env Files
Migrating from Vault / AWS
Migrating from dotenv-vault
Production Checklist
Credential Exposure
What Zero-Knowledge Means
The Proxy Model
The Three-Layer Model
Environments
Agent Identity
Storage Modes
The No get() Principle
Secret-Level Policies
Credential Proxy Overview
Secrets Management
Environments
env Injection
Workspaces & Teams
Projects
Agent Identity
Audit & Governance
account (init / login / logout)
server (get / set / status / reset)
secrets (set / list / delete / push / pull)
proxy (start / stop / status / logs)
call (inject requests via proxy)
env (execute commands with secrets)
workspace (list / create / switch / roles)
project (list / create / use / update)
environment (list / switch / copy / merge)
agent (register / list / tokens)
agent policy (set / get / delete)
logs (list / watch / export / verify)
mcp (serve / install / config)
status (system & session diagnostics)
Aliases & Shortcuts
docs (interactive terminal viewer)
Shell Autocompletion
keychain-auth (daemon & security)
Ecosystem Overview
Zero-Knowledge MCP Server
Integrations Overview
Claude Desktop
Cursor IDE
OpenClaw
HTTP Proxy (Any Client)
LangChain (Native)
CrewAI (Native)
CI/CD Pipeline
SDK Overview
Python SDK
Python API Reference
Python SDK Manual Testing
JavaScript SDK (Soon)
ZK-MCP Integration Guide
Server Overview
5-Layer Architecture
Self-Hosting Guide
Self-Hosting Operations Manual
Server Data Migration
Authentication & Keys
Workspaces & Teams Backend
Projects & Scope Backend
Environments Backend
Secrets & Sync Protocol
Agent Identity Resolution
Telemetry & Metrics Engine
Audit Log Sync
API Endpoint Reference
Cloud Overview & Architecture
The Dual-Engine Model
Cloud Resolver Data Plane
Workload & Agent Tokens
Egress Allowlists & Audit Streams
Cloud REST API Reference
Security Overview
Anti-Impersonation & Process Verification
Encryption Model
Zero-Knowledge Sync
Proxy Security Layers
Threat Model
OWASP Top 10 Mitigation
Security FAQ
Third-Party Audit
Reporting Vulnerabilities
Guides Overview
Building on the SDK
Stripe Integration
OpenAI Integration
Multi-Agent Setup
Onboarding Team
CI/CD Pipeline
Publishing ZK MCP
Rotating Credentials
Auditing Team Activity
Dev to Production
Kubernetes Deployment
Monorepo Setup
Production Proxy Hardening
vs .env Files
vs HashiCorp Vault
vs AWS Secrets Manager
vs dotenv-vault
vs Infisical
When Not to Use
Proxy Not Starting
Proxy Not Resolving
Domain Blocked
Sync Conflicts
MCP Not Connecting
Session Token Errors
Proxy Session Authorization
Keychain Storage & Backends
SSRF & Destination Rules
Installation Issues
Error Codes Reference
Frequently Asked Questions
v3.x
v2.1.0
v2.0.0
v1.4.0
v1.3.x
v1.2.0
v1.1.x
v1.0.x
Server & Self-HostingServer Data Migration

Bidirectional Server Data Migration

Direct server-to-server migration of workspaces, projects, environments, and secrets between the default AgentSecrets Server and Self-Hosted AgentSecrets Server instances.


Overview

AgentSecrets provides a direct, zero-touch server-to-server data migration protocol across all deployment models:

  • Default Server to Self-Hosted: Migrate workspaces, projects, and secrets from the default AgentSecrets Server (https://api.agentsecrets.tech/api) to a private on-premises or VPC instance.
  • Self-Hosted to Default Server: Consolidate private instances into the managed platform.
  • Self-Hosted to Self-Hosted: Migrate data between staging, production, or multi-region self-hosted clusters.

The Direct Server-to-Server Protocol

Migration is handled directly between the two server instances using an ephemeral cryptographic handshake:

┌───────────────────────────────┐ ┌───────────────────────────────┐ │ Source Server Instance │ │ Destination Server Instance │ │ (Default or Self-Hosted) │ │ (Default or Self-Hosted) │ └───────────────┬───────────────┘ └───────────────┬───────────────┘ │ │ 1. User calls │ │ /token/ │ │ ◄──────────────┤ │ (gets token) │ │ │ 2. User calls │ │ /import/ │ │ (source_url │ │ + token) │ │ ├───────────────► │ │ │ │ 3. POST /api/migration/export/│ │ │ (Bearer <MIGRATION_TOKEN>) │ │ │ ◄─────────────────────────────┤ │ │ │ │ │ 4. Streams unwrapped bundle │ │ │ (client ciphertexts intact)│ │ │ ─────────────────────────────►│ │ │ │ 5. Re-wraps │ │ │ with local │ │ │ Fernet key │ │ │ and saves │

The Zero-Knowledge Guarantee During Migration

At no point during transport or import are secret values decrypted:

  1. Client-Side Envelope Preservation: Secrets remain encrypted under their original workspace AES-256-GCM / NaCl SealedBox keys.
  2. Server-Side Fernet Layer Swap: The source server strips its outer database encryption layer, and the destination server immediately re-encrypts the ciphertext using its own ENCRYPTION_KEY.
  3. No Private Keys on Servers: Neither server ever holds or receives user private keys.
  4. Transparent Client Handshake: When users switch their CLI to the destination server, their local OS keychain decrypts their workspace keys seamlessly.

Step-by-Step Migration Walkthrough

1Generate a Migration Token on the Source Server

Log in to the source server and generate an ephemeral 30-minute migration token:

# Point CLI to source server agentsecrets server set https://api.agentsecrets.tech # Log in to source account agentsecrets login # Generate 30-minute migration token agentsecrets migrate token

Sample Output:

Migration token generated (valid for 30 minutes): eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

2Tender the Token to the Destination Server

Switch your CLI to the destination server and tender the token along with the source server URL:

# Point CLI to destination server agentsecrets server set https://api.agentsecrets.yourcompany.com # Log in to destination account agentsecrets login # Initiate direct server-to-server migration agentsecrets migrate --from https://api.agentsecrets.tech --token <MIGRATION_TOKEN>

The destination server connects directly to the source server over TLS, verifies the single-use token, pulls the workspace bundle, re-encrypts the records with its local ENCRYPTION_KEY, and creates all workspaces, projects, environments, and secrets in PostgreSQL.


Airgapped / Offline Fallback (Inline Bundle)

If the source and destination servers cannot communicate directly over the network (e.g. firewalled private VPC or airgapped network), you can export and import an encrypted JSON bundle via the CLI:

# Export bundle from source agentsecrets server set https://api.agentsecrets.tech agentsecrets migrate export --output bundle.json # Import bundle to destination agentsecrets server set https://api.agentsecrets.yourcompany.com agentsecrets migrate import bundle.json
Was this helpful?
Thanks for your feedback!
Your feedback helps us improve the platform.