> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pinecone.io/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI target context

> Pinecone CLI: The CLI's **target context** determines which organization and project your commands operate on. You must authenticate before setting target.

<Note>
  This feature is in [public preview](/release-notes/feature-availability).
</Note>

The CLI's **target context** determines which organization and project your commands operate on. You must [authenticate](/reference/cli/authentication) before setting target context.

## How operations use target context

| Operation type                   | Scope                                    |
| -------------------------------- | ---------------------------------------- |
| Control plane (indexes, backups) | Target project                           |
| Data plane (vectors, namespaces) | Target project + specified index         |
| Admin API (organizations)        | No target context needed                 |
| Admin API (projects)             | Target organization                      |
| Admin API (API keys)             | Target project (unless `--id` specified) |

## Target context by auth method

### User login

After `pc auth login`, the CLI auto-targets your default organization and its first project.

```bash theme={null}
# Change target
pc target -o "my-org" -p "my-project"
```

### Service account

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

```bash theme={null}
# Change project (org is fixed to the service account's org)
pc target -p "my-project"

# Or select interactively
pc target
```

### API key

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

API keys are scoped to a specific org and project and cannot 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).

## Managing target context

```bash theme={null}
pc target --show   # View current target
pc target --clear  # Clear target context
```
