# QCS Client Configuration

One set of configuration values is used for all QCS software on your computer - CLI, pyQuil, all SDKs, etc. Those settings can be applied using a configuration file, environment variables, or at runtime by editing the configuration object in your chosen language's SDK.

Download your personal [secrets.toml](#qcs-secrets-file) and [settings.toml](#qcs-settings-file) files at <https://qcs.rigetti.com/auth/token>

{% hint style="info" %}
QCS Settings and Secrets files are automatically downloaded and configured when using the QCS CLI Client. See [Using the QCS CLI](https://docs.rigetti.com/qcs/guides/using-the-qcs-cli) for more information.

JupyterLab environments are preconfigured.

See also [PyQuil Configuration](https://pyquil-docs.rigetti.com/en/latest/advanced_usage.html#pyquil-configuration).
{% endhint %}

### Environment Variables and Configuration Files

QCS clients derive configuration from the environment:

* `QCS_PROFILE_NAME`
  * Name of settings profile to use (optional)
* `QCS_SETTINGS_PATH` or `QCS_SETTINGS_FILE_PATH`
  * File path to API configurations options toml file, default is `~/.qcs/settings.toml`
* `QCS_SECRETS_PATH` or `QCS_SECRETS_FILE_PATH`
  * File path to API authentication token toml file, default is `~/.qcs/secrets.toml`
* `QCS_SETTINGS_APPLICATIONS_PYQUIL_QVM_URL`
  * URL to use for QVM when running pyQuil, default is `http://127.0.0.1:5000`
* `QCS_SETTINGS_APPLICATIONS_PYQUIL_QUILC_URL`
  * URL to use for quilc when running pyQuil, default is `tcp://127.0.0.1:5555`

#### QCS Settings File

A `toml` -formatted file with configuration details for using QCS Clients.

An annotated example:

```toml
# Name of profile to use when one is not otherwise specified.
# Used in order of precedence:
# 1. The `--profile-name` flag via the QCS CLI.
# 2. The `QCS_PROFILE_NAME` environment variable.
# 3. This `default_profile_name` value in this toml file.
default_profile_name = "default"

# (Required) One or more named profiles used for
# configuring QCS applications like the CLI.
[profiles]

  # A named profile.
  [profiles.default]
  
    # (Required) QCS API origin.
    api_url = "https://api.qcs.rigetti.com"
    
    # (Optional) Named credentials to use from `QCS_SECRETS_FILE`.
    credentials_name = "default"
    
    # (Optional) OAuth server name to use.
    auth_server_name = "default"

  # (Optional) Application-specific settings
  [profiles.default.applications]
  
    # (Optional) QCS CLI configurations
    [profiles.default.applications.cli]
      # (Optional) Log verbosity - lower levels include messages from
      # all levels above them.
      # Options:
      # - "panic"
      # - "fatal"
      # - "error"
      # - "warn" (default)
      # - "info"
      # - "debug"
      verbosity = "warn"
      
      # (Optional) Returned data output format.
      # Options:
      # - "yaml"
      # - "json" (default)
      output_format = "json"
    
    # (Optional) PyQuil configurations
    [profiles.default.applications.pyquil]

      # Endpoints for qvm
      # Overridden by environment variable: QCS_SETTINGS_APPLICATIONS_PYQUIL_QVM_URL
      qvm_url = "http://127.0.0.1:5000"
      
      # Endpoint for quilc
      # Overridden by environment variable: QCS_SETTINGS_APPLICATIONS_PYQUIL_QUILC_URL
      quilc_url = "tcp://127.0.0.1:5555"

# (Required) One or more named OAuth server configurations.
[auth_servers]

  # A named OAuth configuration.
  # The following example uses the values expected for authenticating to https://api.qcs.rigetti.com/ 
  [auth_servers.default]
  
    # (Required) OAuth Client ID.
    # This is the Client ID used to authenticate to https://api.qcs.rigetti.com/ 
    client_id = "0oa3ykoirzDKpkfzk357"
    
    # (Required) OAuth OpenID issuer base URL.
    # This is the issuer URL used to authenticate to https://api.qcs.rigetti.com/ 
    issuer = "https://auth.qcs.rigetti.com/oauth2/aus8jcovzG0gW2TUG355"
```

#### QCS Secrets File

A `toml` -formatted file with credentials for authenticating with QCS clients. You shouldn't have to create or edit this file manually - if your file is corrupted, download a new copy at <https://qcs.rigetti.com/auth/token>

Note that this file contains secrets and should be kept safe!&#x20;

```toml
# One or more authentication credentials.
[credentials]

  # A named set of credentials.
  [credentials.default]

    # OAuth access token response payload.
    # You shouldn't have to configure this 
    [credentials.default.token_payload]
      id_token = "<JWT HERE>"
      access_token = "<JWT HERE>"

      expires_in = 86400
      refresh_token = "<SECRET HERE>"
      scope = "offline_access openid profile email"
      token_type = "Bearer"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rigetti.com/qcs/references/qcs-client-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
