Cloud Sync
Cloud Sync lets you move ZeroDB data between local instances and the cloud, or between projects. Use it for backups, migrations, and offline-first workflows.
Export a Sync Bundle
Export your project's data as a portable bundle:
curl -X POST https://api.ainative.studio/api/v1/projects/{project_id}/sync/export \
-H "x-api-key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"include": ["tables", "vectors", "memory", "events"],
"compress": true
}'
Response includes a bundle_id you use to download the bundle.
Download a Bundle
curl -O https://api.ainative.studio/api/v1/projects/{project_id}/sync/export/{bundle_id} \
-H "x-api-key: $API_KEY"
Import a Sync Bundle
curl -X POST https://api.ainative.studio/api/v1/projects/{project_id}/sync/import \
-H "x-api-key: $API_KEY" \
-F "bundle=@./zerodb-backup.zip"
Check Sync State
curl https://api.ainative.studio/api/v1/projects/{project_id}/sync/state \
-H "x-api-key: $API_KEY"
List Available Bundles
curl https://api.ainative.studio/api/v1/projects/{project_id}/sync/bundles \
-H "x-api-key: $API_KEY"
Python SDK
import requests
API_KEY = "your-api-key"
PROJECT_ID = "your-project-id"
BASE = f"https://api.ainative.studio/api/v1/projects/{PROJECT_ID}/sync"
headers = {"x-api-key": API_KEY}
# Export
r = requests.post(f"{BASE}/export", headers={**headers, "Content-Type": "application/json"}, json={
"include": ["tables", "vectors", "memory"],
"compress": True
})
bundle_id = r.json()["bundle_id"]
print(f"Bundle ready: {bundle_id}")
# Download
bundle = requests.get(f"{BASE}/export/{bundle_id}", headers=headers)
with open("backup.zip", "wb") as f:
f.write(bundle.content)
# Check sync state
state = requests.get(f"{BASE}/state", headers=headers).json()
print(f"Last synced: {state['last_synced_at']}")
Use Cases
- Local development: Export prod data, import into local ZeroDB for testing
- Backups: Schedule regular exports to keep recoverable snapshots
- Migration: Move data between projects or regions
- Offline-first: Sync when connectivity is restored after offline agent runs
Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /sync/import | Upload and import a sync bundle |
| GET | /sync/export/{bundle_id} | Download a sync bundle |
| GET | /sync/state | Get current sync status |
| GET | /sync/bundles | List available bundles |