Skip to main content
Pinecone Docs

Search documentation

Type to search this documentation.

On this pageOverview

Start import

The start_import operation starts an asynchronous import of vectors from object storage into an index.

For guidance and examples, see Import data.

Python
from pinecone import Pinecone, ImportErrorMode

pc = Pinecone(api_key="YOUR_API_KEY")

# To get the unique host for an index, 
# see https://docs.pinecone.io/guides/manage-data/target-an-index
index = pc.Index(host="INDEX_HOST")
root = "s3://BUCKET_NAME/PATH/TO/DIR"

index.start_import(
    uri=root,
    error_mode=ImportErrorMode.CONTINUE, # or ImportErrorMode.ABORT
    integration_id="a12b3d4c-47d2-492c-a97a-dd98c8dbefde" # Optional for public buckets
)
JavaScript
import { Pinecone } from '@pinecone-database/pinecone';

const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });

// To get the unique host for an index, 
// see https://docs.pinecone.io/guides/manage-data/target-an-index
const index = pc.index("INDEX_NAME", "INDEX_HOST")

const storageURI = 's3://BUCKET_NAME/PATH/TO/DIR';
const errorMode = 'continue'; // or 'abort'
const integrationID = 'a12b3d4c-47d2-492c-a97a-dd98c8dbefde'; // Optional for public buckets

await index.startImport(storageURI, errorMode, integrationID); 
Java
import io.pinecone.clients.Pinecone;
import io.pinecone.clients.AsyncIndex;
import org.openapitools.db_data.client.ApiException;
import org.openapitools.db_data.client.model.ImportErrorMode;
import org.openapitools.db_data.client.model.StartImportResponse;

public class StartImport {
    public static void main(String[] args) throws ApiException {
        // Initialize a Pinecone client with your API key
        Pinecone pinecone = new Pinecone.Builder("YOUR_API_KEY").build();

        // Get async imports connection object
        AsyncIndex asyncIndex = pinecone.getAsyncIndexConnection("docs-example");

        // s3 uri
        String uri = "s3://BUCKET_NAME/PATH/TO/DIR";

        // Integration ID (optional for public buckets)
        String integrationId = "a12b3d4c-47d2-492c-a97a-dd98c8dbefde";

        // Start an import
        StartImportResponse response = asyncIndex.startImport(uri, integrationId, ImportErrorMode.OnErrorEnum.CONTINUE);
    }
}
Go
package main

import (
    "context"
    "fmt"
    "log"

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

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)
    }

    // To get the unique host for an index, 
    // see https://docs.pinecone.io/guides/manage-data/target-an-index
    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: "INDEX_HOST"})
    if err != nil {
        log.Fatalf("Failed to create IndexConnection for Host: %v", err)
	}

    uri := "s3://BUCKET_NAME/PATH/TO/DIR"
    errorMode := "continue" // or "abort"
    importRes, err := idxConnection.StartImport(ctx, uri, nil, (*pinecone.ImportErrorMode)(&errorMode))
    if err != nil {
        log.Fatalf("Failed to start import: %v", err)
    }
    fmt.Printf("Import started with ID: %s", importRes.Id)
}
C#
using Pinecone;

var pinecone = new PineconeClient("YOUR_API_KEY");

// To get the unique host for an index, 
// see https://docs.pinecone.io/guides/manage-data/target-an-index
var index = pinecone.Index(host: "INDEX_HOST");

var uri = "s3://BUCKET_NAME/PATH/TO/DIR";

var response = await index.StartBulkImportAsync(new StartImportRequest
{
    Uri = uri,
    IntegrationId = "a12b3d4c-47d2-492c-a97a-dd98c8dbefde",
    ErrorMode = new ImportErrorMode { OnError = ImportErrorModeOnError.Continue }
});
curl
# To get the unique host for an index,
# see https://docs.pinecone.io/guides/manage-data/target-an-index
PINECONE_API_KEY="YOUR_API_KEY"
INDEX_HOST="INDEX_HOST"

curl "https://$INDEX_HOST/bulk/imports" \
  -H 'Api-Key: $YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -H 'X-Pinecone-Api-Version: 2024-10' \
  -d '{
        "integrationId": "a12b3d4c-47d2-492c-a97a-dd98c8dbefde",
        "uri": "s3://BUCKET_NAME/PATH/TO/DIR",
        "errorMode": {
            "onError": "continue"
            }
        }'
curl
{
   "id": "101"
}

POST /bulk/imports

  • integrationId (body, string) — The id of the storage integration that should be used to access the data.
  • uri (body, string, required) — The URI prefix under which the data to import is available. All data within this prefix will be listed then imported into the target index. Currently only s3:// URIs are supported.
  • errorMode (body, object) — Indicates how to respond to errors during the import process.
  • 200 — Successful import operation
  • 400 — Bad request. The request body included invalid request parameters.
  • 4XX — An unexpected error response.
  • 5XX — An unexpected error response.
Suggest an edit

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

Export
Documentation menu