---
title: "create env-var"
method: POST
path: "/api/v0/secrets/"
tags: ["Accounts"]
---

# create env-var

`POST /api/v0/secrets/`

Creates a new encrypted environment variable for the authenticated user.
Keys are automatically converted to uppercase. Values are encrypted before storage.
There is a limit on the total number of environment variables per user.

CLI Usage: `vastai create env-var <key> <value>`

## Request body

- object
  - `key` string, required — Environment variable key name (will be converted to uppercase)
  - `value` string, required — Secret value to be encrypted and stored

## Response `200`

Environment variable created successfully

- object
  - `success` boolean
  - `msg` string

## Other responses

- `400` — Bad Request
- `401` — Unauthorized - Invalid or missing API key
- `403` — Forbidden - User is blacklisted
- `429` — Too Many Requests

---

[API](https://skmtc.net/vast/apis/vast-ai-api.md) · [All operations](https://skmtc.net/vast/apis/vast-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/vast/vast-ai-api/revisions/4ed14f79f796/schema)
