# pw auth apikey

> Source: https://parallelworks.com/docs/cli/pw/auth/apikey

## pw auth apikey

Authenticate the CLI with an API key

### Synopsis

After you enter **pw auth apikey**, the CLI will prompt you to paste your API key on a new line.

You can create a new API key on ACTIVATE by going to **Account** > **Authentication** > **API Keys**. For more information about these steps, please see [this page](/docs/account-settings/authentication#create-an-api-key).

When creating an API key, you can choose whether your key will expire in 7, 30, 60, or 90 days. Shorter expiration periods are more secure.

Alternatively, you can authenticate with a short-term token. Please see **pw auth token** for more information.

Use **--context-name** to specify a custom name for the context. This is useful if you want multiple contexts for the same user/server combination (e.g., different API keys for different purposes).

```
pw auth apikey [flags]
```

### Options

```
      --context-name string   Name for the context (defaults to user@server)
  -h, --help                  help for apikey
```

### Options inherited from parent commands

```
      --context string         The context to use. Overrides PW_CONTEXT environment variable and current context from config.
      --platform-host string   The Parallel Works ACTIVATE platform host to use. Will override any other platform host settings.
  -v, --verbose                Enable verbose logging
```

### SEE ALSO

* [pw auth](/docs/cli/pw/auth)	 - Authenticate the CLI
