Is API Key authentication working for free accounts?

I am using the following demo code. bash:

curl https://api.pinecone.io/indexes
-H “Content-Type: application/json”
-H “Api-Key: $PINECONE_API_KEY”
-H “X-Pinecone-API-Version: 2025-01”

and got Invalid API Key

I also tried this demo code:

from pinecone.grpc import PineconeGRPC as Pinecone
from pinecone import ServerlessSpec

pc = Pinecone(api_key=‘###########################################################################’)

Creates an index using the API key stored in the client ‘pc’.

pc.create_index(
name=“docs-example”,
dimension=1536,
metric=“cosine”,
spec=ServerlessSpec(
cloud=‘aws’,
region=‘us-east-1’
)
)

I run that on my local machine and get:

pinecone.openapi_support.exceptions.UnauthorizedException: (401)

Reason: Unauthorized

HTTP response headers: HTTPHeaderDict({‘x-pinecone-api-version’: ‘2025-01’, ‘x-cloud-trace-context’: ‘########################’, ‘date’: ‘Fri, 16 May 2025 00:26:23 GMT’, ‘content-type’: ‘text/html’, ‘server’: ‘Google Frontend’, ‘Content-Length’: ‘15’, ‘Via’: ‘1.1 google’, ‘Alt-Svc’: ‘h3=“:443”; ma=2592000,h3-29=“:443”; ma=2592000’})

HTTP response body: Invalid API Key

I’ve tried with a few different API keys and keep getting invalid. I’m wondering if I’m either putting in the secret incorrectly or if the authentication is down or if there is another issue. Anyone have a workaround?

Hi @jeffaduncan -

Welcome to the Pinecone forums! Thank you for posting.

I’m not able to reproduce this on my end so I’m wondering if the API key is getting messed up with quotes or if it’s not getting picked up. If you’re still experiencing the issue, can you check that it’s set properly by running:

echo $PINECONE_API_KEY

Make sure this matches the value of the API key in the Console. Please don’t post that value here though, as that is sensitive info.

For the Python demo code, can you share how/where you are running it and which version of the Pinecone SDK you’re using?

1 Like

Seems to be working now. Probably user error. I generated a new API key and no more problems. Thank you for the assistance.

1 Like