Pinecone API keys are created per project in the Pinecone console under API keys, or with pc api-key create, and the value is shown only once. A Pinecone key is tied to one project, is sent in the Api-Key header, and the official MCP server reads it from PINECONE_API_KEY.
Pinecone key types
| Type | Prefix | Secret? | Scope | Expiry |
|---|---|---|---|---|
| Project API key Cannot be viewed again after the creation dialog closes. | — | Yes | One project, with the permissions chosen at creation; Starter and Builder plans get **All**, custom permissions need Standard or Enterprise | — |
How to create a Pinecone key
- Open your project in the Pinecone console and go to API keys.
- Click + API key and enter an API key name.
- Select the Permissions to grant to the key.
- Click Create key, copy the key into a secrets vault, then click Close.
Limiting what the key can do
Each Pinecone key belongs to one project. On Standard and Enterprise plans you can give a key custom permissions or roles such as ProjectEditor, and only project owners can change a key's permissions later. Starter and Builder users can only choose All and cannot change permissions after creation. With custom permissions, target indexes by host for data operations such as upsert and query.
How to rotate a Pinecone key
- Create a new key in the same project with + API key or
pc api-key create -n <name> --roles ProjectEditor. - Deploy the new key and update
PINECONE_API_KEYeverywhere. - Delete the old key from the API keys page (ellipsis menu, Delete) or with
pc api-key delete -i <KEY_ID>.
Pinecone has no in-place roll; you run the new and old keys side by side until you delete the old one. Deletion is immediate and irreversible.
How to revoke a Pinecone key
- On the API keys page, open the ellipsis (...) menu for the key and select Delete.
- Enter the API key name and click Delete API key. Only project owners can delete keys.
- Or run
pc api-key delete -i <KEY_ID>after targeting the project withpc target.
If your Pinecone key leaked
- Create a replacement key in the same project and deploy it.
- Delete the exposed key; deletion immediately disables any application using it.
- Review the project's indexes for data you did not write or delete.
- GitHub push protection blocks commits containing Pinecone API keys when it is enabled on the repository.
Environment variables and CLI
Pinecone's SDKs and docs read the key from PINECONE_API_KEY.
Pinecone CLI (pc): Target a project with pc target -o <org> -p <project>, then manage keys with pc api-key create, list and delete
Things that catch people out
- The key is shown only once.
- Deleting a key immediately breaks any app using it.
- Only project owners can delete keys or change permissions.
- Keys are project-scoped, so a key from another project returns 401 for your index.
Common Pinecone authentication errors
Invalid API key.
HTTP 401 UNAUTHENTICATED; the Api-Key header is missing, or the key is invalid, deleted or from another project.
Using your Pinecone key with AI agents
A coding agent that can read your .env file or your shell history can read the key, and anything in its context can end up in logs, transcripts or a prompt-injected request. The safer pattern is to keep the key in a credential broker that performs the authenticated step for the agent and hands back only the result.
BotPassword works this way. For a Pinecone key, these intents fit:
| Intent | What BotPassword does |
|---|---|
run_with | Runs a command with the key injected as an environment variable or a 0600 temporary file, never on the command line, and redacts the key from the output. |
http_request | Makes an authenticated API call after checking the destination against the hosts this key may be sent to. The response comes back with credential-shaped values redacted, and one that holds the key itself is refused. |
cli_login | Lets git, Docker, the AWS CLI and kubectl log in through bpw's credential helper, so the token is fetched when the tool needs it and not written into its config. The helper hands the value to the tool, so the grant is always disclosing. Other tools use run_with; OAuth device logins are planned. |
rotate | Partly built: creates a new key, stores it as pending, verifies it, promotes it, then revokes the old key after a grace period. Today it works for Cloudflare tokens and AWS IAM keys you have set up, and an agent can start it only under a grant with autopilot; other providers cannot be rotated through their API yet. |
Pinecone also publishes its own MCP server. Whatever server the agent uses, keep the credential it authenticates with out of the agent's context.
Set it up in your agent: Aider · Amp · Claude Code · Claude Desktop · Cline · OpenAI Codex CLI · all agents
Frequently asked questions
Where do I find my Pinecone API key?
In the Pinecone console under your project's API keys. You can only see the value when you create it.
Can I create a Pinecone API key from the CLI?
Yes. Run pc api-key create -n <name> --roles ProjectEditor after targeting a project with pc target.
What env var does Pinecone use?
PINECONE_API_KEY.
How do I rotate a Pinecone API key?
Create a new key, deploy it, then delete the old key in the console or with pc api-key delete. Pinecone has no roll button.
Why does Pinecone return 401 Invalid API key?
The Api-Key header is missing, or the key was deleted or belongs to a different project than the index.
Can an AI agent use my Pinecone key without seeing it?
Yes, if the key never enters the agent's context. Instead of pasting the key into a chat or leaving it in a .env file the agent can read, keep it in a credential broker that injects it into the command or request on the agent's behalf. BotPassword does this with run_with, http_request, so the agent gets the result and never the value.