---
title: "Create Env Var"
method: POST
path: "/api/agents/{agent_id}/env"
tags: ["environment"]
---

# Create Env Var

`POST /api/agents/{agent_id}/env`

## Request

- Base URL: `https://api.maritime.sh` (the document declares no server; this is the origin it was published from)
- URL: `https://api.maritime.sh/api/agents/{agent_id}/env`
- Auth: HTTP bearer

## Path parameters

- `agent_id` string, required

## Request body

- EnvVarCreate: Request body for POST /api/agents/{agent_id}/env. The route checks ENV_KEY_PATTERN itself, because a key that already exists may predate the rule and must stay editable.
  - `key` string, required
  - `value` string, required
  - `isSecret` boolean

## Response `201`

Successful Response

- EnvVarResponse
  - `id` string, required
  - `agentId` string, required
  - `key` string, required
  - `value` string, required
  - `isSecret` boolean, required
  - `warning` string, nullable

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/maritime/apis/maritime-api.md) - [All operations](https://skmtc.dev/maritime/apis/maritime-api/llms.txt) - [OpenAPI document](https://skmtc.dev/maritime/apis/maritime-api/revisions/acd712090ad6?raw)
