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

# Environments API

> Push, retrieve, and delete encrypted environment variable payloads.

# Environments API

## Push secrets

```http theme={null}
POST /api/v1/envs
Authorization: Bearer <write:secrets token>
```

**Request body:**

```json theme={null}
{
  "projectId": "my-saas-app",
  "environment": "PRODUCTION",
  "ciphertext": "<base64>",
  "iv": "<base64>",
  "salt": "<base64>",
  "shares": [
    { "shareIndex": 1, "shareData": "..." },
    { "shareIndex": 2, "shareData": "..." },
    { "shareIndex": 3, "shareData": "..." },
    { "shareIndex": 4, "shareData": "..." },
    { "shareIndex": 5, "shareData": "..." }
  ]
}
```

**Response `201`:**

```json theme={null}
{
  "success": true,
  "data": {
    "projectId": "my-saas-app",
    "environment": "PRODUCTION"
  }
}
```

***

## Get shares (for CLI pull)

```http theme={null}
GET /api/v1/envs/share/:projectId?environment=PRODUCTION
Authorization: Bearer <read:secrets token>
```

**Response `200`:**

```json theme={null}
{
  "success": true,
  "data": {
    "ciphertext": "<base64>",
    "iv": "<base64>",
    "salt": "<base64>",
    "shares": [
      { "shareIndex": 1, "shareData": "..." },
      ...
    ]
  }
}
```

***

## Delete environment

```http theme={null}
DELETE /api/v1/envs/:projectId?environment=PRODUCTION
Authorization: Bearer <write:secrets token>
```

**Response `200`:**

```json theme={null}
{ "success": true, "message": "Environment PRODUCTION deleted" }
```
