Skip to main content
Pinecone Docs

Search documentation

Type to search this documentation.

On this pageOverview

Create a backup of an index

Python
from pinecone import Pinecone

pc = Pinecone(api_key="YOUR_API_KEY")

backup = pc.create_backup(
    index_name="docs-example", 
    backup_name="example-backup", 
    description="Monthly backup of production index"
)

print(backup)
JavaScript
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' })

const backup = await pc.createBackup({
  indexName: 'docs-example',
  name: 'example-backup',
  description: 'Monthly backup of production index',
});

console.log(backup);
Java
import io.pinecone.clients.Pinecone;
import org.openapitools.db_control.client.ApiException;
import org.openapitools.db_control.client.model.*;

public class CreateBackup {
    public static void main(String[] args) throws ApiException {
        Pinecone pc = new Pinecone.Builder("YOUR_API_KEY").build();

        String indexName = "docs-example";
        String backupName = "example-backup";
        String backupDescription = "Monthly backup of production index";

        BackupModel backup = pc.createBackup(indexName,backupName, backupDescription);

        System.out.println(backup);
    }
}
Go
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "log"

    "github.com/pinecone-io/go-pinecone/v4/pinecone"
)

func prettifyStruct(obj interface{}) string {
    bytes, _ := json.MarshalIndent(obj, "", "  ")
    return string(bytes)
}

func main() {
    ctx := context.Background()

    pc, err := pinecone.NewClient(pinecone.NewClientParams{
        ApiKey: "YOUR_API_KEY",
    })
    if err != nil {
        log.Fatalf("Failed to create Client: %v", err)
    }

    indexName := "docs-example"
    backupName := "example-backup"
    backupDesc := "Monthly backup of production index"

    backup, err := pc.CreateBackup(ctx, &pinecone.CreateBackupParams{
        IndexName:   indexName,
        Name:        &backupName,
        Description: &backupDesc,
    })
    if err != nil {
        log.Fatalf("Failed to create backup: %v", err)
    }

    fmt.Printf(prettifyStruct(backup))
}
C#
using Pinecone;

var pinecone = new PineconeClient("PINECONE_API_KEY");

var backup = await pinecone.Backups.BackupIndexAsync(
    "docs-example", 
    new BackupIndexRequest
    {
        Name = "example-backup",
        Description = "Monthly backup of production index"
    }
);

Console.WriteLine(backup);
curl
PINECONE_API_KEY="YOUR_API_KEY"
INDEX_NAME="docs-example"

curl -X POST "https://api.pinecone.io/indexes/$INDEX_NAME/backups" \
     -H "Api-Key: $PINECONE_API_KEY" \
     -H 'accept: application/json' \
     -H 'Content-Type: application/json' \
     -H "X-Pinecone-Api-Version: 2025-04" \
     -d '{
           "name": "example-backup", 
           "description": "Monthly backup of production index"
         }'
Python
{'backup_id': '8c85e612-ed1c-4f97-9f8c-8194e07bcf71',
 'cloud': 'aws',
 'created_at': '2025-05-15T00:52:10.809305882Z',
 'description': 'Monthly backup of production index',
 'dimension': 1024,
 'name': 'example-backup',
 'namespace_count': 3,
 'record_count': 98,
 'region': 'us-east-1',
 'size_bytes': 1069169,
 'source_index_id': 'f73b36c9-faf5-4a2c-b1d6-4013d8b1cc74',
 'source_index_name': 'docs-example',
 'status': 'Ready',
 'tags': {}}
JavaScript
{
  "backupId": "8c85e612-ed1c-4f97-9f8c-8194e07bcf71",
  "sourceIndexName": "docs-example",
  "sourceIndexId": "f73b36c9-faf5-4a2c-b1d6-4013d8b1cc74",
  "name": "example-backup",
  "description": "Monthly backup of production index",
  "status": "Ready",
  "cloud": "aws",
  "region": "us-east-1",
  dimension: 1024,
  metric: undefined,
  recordCount: 98,
  namespaceCount: 3,
  sizeBytes: 1069169,
  tags: {},
  createdAt: '2025-05-14T16:37:25.625540Z'
}
Java
class BackupModel {
    backupId: 0d75b99f-be61-4a93-905e-77201286c02e
    sourceIndexName: docs-example
    sourceIndexId: f73b36c9-faf5-4a2c-b1d6-4013d8b1cc74
    name: example-backup
    description: Monthly backup of production index
    status: Initializing
    cloud: aws
    region: us-east-1
    dimension: null
    metric: null
    recordCount: null
    namespaceCount: null
    sizeBytes: null
    tags: {}
    createdAt: 2025-05-16T19:42:23.804787550Z
    additionalProperties: null
}
Go
{
  "backup_id": "8c85e612-ed1c-4f97-9f8c-8194e07bcf71",
  "cloud": "aws",
  "created_at": "2025-05-15T00:52:10.809305882Z",
  "description": "Monthly backup of production index",
  "dimension": 1024,
  "name": "example-backup",
  "region": "us-east-1",
  "source_index_id": "f73b36c9-faf5-4a2c-b1d6-4013d8b1cc74",
  "source_index_name": "docs-example",
  "status": "Initializing",
  "tags": {}
}
C#
{
    "backup_id": "8c85e612-ed1c-4f97-9f8c-8194e07bcf71",
    "source_index_name": "docs-example",
    "source_index_id": "f73b36c9-faf5-4a2c-b1d6-4013d8b1cc74",
    "name": "example-backup",
    "description": "Monthly backup of production index",
    "status": "Ready",
    "cloud": "aws",
    "region": "us-east-1",
    "tags": {},
    "created_at": "2025-05-15T00:52:10.809305882Z"
}
curl
{
  "backup_id":"8c85e612-ed1c-4f97-9f8c-8194e07bcf71",
  "source_index_id":"f73b36c9-faf5-4a2c-b1d6-4013d8b1cc74",
  "source_index_name":"docs-example",
  "tags":{},
  "name":"example-backup",
  "description":"Monthly backup of production index",
  "status":"Ready",
  "cloud":"aws",
  "region":"us-east-1",
  "dimension":1024,
  "record_count":96,
  "namespace_count":3,
  "size_bytes":1069169,
  "created_at":"2025-05-14T16:37:25.625540Z"
  }

POST /indexes/{index_name}/backups

  • index_name (path, string, required) — Name of the index to backup
  • name (body, string) — The name of the backup.
  • description (body, string) — A description of the backup.
  • 201 — The backup has been successfully created.
  • 400 — Bad request. The request body included invalid request parameters.
  • 401 — Unauthorized. Possible causes: Invalid API key.
  • 402 — Payment required. Organization is on a paid plan and is delinquent on payment.
  • 403 — You've exceed your backup quota.
  • 422 — Unprocessable entity. The request body could not be deserialized.
  • 500 — Internal server error.
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu