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

# profile

> cpln profile — Manage local CLI profiles for storing authentication and context settings.

Manage local profiles

For a detailed overview, please visit the [manage CLI profiles](/cli-reference/get-started/profiles) guide.

```none theme={null}
cpln profile [SUBCOMMAND]
```

```text theme={null}
Commands:
  cpln profile delete <profiles...>   Delete one or more referenced profiles
  cpln profile get [profiles...]      Retrieve one or more profiles
  cpln profile login [ref]            Create a profile named "default" and launch a browser to begin the interactive login process
  cpln profile set-default <profile>  Set the referenced profile as the default
  cpln profile token [profile]        Show the JWT token of the referenced profile
  cpln profile update <profile>       Manage the referenced profile  [aliases: create]

Options:
  --version  Show version number  [boolean]
  --help     Show help  [boolean]
```

***

#### profile delete

Delete one or more referenced profiles

**Usage**

```none theme={null}
cpln profile delete <profiles...> [OPTIONS]
```

<Accordion title="Reference">
  ```text theme={null}
  Positionals:
    profile  One or more profile names to delete

  Format options:
    --output, -o  Set the output format  [choices: "text", "json", "yaml", "json-slim", "yaml-slim", "tf", "crd", "names"]
    --color       Colorize the output  [boolean] [default: true]
    --ts          Timestamp format if the output format is text (e.g., --output=text)  [choices: "iso", "local", "age"]
    --max         Maximum number of records to show. A value less than 1 will return all records.  [number] [default: 50]

  Request options:
    --token         Override the authorization token
    --endpoint      Override the API URL
    --insecure, -k  Ignore TLS errors  [boolean]

  Debug options:
    --verbose, -v  Enable verbose output to stderr  [boolean] [default: false]
    --debug, -d    Show all HTTP communications  [boolean] [default: false]

  Options:
    --version  Show version number  [boolean]
    --help     Show help  [boolean]
  ```

  [Common Options Reference](/cli-reference/using-cli/common-options)
</Accordion>

<Accordion title="Example">
  * Delete one profile

  <CodeGroup>
    ```bash Command theme={null}
    cpln profile delete default
    ```

    ```text Command theme={null}
    A table showing the profile details will return if the delete was successful. Otherwise, an empty table will be displayed.
    ```
  </CodeGroup>

  * Delete multiple profiles

  <CodeGroup>
    ```bash Command theme={null}
    cpln profile delete demo-profile@example.com default
    ```

    ```text Output theme={null}
    A table showing the profile details will return if the delete was successful. Otherwise, an empty table will be displayed.
    ```
  </CodeGroup>
</Accordion>

***

#### profile get

Retrieve one or more profiles

**Usage**

```none theme={null}
cpln profile get [profiles...] [OPTIONS]
```

<Note>
  An empty reference will return all references
</Note>

<Accordion title="Reference">
  ```text theme={null}
  Positionals:
    profiles  One or more profiles to show  [array] [default: []]

  Format options:
    --output, -o  Set the output format  [choices: "text", "json", "yaml", "json-slim", "yaml-slim", "tf", "crd", "names"]
    --color       Colorize the output  [boolean] [default: true]
    --ts          Timestamp format if the output format is text (e.g., --output=text)  [choices: "iso", "local", "age"]
    --max         Maximum number of records to show. A value less than 1 will return all records.  [number] [default: 50]

  Request options:
    --token         Override the authorization token
    --endpoint      Override the API URL
    --insecure, -k  Ignore TLS errors  [boolean]

  Debug options:
    --verbose, -v  Enable verbose output to stderr  [boolean] [default: false]
    --debug, -d    Show all HTTP communications  [boolean] [default: false]

  Options:
    --version  Show version number  [boolean]
    --help     Show help  [boolean]
  ```

  [Common Options Reference](/cli-reference/using-cli/common-options)
</Accordion>

<Accordion title="Example">
  <CodeGroup>
    ```bash Command theme={null}
    cpln profile get default
    ```

    ```text Output theme={null}
    +--------+---------------------+--------+-------+------------------------+----+----+-------+-----------+
    |PROFILE |EMAIL                |DEFAULT |ACTIVE |ENDPOINT                |ORG |GVC |OUTPUT |TIMESTAMPS |
    |--------|---------------------|--------|-------|------------------------|----|----|-------|-----------|
    |default |test-128@example.com |*       |*      |https:/api.test.cpln.io |    |    |text   |age        |
    +--------+---------------------+--------+-------+------------------------+----+----+-------+-----------+
    ```
  </CodeGroup>
