Set the Pinecone CLI target context with pc target to control which organization and project your commands run against, including in CI/CD and JSON mode.
The CLI’s target context determines which organization and project your commands operate on. You must authenticate before setting target context.
Via CLI command: After pc auth configure --client-id --client-secret, the CLI auto-targets the service account’s organization. For the project:
If one project exists, it’s auto-targeted
If multiple exist, you’re prompted (or use --project-id)
If none exist, create one and target it manually
Via environment variables: If using PINECONE_CLIENT_ID and PINECONE_CLIENT_SECRET without running pc auth configure, no target context is set automatically. Run pc target to set it.
# Change project (org is fixed to the service account's org)pc target -p "my-project"# Or select interactivelypc target
When using an API key, control plane and data plane operations use the key’s org/project scope, not the CLI’s stored target context. The pc target --show output does not reflect what these operations actually use.
API keys are scoped to a specific org and project and can’t access resources outside that scope.Admin API operations still use your user login or service account credentials (API keys can’t authenticate Admin API calls).
Running pc target --json with no targeting flags returns the current target context as a JSON object. This is a local-state read — no authentication is required:
pc target --json
In non-TTY environments (CI/CD pipelines, shell pipes, scripts), JSON output is automatic — the same as passing --json explicitly. You don’t need to add the flag in automation contexts.Use --organization-id and --project-id (instead of name flags) to set context reliably in scripts, since IDs are stable and unaffected by renames:
pc target --organization-id "org-abc123" --project-id "proj-xyz789" --json