---
title: "ezgh secrets read"
description: "Print a secret's values (a billed read)."
---

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

# ezgh secrets read

{/* Generated by ezgh-cli's internal/tools/clidocs from the ezgh command tree. Don't edit: change the command's help in ezgh-cli and regenerate. */}

```sh
ezgh secrets read <name> [--version N|latest] [--field K] [--format env|json|raw] [flags]
```

Print the values of a version (latest by default), or of one field with `--field`. This is the only command that prints values, and every read is billed and recorded in Trails.

`--format` env (the default) prints KEY=VALUE lines, quoted for a POSIX shell when a value needs it, so `eval "$(ezgh secrets read prod/app)"` and `set -a; . <(…)` work; a binary field can't be printed that way and is refused. `--format` json prints the API's answer (&#123;"version", "fields"&#125;, or &#123;"version", "name", "value"&#125; for `--field`; a binary value is &#123;"base64": …&#125;). `--format` raw needs `--field` and writes the value's exact bytes (decoded, for a binary one), with no newline added.

Part of [`ezgh secrets`](/cli/reference/secrets).

## Examples

```sh
ezgh secrets read prod/app > .env
ezgh secrets read prod/app --field TLS_KEY --format raw > key.der
eval "$(ezgh secrets read prod/app --version 2)"
```

## Flags

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--field` | string |  | read only this field |
| `--format` | string | `env` | env, json or raw (raw needs `--field`) |
| `--version` | string | `latest` | the version to read: a number, or latest |

This command also takes the [global flags](/cli/reference#global-flags).

Source: https://docs.ezghcloud.com/cli/reference/secrets-read/index.mdx