</Accordion>

***

#### profile login

Create a profile named "default" and launch a browser to begin the interactive login process

**Usage**

```none theme={null}
cpln profile login [ref] [OPTIONS]
```

<Accordion title="Reference">
  ```text theme={null}
  Debug options:
    --verbose, -v  Enable verbose output to stderr  [boolean] [default: false]
    --debug, -d    Show all HTTP communications  [boolean] [default: false]

  Positionals:
    ref  The resource reference. Usually it is the name of the resource.

  Options:
    --version  Show version number  [boolean]
    --help     Show help  [boolean]
  ```

  [Common Options Reference](/cli-reference/using-cli/common-options)
</Accordion>

<Accordion title="Example">
  <CodeGroup>
    ```bash Command theme={null}
    cpln profile login
    ```

    ```text Output theme={null}
    A new browser will open displaying the Control Plane login page. 

    If the login was successful, the browser will indicate that it can be closed. The CLI will display the login results. Press
    Control-C to exit the CLI login.  

    If the login failed, the browser and be closed and the CLI will return to the command prompt. Run \`cpln profile login\` again to 
    restart the login.
    ```
  </CodeGroup>
</Accordion>

***

#### profile set-default

Set the referenced profile as the default

**Usage**

```none theme={null}
cpln profile set-default <profile> [OPTIONS]
```

<Accordion title="Reference">
  ```text theme={null}
  Positionals:
    profile  Profile name to be set as the default  [required]

  Options:
    --version  Show version number  [boolean]
    --help     Show help  [boolean]
  ```

  [Common Options Reference](/cli-reference/using-cli/common-options)
</Accordion>

<Accordion title="Example">
  <CodeGroup>
    ```bash Command theme={null}
    cpln profile set-default demo-profile
    ```

    ```text Output theme={null}
    The referenced profile will be set as the default for all future executions of the CLI commands.  

    If the set was successful, the command prompt will return. Otherwise, the error will be shown.
    ```
  </CodeGroup>
</Accordion>

***

#### profile token

Show the JWT token of the referenced profile

**Usage**

```none theme={null}
cpln profile token [profile] [OPTIONS]
```

<Note>
  An empty reference will return the token for the default profile
</Note>

<Accordion title="Reference">
  ```text theme={null}
  Positionals:
    profile  Profile to retrieve the token for

  Command options:
    --serve          Serve token on a local server  [boolean]
    --port           Port for the local server  [number] [default: 43200]
    --jwt            View your jwt for the token server  [boolean]
    --generateToken  Generate a new jwt token for the token server  [boolean]

  Format options:
    --output, -o  Set the output format  [choices: "text", "json", "yaml", "json-slim", "yaml-slim", "tf", "crd", "names"]
    --color       Colorize the output  [boolean] [default: true]
    --ts          Timestamp format if the output format is text (e.g., --output=text)  [choices: "iso", "local", "age"]
    --max         Maximum number of records to show. A value less than 1 will return all records.  [number] [default: 50]

  Request options:
    --token         Override the authorization token
    --endpoint      Override the API URL
    --insecure, -k  Ignore TLS errors  [boolean]

  Debug options:
    --verbose, -v  Enable verbose output to stderr  [boolean] [default: false]
    --debug, -d    Show all HTTP communications  [boolean] [default: false]

  Options:
    --version  Show version number  [boolean]
    --help     Show help  [boolean]
  ```

  [Common Options Reference](/cli-reference/using-cli/common-options)
</Accordion>

