Rotate an API key
API keys can’t be changed in place. To rotate one, create a replacement with the same permissions, switch your applications to it, and then delete the old key. Deleting last means your applications never lose access. Repeat these steps in each project that has keys to rotate. To find them all at once, list every API key in your organization.- Pinecone console
- Code
- Open the Pinecone console and select your project.
- Go to API keys.
- Note the permissions of the key you’re replacing. To see them, in the key’s row, click ellipsis (…) menu > Settings.
- Click + API key, enter an API key name, and select the same Permissions as the key you’re replacing.
- Click Create key.
- Copy the new key and store it in a secure place.
- Replace the old key with the new one everywhere it’s used, such as environment variables, secret managers, CI pipelines, and deployed applications. Then confirm your applications work with the new key.
- In the old key’s row, click ellipsis (…) menu > Delete.
- Enter the API key name and click Delete API key.
List every API key in your organization
In an organization with many projects, use the Admin API to find every key instead of checking each project in the console. This script lists the organization’s projects, then prints each key’s project, name, ID, roles, and creation time. It requiresjq.
To complete this action through the Admin API, you need an access token.
OrgOwner role, so the token can read the keys in every project.
curl
Output
Revoke an API key
To cut off an API key, delete it. Any application using the key starts getting401 Unauthorized errors within seconds. If you can, create a replacement key first.
The console doesn’t let you delete a project’s last API key. Create the replacement key first, then delete the old one.
Rotate a service account secret
Service accounts are available on the Enterprise plan. Only organization owners can rotate a service account’s secret.
expires_in field.
Applications can’t request new access tokens until you give them the new secret, so have every place the secret is used ready to update before you start.
- Pinecone console
- Code
- Go to Settings > Access > Service accounts.
- In the service account’s row, click ellipsis (…) menu > Rotate secret.
- Enter the service account name to confirm, and click Rotate secret.
- Copy the new Client secret and store it in a secure place.
- Click Copy and Continue.
- Replace the old secret with the new one everywhere the service account is used. Keep the same client ID.
rotate_trigger works and how Terraform stores the secret, see Service accounts in the Terraform guide.
Revoke a service account
To cut off a service account, choose one of these options:- Rotate and discard: Rotate its secret and don’t store the new one. No one can request new access tokens, but tokens already issued keep working until they expire. The account and its role assignments stay in place, so you can restore access later by rotating again.
- Delete: Delete the service account. Its access tokens stop working right away, and it’s removed from every project. You can’t undo it.
If a key or secret stops working
A request that returns401 Unauthorized usually means the API key was deleted or the service account’s secret was rotated. Requests with that credential won’t work again, so get a new one:
- API key: Create a new API key in the project, or ask a project owner to create one.
- Service account: Ask an organization owner to rotate the secret and send you the new one.