All requests to Pinecone APIs must contain a valid API key for the target project.

Get an API key

Create a new API key in the Pinecone console, or use the connect widget below to generate a key.

Copy your generated key:

PINECONE_API_KEY="{{YOUR_API_KEY}}"

# This API key has ReadWrite access to all indexes in your project.

Initialize a client

When using a Pinecone SDK, initialize a client object with your API key and then reuse the authenicated client in subsquent function calls. For example:

Add headers to an HTTP request

All HTTP requests to Pinecone APIs must contain an Api-Key header that specifies a valid API key and must be encoded as JSON with the Content-Type: application/json header. For example:

curl
curl https://api.pinecone.io/indexes \
   -H "Content-Type: application/json" \
   -H "Api-Key: $PINECONE_API_KEY" \
  -H "X-Pinecone-API-Version: 2024-07" \
   -d '{
         "name":  "example-index",
         "dimension": 1536,
         "metric": "cosine",
         "spec": {
            "serverless": {
               "cloud":"aws",
               "region": "us-east-1"
            }
         }
      }'

See also

Was this page helpful?