Migrate to the new API
Pinecone’s new API gives you the same great vector database but with a drastically improved developer experience over the legacy API.
To use the new API, existing Pinecone client users must:
If you are a new Pinecone user, try the Quickstart to get a vector search service up and running in minutes using the new API.
The legacy version of the API, which required regional URLs for control plane operations, is deprecated as of April 15, 2024 and will be removed in a future, to be announced, release. We recommend migrating to the new API as soon as possible.
Install the latest client version
Python
To install the latest version of the Python client, run the following command:
pip install pinecone-client
If you already have the Python client, run the following command:
pip install pinecone-client --upgrade
Node.js
To install the new version of the Node.js client, run the following command:
npm install @pinecone-database/pinecone
If you already have the Node.js client, run the following command:
npm install @pinecone-database/pinecone@latest
Java
You can install the latest version of the Java client from Maven Central for use as a maven dependency in the following ways:
// Maven
<dependency>
<groupId>io.pinecone</groupId>
<artifactId>pinecone-client</artifactId>
<version>1.0.0</version>
</dependency>
// Gradle
implementation "io.pinecone:pinecone-client:1.0.0"
Adapt existing code
The new API requires some code adaptation if you are migrating from the legacy API. This section summarizes the most important changes to address.
For a comprehensive list of changes, see the Python client v3 migration guide and Node.js client v2 migration guide.
Update the URL for control plane operations
On the new API, the global URL for all control plane operations, regardless of cloud environment, is https://api.pinecone.io
. The control plane is where you can list indexes, create indexes, list collections, and more.
Authentication
Authenticating with a Pinecone client or the REST API now requires only the API key for your project. The environment parameter is no longer required because you now choose a cloud environment for each index, and all control operations use a global URL (https://api.pinecone.io
).
Using the new API, you initialize a client object just with your project API key:
Create indexes
In the new API, you can create both serverless and pod-based indexes..
Create a serverless index
Serverless indexes are in public preview and are available only on AWS in the us-west-2
, us-east-1
, and eu-west-1
regions. Check current limits and restrictions and test thoroughly before using them in production.
To create a serverless index,use the spec
parameter to define the cloud and region where the index should be deployed. For Python, you also need to import the ServerlessSpec
class.
Create a pod-based index
To create a pod-based index, use the spec
parameter to define the environment where the index should be deployed, the pod type and size to use, and other index characteristics. For Python, you also need to import the PodSpec
class.
List indexes
Using the new API, the list_indexes
operation now fetches a complete description of each index. The data returned on each index is equivalent to what you get back from the describe_index
operation.
Describe indexes
Using the new API, the describe_index
operation returns a description of an index in a different format than the legacy API. It also returns the index endpoint needed to run data plane operations against the index.
Was this page helpful?