---
title: "Create secret"
method: POST
path: "/secrets"
---

# Create secret

`POST /secrets`

Creates a new secret and associates it with the current account.

## Request body

- CreateSecretParams
  - `$schema` string, uri — A URL to the JSON Schema for this object.
  - `encrypted_value` string, required
  - `environment` string, required
  - `name` string, required
  - `preview` string, required

## Response `201`

Created

- CreateSecretResponse
  - `$schema` string, uri — A URL to the JSON Schema for this object.
  - `secret` Secret, required
    - `created_at` string, date-time, required
    - `environment` string, required
    - `name` string, required
    - `preview` string, required

## Other responses

- `401` — Unauthorized
- `409` — Conflict
- `412` — Validation Error (Precondition Failed)
- `500` — Internal Server Error

---

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