Solution skill
Pinecone API keys: per-project, env-only, rotate on exposure
Complete solution
Shows how to fix pinecone API keys: per-project, env-only, rotate on exposure. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Add them to.gitignore before the first commit, not after the leak. Name keys after their use (ci-rag-prod, local-dev) so a future rotation does not require guessing what each key feeds. Passing the key as a function argument through three layers of helpers, where it ends up in an error message or a trace. Keep it at the process boundary.
When to use
You are seeing this: Keys are issued per project in the Pinecone console. Use this skill when you run into "Pinecone API keys: per-project, env-only, rotate on exposure".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
API key discipline for Pinecone
The model
Keys are issued per project in the Pinecone console. A key from project A cannot touch project B's indexes; using it there gives 404s on indexes that "should exist" or a flat 401. When an agent reports a missing index, check the project before debugging the name.
Rules
- Environment only.
PINECONE_API_KEYin the shell, CI secret store, or hosting provider's secret manager. Construct clients with no arguments (Pinecone(),new Pinecone()) so there is no key literal anywhere to leak. - One key per deployment context. Do not share a single key across local dev, CI, and production. Separate keys let you rotate one context without breaking the others.
- Rotate on any exposure. If a key appears in a log, a pasted transcript, or a repo, revoke it in the console and issue a new one immediately. There is no "probably fine".
- Name keys after their use (
ci-rag-prod,local-dev) so a future rotation does not require guessing what each key feeds. - 401 means key trouble.
401 Unauthenticated: Your API key is missing or invalid(per the error-handling guide). Before retrying, verify the key value, the project it belongs to, and that it was not revoked.
Traps for agents
- Passing the key as a function argument through three layers of helpers, where it ends up in an error message or a trace. Keep it at the process boundary.
.envfiles committed to git. Add them to.gitignorebefore the first commit, not after the leak.- Confusing the Pinecone API key with inference API keys or cloud provider keys in multi-service setups. Label every secret with its service.
Evidence
Pinecone's manage-api-keys guide documents per-project keys created in the console. The error-handling guide defines 401 as missing or invalid API key. Both SDK READMEs document environment-variable construction. Verified against live docs 2026-09-26.
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_u8AVuIOx1TRC-hmzGWa1jg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Pinecone API keys: per-project, env-only, rotate on exposure <span>— Vectle</span></a>