Pinecone TypeScript SDK - v8.2.0
    Preparing search index...

    Class Pinecone

    The Pinecone class is the main entrypoint to this sdk. You will use instances of it to create and manage indexes as well as perform data operations on those indexes after they are created.

    There is one piece of configuration required to use the Pinecone client: an API key. This value can be passed using environment variables or in code through a configuration object. Find your API key in the console dashboard at https://app.pinecone.io

    The environment variables used to configure the client are the following:

    export PINECONE_API_KEY="your_api_key"
    export PINECONE_CONTROLLER_HOST="your_controller_host"

    When these environment variables are set, the client constructor does not require any additional arguments.

    import { Pinecone } from '@pinecone-database/pinecone';

    const pc = new Pinecone();

    If you prefer to pass configuration in code, the constructor accepts a config object containing the apiKey and environment values. This could be useful if your application needs to interact with multiple projects, each with a different configuration.

    import { Pinecone } from '@pinecone-database/pinecone';

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

    See PineconeConfiguration for a full description of available configuration options.

    Index
    inference: Inference
    preview: Preview

    Provides access to alpha preview operations using the 2026-01.alpha API.

    const list = await pc.preview.indexes.list();
    const idx = pc.preview.index('my-schema-index');
    • Targets a specific assistant for performing operations.

      Once an assistant is targeted, you can perform operations such as uploading files, updating instructions, and chatting.

      import { Pinecone } from '@pinecone-database/pinecone';

      const pc = new Pinecone();
      const assistant = pc.assistant({ name: 'my-assistant' });

      // Upload a file to the assistant
      await assistant.uploadFile({
      path: 'test-file.txt',
      metadata: { description: 'Sample test file' }
      });
      import { Pinecone } from '@pinecone-database/pinecone';

      const pc = new Pinecone();
      // Legacy syntax - will be removed in next major version
      const assistant = pc.assistant('my-assistant');
      const chatResp = await assistant.chat({
      messages: [{ role: 'user', content: 'What is the capital of France?' }],
      });
      console.log(chatResp);
      // {
      // id: '000000000000000023e7fb015be9d0ad',
      // finishReason: 'stop',
      // message: {
      // role: 'assistant',
      // content: 'The capital of France is Paris.'
      // },
      // model: 'gpt-4o-2024-05-13',
      // citations: [ { position: 209, references: [Array] } ],
      // usage: { promptTokens: 493, completionTokens: 38, totalTokens: 531 }
      // }

      Parameters

      Returns Assistant

      An Assistant object that can be used to perform assistant-related operations.

    • Parameters

      • name: string
      • Optionalhost: string

      Returns Assistant

      Use the options object pattern instead: pc.assistant({ name: 'assistant-name' }). This signature will be removed in the next major version.

    • Targets a specific assistant for performing operations.

      Once an assistant is targeted, you can perform operations such as uploading files, updating instructions, and chatting.

      import { Pinecone } from '@pinecone-database/pinecone';

      const pc = new Pinecone();
      const assistant = pc.assistant({ name: 'my-assistant' });

      // Upload a file to the assistant
      await assistant.uploadFile({
      path: 'test-file.txt',
      metadata: { description: 'Sample test file' }
      });
      import { Pinecone } from '@pinecone-database/pinecone';

      const pc = new Pinecone();
      // Legacy syntax - will be removed in next major version
      const assistant = pc.assistant('my-assistant');
      const chatResp = await assistant.chat({
      messages: [{ role: 'user', content: 'What is the capital of France?' }],
      });
      console.log(chatResp);
      // {
      // id: '000000000000000023e7fb015be9d0ad',
      // finishReason: 'stop',
      // message: {
      // role: 'assistant',
      // content: 'The capital of France is Paris.'
      // },
      // model: 'gpt-4o-2024-05-13',
      // citations: [ { position: 209, references: [Array] } ],
      // usage: { promptTokens: 493, completionTokens: 38, totalTokens: 531 }
      // }

      Parameters

      Returns Assistant

      An Assistant object that can be used to perform assistant-related operations.

    • Parameters

      • name: string
      • Optionalhost: string

      Returns Assistant

      Use the options object pattern instead: pc.Assistant({ name: 'assistant-name' }). This signature will be removed in the next major version.

    • Configure an index

      Use this method to update configuration on an existing index. For both pod-based and serverless indexes you can update the deletionProtection status of an index and/or change any index tags. For pod-based indexes you can also configure the number of replicas and pod type. For serverless and BYOC indexes you can configure the read capacity, and for indexes with integrated inference you can update the embedding configuration.

      Parameters

      Returns Promise<IndexModel>

      A promise that resolves to IndexModel when the request to configure the index is completed.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();

      await pc.configureIndex({
      name: 'my-index',
      deletionProtection: 'enabled',
      podReplicas: 2,
      podType: 'p1.x2'
      });

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

    • Creates a new Assistant.

      Parameters

      • options: CreateAssistantOptions

        A CreateAssistantOptions object containing the name of the Assistant to be created. Optionally, users can also specify instructions, metadata, and host region. Region must be one of "us" or "eu" and determines where the Assistant will be hosted.

      Returns Promise<AssistantModel>

      A Promise that resolves to an Assistant model.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();
      await pc.createAssistant({name: 'test1'});
      // {
      // name: 'test11',
      // instructions: undefined,
      // metadata: undefined,
      // status: 'Initializing',
      // host: 'https://prod-1-data.ke.pinecone.io',
      // createdAt: 2025-01-08T22:52:49.652Z,
      // updatedAt: 2025-01-08T22:52:49.652Z
      // }

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

    • Creates a backup of an index.

      Parameters

      Returns Promise<BackupModel>

      A Promise that resolves to a BackupModel object.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();
      const backup = await pc.createBackup({ indexName: 'my-index', name: 'my-index-backup-1', description: 'weekly backup' });
      console.log(backup);
      // {
      // backupId: '11450b9f-96e5-47e5-9186-03f346b1f385',
      // sourceIndexName: 'my-index',
      // sourceIndexId: 'b480770b-600d-4c4e-bf19-799c933ae2bf',
      // name: 'my-index-backup-1',
      // description: 'weekly backup',
      // status: 'Initializing',
      // cloud: 'aws',
      // region: 'us-east-1',
      // dimension: 1024,
      // metric: 'cosine',
      // recordCount: 500,
      // namespaceCount: 4,
      // sizeBytes: 78294,
      // tags: {},
      // createdAt: '2025-05-07T03:11:11.722238160Z'
      // }

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

    • Create a new collection from an existing index.

      Note: collections are only supported for pod-based indexes; serverless indexes do not support collections.

      Parameters

      • options: CreateCollectionRequest

        The collection configuration.

        The configuration needed to create a Pinecone collection.

        • name: string

          The name of the collection to be created. Resource name must be 1-45 characters long, start and end with an alphanumeric character, and consist only of lower case alphanumeric characters or '-'.

          CreateCollectionRequest

        • source: string

          The name of the index to be used as the source for the collection.

          CreateCollectionRequest

      Returns Promise<CollectionModel>

      a promise that resolves to CollectionModel when the request to create the collection is completed.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();

      const indexList = await pc.listIndexes()
      const indexName = indexList.indexes[0].name;
      await pc.createCollection({
      name: 'my-collection',
      source: indexName
      })

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

    • Creates a new index.

      Parameters

      Returns Promise<void | IndexModel>

      A promise that resolves to IndexModel when the request to create the index is completed. Note that the index is not immediately ready to use. You can use the describeIndex function to check the status of the index.

      The minimum required configuration to create an index is the index name, dimension, and spec.

      import { Pinecone } from '@pinecone-database/pinecone';

      const pc = new Pinecone();

      await pc.createIndex({ name: 'my-index', dimension: 128, spec: { serverless: { cloud: 'aws', region: 'us-west-2' }}})

      The spec object defines how the index should be deployed. For serverless indexes, you define only the cloud and region where the index should be hosted. For pod-based indexes, you define the environment where the index should be hosted, the pod type and size to use, and other index characteristics. In a different example, you can create a pod-based index by specifying the pod spec object with the environment, pods, podType, and metric properties. For more information on creating indexes, see Understanding indexes.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();

      await pc.createIndex({
      name: 'my-index',
      dimension: 1536,
      metric: 'cosine',
      spec: {
      pod: {
      environment: 'us-west-2-gcp',
      pods: 1,
      podType: 'p1.x1'
      }
      },
      tags: { 'team': 'data-science' }
      })

      If you would like to create the index only if it does not already exist, you can use the suppressConflicts boolean option.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();

      await pc.createIndex({
      name: 'my-index',
      dimension: 1536,
      spec: {
      serverless: {
      cloud: 'aws',
      region: 'us-west-2'
      }
      },
      suppressConflicts: true,
      tags: { 'team': 'data-science' }
      })

      If you plan to begin upserting immediately after index creation is complete, you should use the waitUntilReady option. Otherwise, the index may not be ready to receive data operations when you attempt to upsert.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();

      const indexModel = await pc.createIndex({
      name: 'my-index',
      spec: {
      serverless: {
      cloud: 'aws',
      region: 'us-west-2'
      }
      },
      waitUntilReady: true,
      tags: { 'team': 'data-science' }
      });

      const records = [
      // PineconeRecord objects with your embedding values
      ]
      const index = pc.index({ host: indexModel.host });
      await index.upsert({ records })

      By default all metadata fields are indexed when records are upserted with metadata, but if you want to improve performance you can specify the specific fields you want to index. This example is showing a few hypothetical metadata fields, but the values you'd use depend on what metadata you plan to store with records in your Pinecone index.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();

      await pc.createIndex({
      name: 'my-index',
      dimension: 1536,
      spec: {
      serverless: {
      cloud: 'aws',
      region: 'us-west-2',
      metadataConfig: { 'indexed' : ['productName', 'productDescription'] }
      }
      },
      tags: { 'team': 'data-science' }
      })

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeBadRequestError when index creation fails due to invalid parameters being specified or other problem such as project quotas limiting the creation of any additional indexes.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

      Errors.PineconeConflictError when attempting to create an index using a name that already exists in your project.

    • Deletes an Assistant by name.

      Parameters

      • assistantName: string

        The name of the Assistant to be deleted.

      Returns Promise<void>

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();
      await pc.deleteAssistant('test1');

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

    • Deletes a backup.

      Parameters

      • backupName: string

      Returns Promise<void>

      A Promise that resolves when the request to delete the backup is completed.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();
      await pc.deleteBackup('11450b9f-96e5-47e5-9186-03f346b1f385');

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

    • Delete a collection by collection name

      Parameters

      • collectionName: string

        The name of the collection to delete.

      Returns Promise<void>

      A promise that resolves when the request to delete the collection is completed.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();

      const collectionList = await pc.listCollections()
      const collectionName = collectionList.collections[0].name;
      await pc.deleteCollection(collectionName)

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

    • Deletes an index

      Parameters

      • indexName: string

        The name of the index to delete.

      Returns Promise<void>

      A promise that resolves when the request to delete the index is completed.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();

      await pc.deleteIndex('my-index')

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

    • Retrieves information about an Assistant by name, including its current status (e.g. whether it is still initializing or ready to use).

      Parameters

      • assistantName: string

        The name of the Assistant to retrieve.

      Returns Promise<AssistantModel>

      A Promise that resolves to an Assistant model.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();
      const test = await pc.describeAssistant('test1');
      console.log(test);
      // {
      // name: 'test1',
      // instructions: undefined,
      // metadata: undefined,
      // status: 'Ready',
      // host: 'https://prod-1-data.ke.pinecone.io',
      // createdAt: 2025-01-08T22:24:50.525Z,
      // updatedAt: 2025-01-08T22:24:52.303Z
      // }

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

    • Describes a backup.

      Parameters

      • backupName: string

      Returns Promise<BackupModel>

      A Promise that resolves to a BackupModel object.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();
      const backup = await pc.describeBackup('11450b9f-96e5-47e5-9186-03f346b1f385');
      console.log(backup);
      // {
      // backupId: '11450b9f-96e5-47e5-9186-03f346b1f385',
      // sourceIndexName: 'my-index',
      // sourceIndexId: 'b480770b-600d-4c4e-bf19-799c933ae2bf',
      // name: 'my-index-backup-1',
      // description: 'weekly backup',
      // status: 'Initializing',
      // cloud: 'aws',
      // region: 'us-east-1',
      // dimension: 1024,
      // metric: 'cosine',
      // recordCount: 500,
      // namespaceCount: 4,
      // sizeBytes: 78294,
      // tags: {},
      // createdAt: '2025-05-07T03:11:11.722238160Z'
      // }

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

    • Describe a collection

      Parameters

      • collectionName: string

        The name of the collection to describe.

      Returns Promise<CollectionModel>

      A promise that resolves to a CollectionModel.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();

      await pc.describeCollection('my-collection')

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

    • Describe a Pinecone index

      Parameters

      • indexName: string

        The name of the index to describe.

      Returns Promise<IndexModel>

      A promise that resolves to IndexModel.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();

      const indexModel = await pc.describeIndex('my-index')
      console.log(indexModel)
      // {
      // name: 'sample-index-1',
      // dimension: 3,
      // metric: 'cosine',
      // host: 'sample-index-1-1390950.svc.apw5-4e34-81fa.pinecone.io',
      // spec: {
      // pod: undefined,
      // serverless: {
      // cloud: 'aws',
      // region: 'us-west-2'
      // }
      // },
      // status: {
      // ready: true,
      // state: 'Ready'
      // }
      // }

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

    • Describes a restore job.

      Parameters

      • restoreJobId: string

      Returns Promise<RestoreJobModel>

      A Promise that resolves to a RestoreJobModel object.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();
      const restoreJob = await pc.describeRestoreJob('4d4c8693-10fd-4204-a57b-1e3e626fca07');
      console.log(restoreJob);
      // {
      // restoreJobId: '4d4c8693-10fd-4204-a57b-1e3e626fca07',
      // backupId: '11450b9f-96e5-47e5-9186-03f346b1f385',
      // targetIndexName: 'my-index-restore-1',
      // targetIndexId: 'deb7688b-9f21-4c16-8eb7-f0027abd27fe',
      // status: 'Completed',
      // createdAt: 2025-05-07T03:38:37.107Z,
      // completedAt: 2025-05-07T03:40:23.687Z,
      // percentComplete: 100
      // }

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

    • Evaluates the alignment of a generated answer against a ground truth answer. Returns metrics for correctness (precision), completeness (recall), and alignment (harmonic mean).

      Parameters

      • options: { answer: string; groundTruth: string; question: string }

        An EvaluateOptions object containing the question, answer, and groundTruth.

      Returns Promise<AlignmentResponse>

      A Promise that resolves to an AlignmentResponse object containing metrics and reasoning.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();
      const result = await pc.evaluate({
      question: "What is the capital of France?",
      answer: "The capital of France is Paris.",
      groundTruth: "Paris is the capital and most populous city of France."
      });
      console.log(result);
      // {
      // metrics: {
      // correctness: 0.95,
      // completeness: 0.90,
      // alignment: 0.92
      // },
      // reasoning: { evaluatedFacts: [...] },
      // usage: { promptTokens: 100, completionTokens: 50, totalTokens: 150 }
      // }

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

    • Targets a specific index for performing data operations.

      You can target an index by providing its name, its host, or both. If only name is provided, the SDK will call describeIndex to resolve the host. If host is provided, the SDK will perform data operations directly against that host.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone()

      // Get the host from describeIndex
      const indexModel = await pc.describeIndex('index-name');
      const index = pc.index({ host: indexModel.host })
      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone()

      const index = pc.index({ name: 'index-name' })
      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone()

      // Legacy syntax - will be removed in next major version
      const index = pc.index('index-name')
      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone()

      const index = pc.index({ host: 'index-name-abc123.svc.pinecone.io' })

      If you are storing metadata alongside your vector values inside your Pinecone records, you can pass a type parameter to index() in order to get proper TypeScript typechecking when upserting and querying data.

      import { Pinecone } from '@pinecone-database/pinecone';

      const pc = new Pinecone();

      type MovieMetadata = {
      title: string,
      runtime: numbers,
      genre: 'comedy' | 'horror' | 'drama' | 'action'
      }

      // Specify a custom metadata type while targeting the index
      const indexModel = await pc.describeIndex('test-index');
      const index = pc.index<MovieMetadata>({ host: indexModel.host });

      // Now you get type errors if upserting malformed metadata
      await index.upsert({
      records: [{
      id: '1234',
      values: [
      .... // embedding values
      ],
      metadata: {
      title: 'Gone with the Wind',
      runtime: 238,
      genre: 'drama',

      // @ts-expect-error because category property not in MovieMetadata
      category: 'classic'
      }
      }]
      })

      const results = await index.query({
      vector: [
      ... // query embedding
      ],
      filter: { genre: { '$eq': 'drama' }}
      })
      const movie = results.matches[0];

      if (movie.metadata) {
      // Since we passed the MovieMetadata type parameter above,
      // we can interact with metadata fields without having to
      // do any typecasting.
      const { title, runtime, genre } = movie.metadata;
      console.log(`The best match in drama was ${title}`)
      }

      Type Parameters

      Parameters

      Returns Index<T>

      An Index object that can be used to perform data operations.

    • Type Parameters

      Parameters

      • indexName: string
      • OptionalindexHostUrl: string
      • OptionaladditionalHeaders: HTTPHeaders

      Returns Index<T>

      Use the options object pattern instead: pc.index({ name: 'index-name' }). This signature will be removed in the next major version.

    • Targets a specific index for performing data operations.

      You can target an index by providing its name, its host, or both. If only name is provided, the SDK will call describeIndex to resolve the host. If host is provided, the SDK will perform data operations directly against that host.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone()

      // Get the host from describeIndex
      const indexModel = await pc.describeIndex('index-name');
      const index = pc.index({ host: indexModel.host })
      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone()

      const index = pc.index({ name: 'index-name' })
      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone()

      // Legacy syntax - will be removed in next major version
      const index = pc.index('index-name')
      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone()

      const index = pc.index({ host: 'index-name-abc123.svc.pinecone.io' })

      If you are storing metadata alongside your vector values inside your Pinecone records, you can pass a type parameter to index() in order to get proper TypeScript typechecking when upserting and querying data.

      import { Pinecone } from '@pinecone-database/pinecone';

      const pc = new Pinecone();

      type MovieMetadata = {
      title: string,
      runtime: numbers,
      genre: 'comedy' | 'horror' | 'drama' | 'action'
      }

      // Specify a custom metadata type while targeting the index
      const indexModel = await pc.describeIndex('test-index');
      const index = pc.index<MovieMetadata>({ host: indexModel.host });

      // Now you get type errors if upserting malformed metadata
      await index.upsert({
      records: [{
      id: '1234',
      values: [
      .... // embedding values
      ],
      metadata: {
      title: 'Gone with the Wind',
      runtime: 238,
      genre: 'drama',

      // @ts-expect-error because category property not in MovieMetadata
      category: 'classic'
      }
      }]
      })

      const results = await index.query({
      vector: [
      ... // query embedding
      ],
      filter: { genre: { '$eq': 'drama' }}
      })
      const movie = results.matches[0];

      if (movie.metadata) {
      // Since we passed the MovieMetadata type parameter above,
      // we can interact with metadata fields without having to
      // do any typecasting.
      const { title, runtime, genre } = movie.metadata;
      console.log(`The best match in drama was ${title}`)
      }

      Type Parameters

      Parameters

      Returns Index<T>

      An Index object that can be used to perform data operations.

    • Type Parameters

      Parameters

      • indexName: string
      • OptionalindexHostUrl: string
      • OptionaladditionalHeaders: HTTPHeaders

      Returns Index<T>

      Use the options object pattern instead: pc.Index({ name: 'index-name' }). This signature will be removed in the next major version.

    • Retrieves a list of all Assistants for a given Pinecone API key.

      Returns Promise<AssistantList>

      A Promise that resolves to an object containing an array of Assistant models.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();
      const assistants = await pc.listAssistants();
      console.log(assistants);
      // {
      // assistants: [
      // {
      // name: 'test2',
      // instructions: 'test-instructions',
      // metadata: [Object],
      // status: 'Ready',
      // host: 'https://prod-1-data.ke.pinecone.io',
      // createdAt: 2025-01-06T19:14:18.633Z,
      // updatedAt: 2025-01-06T19:14:36.977Z
      // },
      // ]
      // }

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

    • Lists backups within a project or a specific index. Pass an indexName to list backups for that index, otherwise the operation will return all backups in the project.

      Parameters

      Returns Promise<BackupList>

      A Promise that resolves to a BackupList object.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();
      const backupsList = await pc.listBackups({ indexName: 'my-index', limit: 2 });
      console.log(backupsList);
      // {
      // data: [
      // {
      // backupId: '6a00902c-d118-4ad3-931c-49328c26d558',
      // sourceIndexName: 'my-index',
      // sourceIndexId: '0888b4d9-0b7b-447e-a403-ab057ceee4d4',
      // name: 'my-index-backup-2',
      // description: undefined,
      // status: 'Ready',
      // cloud: 'aws',
      // region: 'us-east-1',
      // dimension: 5,
      // metric: 'cosine',
      // recordCount: 200,
      // namespaceCount: 2,
      // sizeBytes: 67284,
      // tags: {},
      // createdAt: '2025-05-07T18:34:13.626650Z'
      // },
      // {
      // backupId: '2b362ea3-b7cf-4950-866f-0dff37ab781e',
      // sourceIndexName: 'my-index',
      // sourceIndexId: '0888b4d9-0b7b-447e-a403-ab057ceee4d4',
      // name: 'my-index-backup-1',
      // description: undefined,
      // status: 'Ready',
      // cloud: 'aws',
      // region: 'us-east-1',
      // dimension: 1024,
      // metric: 'cosine',
      // recordCount: 500,
      // namespaceCount: 4,
      // sizeBytes: 78294,
      // tags: {},
      // createdAt: '2025-05-07T18:33:59.888270Z'
      // },
      // ],
      // pagination: undefined
      // }

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

    • List all Pinecone indexes

      Returns Promise<IndexList>

      A promise that resolves to IndexList.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();

      const indexList = await pc.listIndexes()
      console.log(indexList)
      // {
      // indexes: [
      // {
      // name: "sample-index-1",
      // dimension: 3,
      // metric: "cosine",
      // host: "sample-index-1-1234567.svc.apw5-2e18-32fa.pinecone.io",
      // spec: {
      // serverless: {
      // cloud: "aws",
      // region: "us-west-2"
      // }
      // },
      // status: {
      // ready: true,
      // state: "Ready"
      // }
      // },
      // {
      // name: "sample-index-2",
      // dimension: 3,
      // metric: "cosine",
      // host: "sample-index-2-1234567.svc.apw2-5e76-83fa.pinecone.io",
      // spec: {
      // serverless: {
      // cloud: "aws",
      // region: "us-west-2"
      // }
      // },
      // status: {
      // ready: true,
      // state: "Ready"
      // }
      // }
      // ]
      // }

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

    • Lists restore jobs within a project.

      Parameters

      Returns Promise<RestoreJobList>

      A Promise that resolves to a RestoreJobList object.

      import { Pinecone } from '@pinecone-database/pinecone';
      const pc = new Pinecone();
      const restoreJobsList = await pc.listRestoreJobs({ limit: 3 });
      console.log(restoreJobsList);
      // {
      // data: [
      // {
      // restoreJobId: '4d4c8693-10fd-4204-a57b-1e3e626fca07',
      // backupId: '11450b9f-96e5-47e5-9186-03f346b1f385',
      // targetIndexName: 'my-index-restore-1',
      // targetIndexId: 'deb7688b-9f21-4c16-8eb7-f0027abd27fe',
      // status: 'Completed',
      // createdAt: 2025-05-07T03:38:37.107Z,
      // completedAt: 2025-05-07T03:40:23.687Z,
      // percentComplete: 100
      // },
      // {
      // restoreJobId: 'c60a62e0-63b9-452a-88af-31d89c56c988',
      // backupId: '11450b9f-96e5-47e5-9186-03f346b1f385',
      // targetIndexName: 'my-index-restore-2',
      // targetIndexId: 'f2c9a846-799f-4b19-81a4-f3096b3d6114',
      // status: 'Completed',
      // createdAt: 2025-05-07T21:42:38.971Z,
      // completedAt: 2025-05-07T21:43:11.782Z,
      // percentComplete: 100
      // },
      // {
      // restoreJobId: '792837b7-8001-47bf-9c11-1859826b9c10',
      // backupId: '11450b9f-96e5-47e5-9186-03f346b1f385',
      // targetIndexName: 'my-index-restore-3',
      // targetIndexId: '620dda62-c999-4dd1-b083-6beb087b31e7',
      // status: 'Pending',
      // createdAt: 2025-05-07T21:48:39.580Z,
      // completedAt: 2025-05-07T21:49:12.084Z,
      // percentComplete: 45
      // }
      // ],
      // pagination: undefined
      // }

      Errors.PineconeArgumentError when arguments passed to the method fail a runtime validation.

      Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.