---
title: Save your login credentials
description: Save your login credentials instead of manually entering them
source: https://eu-de.quantum.cloud.ibm.com/docs/en/guides/save-credentials
---

# Save your login credentials

If you are working in a trusted Python environment (such as on a personal laptop or workstation), you can use the `save_account()` method to save your credentials locally, then use them to initialize the service.

> **Notes**
>
> - If you are using a public computer or other untrusted environment, follow the instructions in [Initialize the service in an untrusted environment](/docs/guides/cloud-setup-untrusted) instead.
> - Follow [these instructions](/docs/guides/cloud-setup-rest-api) if you want to connect by using the REST API instead of using Qiskit.
> - If necessary, use [this information](/docs/guides/quickstart-steps-org#firewall) to configure your firewall to enable access to the IBM Quantum API endpoints.

## Before you begin

1. Ensure you are working in an active Python environment with the [`qiskit` and `qiskit-ibm-runtime` packages installed](/docs/guides/install-qiskit#local).
2. Activate the Python virtual environment and run Python in your virtual environment.
3. Log in to [IBM Quantum Platform]().

## Find your access credentials

1. Make sure that the correct account and region are selected in the account switcher in the header.
2. Find your API key. From the [dashboard](/), create your API key, then copy it to a secure location so you can use it for authentication. Note that you can use the same API key to connect to any region.
3. Optional: Find the instance you want to use from the [Instances](/instances) page. Hover over its CRN, click the icon to copy it, then save it in a secure location so you can use it to identify the instance.

## Save your access credentials

Save your credentials by running the appropriate code once per account you want to save. After saving your credentials, load them by following the steps in [Initialize IBM Quantum Compute Service](/docs/guides/initialize-account).

### Save credentials that access a specific instance:

If you have multiple instances and want to easily tell Quantum Compute which instance to use, save credentials that include an instance CRN.

```python
from qiskit_ibm_runtime import QiskitRuntimeService

QiskitRuntimeService.save_account(
  # For `token`, use the 44-character API_KEY you created 
  # and saved from the IBM Quantum Platform Home dashboard:
  token="<your-api-key>", 
  name="<account-name>", # Optional
  instance="<IBM Cloud CRN or instance name>", # Optional
  set_as_default=True, # Optional
  overwrite=True, # Optional
)
```

### Save credentials for automatic instance selection:

If you don't provide an instance CRN and pass these credentials to Quantum Compute, an appropriate instance will be chosen for you, based on the specified options.

```python
from qiskit_ibm_runtime import QiskitRuntimeService

QiskitRuntimeService.save_account(
  # For `token`, use the 44-character API_KEY you created 
  # and saved from the IBM Quantum Platform Home dashboard:
  token="<your=api-key>", 
  name="<account-name>", # Optional
  instance="<instance-to-use>", # Optional
  plans_preference="<plan_types>", # Optional
  region="<region>", # Optional
  tags="<instance-tags>", # Optional
  set_as_default=True, # Optional
  overwrite=True, # Optional
)
```

### Available options

- **`token`**: IBM Cloud API key. Your token is confidential. Do not share your token in public code.
- **`instance`**: Optionally specify the instance to use through its IBM Cloud CRN or instance name.
- **`plans_preference`**: Optionally set the types of plans to prioritize. This is ignored if the instance is specified. Available options are `open`, `pay-as-you-go`, `flex`, `premium`, and `on-prem`. Instances of a certain plan type are excluded if the plan name is not specified. For example, if \[`open`] is passed in, only Open Plan instances are available. This is ignored if `instance` is specified.
- **`region`**: Optionally set the region to use. Accepted values are `us-east` and `eu-de`. This is ignored if `instance` is specified.
- **`tags`**: Optionally specify the instance's tags. Accepts a list of tag name strings. This is ignored if `instance` is specified.
- **`name`**: Optionally name this set of account credentials.
- **`set_as_default`**: Set the value to `True` to save these as your default credentials. If you save only one account, it is automatically set as the default.
- **`overwrite`**: Set this value to `True` to update your default credentials.

## Examples

### Example 1

This example saves credentials for specific instances, which allow open and premium access.  The open credentials are set as the default.

```python
from qiskit_ibm_runtime import QiskitRuntimeService

QiskitRuntimeService.save_account(token="<API_TOKEN>", 
                                  instance="<CRN_for_premium_instance>",
                                  name="premium")
QiskitRuntimeService.save_account(token="<API_TOKEN>", 
                                  instance="<CRN_for_open_instance>",
                                  name="open", set_as_default=True)
```

### Example 2

This example saves credentials for automatic instance selection.  Quantum Compute will only look at premium instances in the EU region that are available to the account. These credentials become the new default.

```python
QiskitRuntimeService.save_account(
    token="your-api-key",
    set_as_default=True,
    overwrite = True,

    # Set instance "filters" instead of specifying the instance:
    region="eu-de",
    plans_preference=["premium"]
  )
```

## View saved credentials

To view all credentials that you have saved, run `service.saved_accounts()`.  Note that if you saved default credentials and didn't name them, they are named `default-ibm-quantum-platform`. If you did name your default credentials, you will see `"is_default_account": true` in the output.

## Considerations

- If you are saving multiple accounts, use the `name` parameter to differentiate them.
- Credentials are saved to `$HOME/.qiskit/qiskit-ibm.json`.  Do not manually edit this file.
- If you don't save your credentials, you must specify them every time you start a new session (instantiate IBM Quantum Compute Service).
- If you manually specify your credentials, a saved account will not be used.

# Next steps

> **Recommendations**
>
> - [Initialize IBM Quantum Compute Service](/docs/guides/initialize-account) in a trusted Python environment.
> - [Initialize IBM Quantum Compute Service in an **untrusted environment**](/docs/guides/cloud-setup-untrusted).
> - [View your available QPUs](/docs/guides/qpu-information#available).
> - [Configure the Qiskit SDK locally](/docs/guides/configure-qiskit-local).
> - Follow the steps in the [Run your first circuit on hardware](/docs/guides/hello-world) guide to write and run a quantum program.
> - [Set up to use IBM Quantum Platform with REST API](/docs/guides/cloud-setup-rest-api).
> - Try a [tutorial](/docs/tutorials).
