---
title: "Create a Secret"
method: POST
path: "/v1/projects/secrets"
---

# Create a Secret

`POST /v1/projects/secrets`

Creates a new secret for the specified project. Secrets are encrypted and stored securely.

## Request body

- CreateSecretRequestBody
  - `name` string, required — The name of the secret.
  - `value` string, required — The secret value to store.
  - `description` string — An optional description of the secret.
  - `tags` string[] — Optional tags to categorize the secret.

## Response `201`

Secret created successfully

- CreateSecretResponse
  - `success` boolean
  - `message` string
  - `data` object
    - `id` string
    - `name` string
    - `description` string
    - `tags` string[]
    - `lastAccessedAt` string, nullable
    - `createdAt` string
    - `updatedAt` string

## Other responses

- `400` — Bad request
- `401` — Unauthorized
- `409` — Secret with the same name already exists
- `500` — Server Side Error

---

[API](https://skmtc.net/tryhamsa/apis/hamsa-api.md) · [All operations](https://skmtc.net/tryhamsa/apis/hamsa-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tryhamsa/hamsa-api/versions/ecbeb5d8dc13/schema)
