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

# Environment variables

> Project environment variables, scoped per environment. Values are stored encrypted.

Project environment variables, scoped per environment. Values are stored encrypted.

## env.list

List one environment's variables with decrypted values (production by default).

```text theme={null}
GET /v1/orgs/{orgId}/projects/{projectId}/env
```

* **Auth:** Organization API key (`Authorization: Bearer korve_...`) or dashboard session.
* **Minimum role:** `admin`
* **Risk:** `read`

### Query parameters

| Name          | Type   | Required | Description                        |
| ------------- | ------ | -------- | ---------------------------------- |
| `environment` | string | No       | Pattern: `^[a-z][a-z0-9-]{0,38}$`. |

### Example

```bash theme={null}
curl "https://api.korve.dev/v1/orgs/$ORG_ID/projects/$PROJECT_ID/env?environment=example" \
  -H "Authorization: Bearer korve_..."
```

### Responses

| Status | Description                                          |
| ------ | ---------------------------------------------------- |
| `200`  | Decrypted environment variables.                     |
| `404`  | No such project or environment in this organization. |

### Response body (200)

An array of objects with these fields:

| Field   | Type   | Description                        |
| ------- | ------ | ---------------------------------- |
| `key`   | string | Pattern: `^[A-Z][A-Z0-9_]{0,63}$`. |
| `value` | string | —                                  |

## env.set

Set environment variables in a batch — existing keys in the addressed environment (production by default) are overwritten.

```text theme={null}
PUT /v1/orgs/{orgId}/projects/{projectId}/env
```

* **Auth:** Organization API key (`Authorization: Bearer korve_...`) or dashboard session.
* **Minimum role:** `admin`
* **Billing:** requires active organization billing — returns `402` otherwise.
* **Risk:** `write` · sensitive (elevated blast radius)

### Query parameters

| Name          | Type   | Required | Description                        |
| ------------- | ------ | -------- | ---------------------------------- |
| `environment` | string | No       | Pattern: `^[a-z][a-z0-9-]{0,38}$`. |

### Request body

| Field          | Type      | Required | Description                        |
| -------------- | --------- | -------- | ---------------------------------- |
| `vars`         | object\[] | Yes      | —                                  |
| `vars[].key`   | string    | Yes      | Pattern: `^[A-Z][A-Z0-9_]{0,63}$`. |
| `vars[].value` | string    | Yes      | —                                  |

### Example

```bash theme={null}
curl -X PUT "https://api.korve.dev/v1/orgs/$ORG_ID/projects/$PROJECT_ID/env?environment=example" \
  -H "Authorization: Bearer korve_..." \
  -H "Content-Type: application/json" \
  -d '{
  "vars": [
    {
      "key": "API_BASE_URL",
      "value": "https://api.example.com"
    }
  ]
}'
```

### Responses

| Status | Description                                          |
| ------ | ---------------------------------------------------- |
| `200`  | Variables stored.                                    |
| `402`  | Organization billing is not active.                  |
| `404`  | No such project or environment in this organization. |
| `422`  | Invalid variable key or value.                       |

### Response body (200)

| Field   | Type    | Description |
| ------- | ------- | ----------- |
| `count` | integer | —           |

## env.delete

Delete one environment variable from the addressed environment (production by default).

```text theme={null}
DELETE /v1/orgs/{orgId}/projects/{projectId}/env/{key}
```

* **Auth:** Organization API key (`Authorization: Bearer korve_...`) or dashboard session.
* **Minimum role:** `admin`
* **Risk:** `destructive`

### Query parameters

| Name          | Type   | Required | Description                        |
| ------------- | ------ | -------- | ---------------------------------- |
| `environment` | string | No       | Pattern: `^[a-z][a-z0-9-]{0,38}$`. |

### Example

```bash theme={null}
curl -X DELETE "https://api.korve.dev/v1/orgs/$ORG_ID/projects/$PROJECT_ID/env/uploads%2Freport.pdf?environment=example" \
  -H "Authorization: Bearer korve_..."
```

### Responses

| Status | Description                           |
| ------ | ------------------------------------- |
| `200`  | Variable deleted.                     |
| `404`  | No such variable in this environment. |
