Cloud Sync
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.
Upload a Sync Bundle (Import)
There's no separate "export" call that generates a bundle server-side — import is both how you create a bundle and how you write its contents. Send the data you want synced directly as JSON:
curl -X POST https://api.ainative.studio/api/v1/projects/{project_id}/sync/import \
-H "x-api-key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"project_id": "{project_id}",
"bundle_data": {"tables": [...], "vectors": [...], "memory": [...]},
"bundle_name": "weekly-backup",
"compression": true
}'
Response includes a bundle_id you use to download the bundle later.
Download a Bundle
curl -O https://api.ainative.studio/api/v1/projects/{project_id}/sync/export/{bundle_id} \
-H "x-api-key: $API_KEY"
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}
## Upload a bundle (import creates it)
r = requests.post(f"{BASE}/import", headers={**headers, "Content-Type": "application/json"}, json={
"project_id": PROJECT_ID,
"bundle_data": {"tables": [...], "vectors": [...], "memory": [...]},
"bundle_name": "weekly-backup",
"compression": 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 |