---
search:
  tags:
    - Keypairs
    - POST
seo:
  description: >-
    Decrypts the values of an encrypted .env file on the server,… Reference for
    the POST /environments/{envId}/sealed-values/open endpoint in the varsafe
    API.
sidebar:
  label: Open an encrypted .env file
  badge: POST
title: Open an encrypted .env file
type: openapi-operation
---
Decrypts the values of an encrypted .env file on the server, with the key the file names, and returns them. Authorized exactly like resolving the environment for injection, refused as a whole if any value was altered, and recorded in the audit trail with the variable names. When the file was encrypted with a key that has since been rotated, the answer also carries the active key to re-encrypt it with.

`POST /environments/{envId}/sealed-values/open`

**Request body** (`application/json`, required)

- `keyId` (string, required)
- `entries` (object, required)

Request body example:

```json
{
  "keyId": "string",
  "entries": {
    "property1": "string",
    "property2": "string"
  }
}
```

**Responses**

- `200` — Success.
- `400` — The request failed validation. \`field\` names the offending input.
- `401` — No credential was presented, or it is invalid or revoked.
- `403` — The credential is valid but lacks the required scope, role or team access.
- `404` — The resource does not exist, or is not visible to this credential.
- `429` — Rate limited. Retry after the interval named in the response.
- `500` — Unexpected server error. The body never carries internal detail.

Response example, 200:

```json
{
  "keyId": "string",
  "values": {
    "property1": "string",
    "property2": "string"
  },
  "activeKey": {
    "keyId": "string",
    "publicKey": "string"
  }
}
```
