> ## Documentation Index
> Fetch the complete documentation index at: https://e2b-automation-sdk-reference-sync.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Listing secrets

> Read one secret's metadata, check whether a name is stored, or page through the project's secrets. No read surface returns a value.

`Secret.getInfo` (JavaScript) / `Secret.get_info` (Python) returns one secret's metadata and throws `SecretNotFoundError` (JavaScript) / `SecretNotFoundException` (Python) when it doesn't exist. `Secret.exists` answers the same question with a boolean instead of an error, which is the quickest way to check that a name you reference in a network rule is really stored. `Secret.list` returns a paginator over the project's secrets.

No read surface returns a secret value.

<CodeGroup>
  ```js JavaScript & TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
  import { Secret } from 'e2b'

  const info = await Secret.getInfo('stripe_api_key')
  // info.secretId  -> 'sec_...'      stable identifier, new one if you recreate the name
  // info.name      -> 'stripe_api_key'
  // info.version   -> 2              the version markers currently resolve to
  // info.metadata  -> { environment: 'production' }
  // info.createdAt -> Date
  // info.updatedAt -> Date

  await Secret.exists('stripe_api_key') // true
  await Secret.exists('typo_api_key') // false

  const paginator = Secret.list()
  while (paginator.hasNext) {
    const secrets = await paginator.nextItems()
    console.log(secrets.map((s) => s.name))
  }
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
  from e2b import Secret

  info = Secret.get_info("stripe_api_key")
  # info.secret_id  -> "sec_..."      stable identifier, new one if you recreate the name
  # info.name       -> "stripe_api_key"
  # info.version    -> 2              the version markers currently resolve to
  # info.metadata   -> {"environment": "production"}
  # info.created_at -> datetime
  # info.updated_at -> datetime

  Secret.exists("stripe_api_key")  # True
  Secret.exists("typo_api_key")  # False

  paginator = Secret.list()
  while paginator.has_next:
      secrets = paginator.next_items()
      print([s.name for s in secrets])
  ```
</CodeGroup>

Like every method that takes a single secret, `getInfo` and `exists` accept either the name or the `sec_...` identifier.

`metadata` is yours to use for organizing secrets, for example by environment or owner. It's not secret material, so don't store another credential in it. Create defaults it to an empty map. Update preserves it when omitted and replaces the whole map when supplied, so passing an empty map clears it.
