This feature is in public preview.
Why target context matters
By specifying a target organization and/or project, you’re telling the CLI which resources to operate on.- Control plane operations (creating indexes, listing indexes): Always happen within a specific project.
- Admin API operations:
- Organization operations don’t require target context. They operate on organizations you have access to.
- Project management operations are scoped to your target organization. For example, running
pc project list
shows projects in the target org. - API key operations are scoped to the target project, unless you specify
--id
.
How target context works
How the CLI sets and uses target context depends on your authentication method and how you configure it.User login
When you authenticate withpc auth login
, the CLI automatically targets:
- The default organization returned by the server for your user.
- The first project in the list of that organization’s projects.
Service account
Configured via CLI command When you configure a service account withpc auth configure --client-id --client-secret
, the CLI automatically targets the organization associated with the service account (service accounts belong to a single organization). Then, to target a project:
- If the selected organization has only one project, the CLI automatically targets it.
- If that organization has multiple projects, the CLI prompts you to select one (or you can use the
--project-id
flag). - If it doesn’t have any projects, create one and then target it manually.
PINECONE_CLIENT_ID
and PINECONE_CLIENT_SECRET
) without running pc auth configure
, the CLI does not automatically set any target context. You must explicitly set it with pc target
.
Service accounts are scoped to a single organization. You can only target the organization associated with your service account credentials. To do this, and also target a specific project within that organization:
API key
When you set a default API key (withpc auth configure --api-key
or the PINECONE_API_KEY
environment variable), the CLI does not change or clear its stored target context. However, in this scenario, control plane operations do use the API key’s organization and project — not the CLI’s saved target context (regardless of any calls you’ve made to pc target
, or the output of pc target --show
). This happens because Pinecone API keys are always scoped to a specific organization and project, and they cannot access resources outside of that scope.
Because Pinecone API keys cannot be used to authenticate calls to the Admin API, Admin API operations still authentiate with your user login token or service account credentials (if available).