# Pinecone API keys: find, store, rotate, and use them safely with AI agents

Source: https://botpassword.com/keys/pinecone
Last checked: 2026-11-08

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`.

## Key types

| Type | Prefix | Secret | Scope | Expiry |
|---|---|---|---|---|
| Project API key | — | 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

1. Open your project in the Pinecone console and go to **API keys**.
2. Click **+ API key** and enter an **API key name**.
3. Select the **Permissions** to grant to the key.
4. 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

1. Create a new key in the same project with **+ API key** or `pc api-key create -n <name> --roles ProjectEditor`.
2. Deploy the new key and update `PINECONE_API_KEY` everywhere.
3. Delete the old key from the **API keys** page (ellipsis menu, **Delete**) or with `pc api-key delete -i <KEY_ID>`.

## How to revoke a Pinecone key

1. On the **API keys** page, open the ellipsis (...) menu for the key and select **Delete**.
2. Enter the **API key name** and click **Delete API key**. Only project owners can delete keys.
3. Or run `pc api-key delete -i <KEY_ID>` after targeting the project with `pc target`.

## If the key leaked

1. Create a replacement key in the same project and deploy it.
2. Delete the exposed key; deletion immediately disables any application using it.
3. Review the project's indexes for data you did not write or delete.
4. GitHub push protection blocks commits containing Pinecone API keys when it is enabled on the repository.

## Environment variables

- `PINECONE_API_KEY`

## Gotchas

- 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.

## Using this key with AI agents (BotPassword)

- `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.

## FAQ

### 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.

## Sources

- https://docs.pinecone.io/admin/projects/manage-api-keys
- https://docs.pinecone.io/reference/api/errors
- https://docs.pinecone.io/reference/api/authentication
- https://docs.pinecone.io/guides/operations/mcp-server
- https://docs.github.com/en/code-security/secret-scanning/introduction/supported-secret-scanning-patterns
