Backups and Restore¶
Backups are point-in-time snapshots of an index. Use them to protect against data loss, create copies of an index, or restore a previous state.
Create a backup¶
Pass the name of the index you want to back up:
from pinecone import Pinecone
pc = Pinecone(api_key="your-api-key")
backup = pc.backups.create(index_name="product-search")
print(backup.backup_id) # e.g. "bk-abc123"
print(backup.status) # e.g. "Initializing"
Add a name and description for easier identification:
backup = pc.backups.create(
index_name="product-search",
name="pre-reindex-snapshot",
description="Backup before schema migration on 2025-03-01",
)
The backup transitions through Initializing → Ready when complete.
List backups¶
List all backups in the project:
for backup in pc.backups.list():
print(backup.backup_id, backup.name, backup.status)
Filter by index:
for backup in pc.backups.list(index_name="product-search"):
print(backup.backup_id, backup.created_at)
list returns a BackupList with cursor-based
pagination. Pass limit to control page size and pagination_token to advance pages:
page = pc.backups.list(limit=5)
if page.pagination and page.pagination.next:
next_page = pc.backups.list(limit=5, pagination_token=page.pagination.next)
Describe a backup¶
backup = pc.backups.describe(backup_id="bk-abc123")
print(backup.source_index_name)
print(backup.status)
print(backup.dimension)
print(backup.metric)
print(backup.record_count)
print(backup.size_bytes)
Restore a backup to a new index¶
Use create_index_from_backup on the top-level client to restore a backup into a new
index:
from pinecone import Pinecone
pc = Pinecone(api_key="your-api-key")
index = pc.create_index_from_backup(
name="product-search-restored",
backup_id="bk-abc123",
)
print(index.name)
print(index.status.state)
create_index_from_backup polls until the new index is ready. Pass timeout=-1 to
return immediately:
index = pc.create_index_from_backup(
name="product-search-restored",
backup_id="bk-abc123",
timeout=-1,
)
Enable deletion protection or add tags to the restored index:
index = pc.create_index_from_backup(
name="product-search-restored",
backup_id="bk-abc123",
deletion_protection="enabled",
tags={"env": "production", "team": "search"},
)
Monitor restore jobs¶
Each call to create_index_from_backup starts a restore job. List all restore jobs:
for job in pc.restore_jobs.list():
print(job.restore_job_id, job.status, job.percent_complete)
Describe a specific job:
job = pc.restore_jobs.describe(job_id="rj-xyz789")
print(job.restore_job_id)
print(job.backup_id)
print(job.target_index_name)
print(job.status) # e.g. "Running", "Completed"
print(job.percent_complete)
print(job.completed_at)
describe returns a RestoreJobModel.
Delete a backup¶
pc.backups.delete(backup_id="bk-abc123")
Deleting a backup does not affect the source index or any indexes restored from it.
See also¶
BackupModel— backup response modelBackupList— backup list responseRestoreJobModel— restore job modelRestoreJobList— restore job list responseWorking with Serverless Indexes — serverless index management
Working with Pod-Based Indexes — pod-based index management