---
title: "Generate Env Secret"
method: POST
path: "/apps/{app_id}/env/{key}/generate"
---

# Generate Env Secret

`POST /apps/{app_id}/env/{key}/generate`

## Request

- Base URL: `https://api.xhostd.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.xhostd.com/apps/{app_id}/env/{key}/generate`
- Auth: none declared

Store a new random secret under a new key, and return nothing.

The value is ``secrets.token_urlsafe(32)``, 256 bits, the
``routes/passwords.py`` precedent. Create-only: a key that already
has a row in that scope answers 409, so a generate never replaces a
value the app depends on. The response carries no value; the
console's audited reveal is the read path.

## Path parameters

- `app_id` string, uuid, required
- `key` string, required

## Query parameters

- `channel_id` string, uuid, nullable

## Headers

- `authorization` string, nullable

## Response `204`

Successful Response

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/xhostd/apis/xhostd-public.md) · [All operations](https://skmtc.dev/xhostd/apis/xhostd-public/llms.txt) · [OpenAPI document](https://skmtc.dev/xhostd/apis/xhostd-public/revisions/bf439c4d1789?raw)