<Accordion title="Example">
  <CodeGroup>
    ```bash Command theme={null}
    cpln profile token demo-profile
    ```

    ```text Output theme={null}
    A valid JWT token for the referenced profile "demo-profile" will be shown.
    ```
  </CodeGroup>

  ```text Token Server Usage theme={null}
  - 'cpln profile token --serve': Create a server (default port of 43200) instead of outputting the token directly. 
                                  This command generates a profile specific token to authenticate against this token server.
  - 'cpln profile token --serve --port PORT': Sets the port of the token server.
  - 'cpln profile token --jwt': Outputs the token server token for the profile.
  - 'cpln profile token --generateToken': Regenerates a token for the profile, for the token server.

  An example use case is to integrate the server to a Postman collection. The collection can then make requests to the Control Plane API 
  without needing to manually copy the token. After the server is running, by executing the 'cpln profile token --serve' command , the user 
  can utilize the Pre-request script below in Postman:

  ------------------------

  const postRequest = {
    url: "http://localhost:" + pm.environment.get("cplnTokenServerPort") + "/" + pm.environment.get("profile") + "/token",
    method: 'GET',
    header: {
      'authorization': "Bearer " + pm.environment.get("cplnTokenServerToken")
    },
  };

  pm.sendRequest(postRequest, (err, response) => {
      pm.environment.set("token", response.text());
  })

  ------------------------
  ```
</Accordion>

***

#### profile update

Manage the referenced profile

**Usage**

```none theme={null}
cpln profile update <profile> COMMAND_OPTIONS [OPTIONS]
```

<Accordion title="Reference">
  ```text theme={null}
  Positionals:
    profile  Name of the profile to update. If it does not exist, a new profile with that name will be created  [required]

  Command options:
    --login    Launch a browser to begin the interactive login process using the referenced profile
    --default  Set the given profile as the default
    --org      Set the given organization as the default organization of the referenced profile
    --gvc      Set the given GVC as the default GVC of the referenced profile

  Format options:
    --output, -o  Set the output format  [choices: "text", "json", "yaml", "json-slim", "yaml-slim", "tf", "crd", "names"]
    --color       Colorize the output  [boolean] [default: true]
    --ts          Timestamp format if the output format is text (e.g., --output=text)  [choices: "iso", "local", "age"]
    --max         Maximum number of records to show. A value less than 1 will return all records.  [number] [default: 50]

  Request options:
    --token         Override the authorization token
    --endpoint      Override the API URL
    --insecure, -k  Ignore TLS errors  [boolean]

  Debug options:
    --verbose, -v  Enable verbose output to stderr  [boolean] [default: false]
    --debug, -d    Show all HTTP communications  [boolean] [default: false]

  Options:
    --version  Show version number  [boolean]
    --help     Show help  [boolean]
  ```

  [Common Options Reference](/cli-reference/using-cli/common-options)
</Accordion>

<Accordion title="Example">
  * Create a new profile

  <CodeGroup>
    ```bash Command theme={null}
    cpln profile update new-profile
    ```

    ```text Output theme={null}
    If the referenced profile name doesn't exist, a new one will be created.
    ```
  </CodeGroup>

  * Perform an interactive login using a custom profile

  <CodeGroup>
    ```bash Command theme={null}
    cpln profile update new-profile --login
    ```

    ```text Output theme={null}
    A browser will open displaying the Control Plane login page.

    If the login was successful, a new profile with the given name will be created
    (if it doesn't already exist) and the browser will indicate that it can be closed.

    This profile will be marked as the default and used by any future CLI command.

    The CLI will display the login results. Press Control-C to exit the CLI login.

    If the login failed, the CLI will return to the command prompt.

    Run the command again to restart the login flow.
    ```
  </CodeGroup>

  * Set the referenced profile as the default profile

  <CodeGroup>
    ```bash Command theme={null}
    cpln profile update new-profile --default
    ```

    ```text Output theme={null}
    If the update was successful, the referenced profile will be set as the default for all future cpln commands.
    ```
  </CodeGroup>

  * Set a default organization and GVC on the referenced profile

  <CodeGroup>
    ```bash Command theme={null}
    cpln profile update new-profile --org demo-cpln-organization --gvc demo-gvc
    ```

    ```text Output theme={null}
    The referenced organization and GVC will be set as the default on the referenced profile.

    Any future execution of a cpln command will use those values.
    ```
  </CodeGroup>

  * Remove default organization and GVC on the referenced profile

  <CodeGroup>
    ```bash Command theme={null}
    cpln profile update new-profile --org "" --gvc ""
    ```

    ```text Output theme={null}
    The specified default organization and GVC will be removed from the referenced profile.

    Future executions of any CPLN command will require the --org and the --gvc options.
    ```
  </CodeGroup>
</Accordion>

***
