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

# astro deployment variable list

<Info>
  This command is only available on Astro.
</Info>

For a given Deployment on Astro, list its running environment variables in your terminal. To test these environment variables locally without having to manually copy them, you can also use this command to save them in a local `.env` file.

If an existing `.env` file already exists in your current directory, `--save` will append environment variables to the bottom of that file. It will not override or replace its contents. If `.env` does not exist, `--save` will create the file for you.

If an environment variable value is set as secret, the CLI will list only its key.

## Usage

```sh wrap theme={null}
astro deployment variable list
```

<Tip>
  This command is recommended for automated workflows. To run this command in an automated process such as a [CI/CD pipeline](/docs/astro/set-up-ci-cd), you can generate an API token, then specify the `ASTRO_API_TOKEN` environment variable in the system running the Astro CLI:

  ```bash wrap theme={null}
  export ASTRO_API_TOKEN=<your-token>
  ```

  See [Organization](/docs/astro/organization-api-tokens), [Workspace](/docs/astro/workspace-api-tokens), and [Deployment](/docs/astro/deployment-api-tokens) API token documentation for more details about ways to use API tokens.
</Tip>

## Options

| Option                   | Description                                                                                                                            | Possible Values           |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
| `-d`,`--deployment-id`   | The ID of the Deployment for which to list environment variables                                                                       | Any valid Deployment ID   |
| `-n`,`--deployment-name` | The name of the Deployment for which to list environment variable(s). Use as an alternative to `<deployment-id>`.                      | Any valid Deployment name |
| `-e`,`--env`             | The file to save environment variables to when using `--save`. Defaults to `.env` in your current directory.                           | Any valid file path       |
| `-k`,`--key`             | List only the environment variable associated with this key. If not specified, all environment variables are listed                    | Any string                |
| `-s`,`--save`            | Save environment variables to a local `.env` file                                                                                      | \`\`                      |
| `-w`,`--workspace-id`    | List environment variables for a Deployment that is not in your current Workspace. If not specified, your current Workspace is assumed | Any valid Workspace ID    |

## Examples

```sh wrap theme={null}
# Save all environment variables currently running on an Astro Deployment to the `.env` file in your current directory
$ astro deployment variable list --deployment-id cl03oiq7d80402nwn7fsl3dmv --save

# Save only a single environment variable from a Deployment on Astro to a `.env` file that is outside of your current directory
$ astro deployment variable list --deployment-name="My Deployment" --key AIRFLOW__CORE__PARALLELISM --save --env /users/documents/my-astro-project/.env
```

## Related commands

* [`astro deployment variable create`](/docs/cli/v1.41/astro-deployment-variable-create)
* [`astro deployment variable update`](/docs/cli/v1.41/astro-deployment-variable-update)
