---
title: "Create a secret"
method: POST
path: "/v1/projects/{project_id}/secrets"
tags: ["Secrets"]
---

# Create a secret

`POST /v1/projects/{project_id}/secrets`

## Request

- Base URL: `https://api.naturali.ai`
- URL: `https://api.naturali.ai/v1/projects/{project_id}/secrets`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://api.naturali.ai/authorize`, token URL `https://api.naturali.ai/token`, scopes: `mcp:access`)

Creates a new encrypted secret in a project

## Request body

- object
  - `name` string, required: Secret name
  - `value` string, required: Secret value (will be encrypted)

## Response `201`

Secret created successfully

- object
  - `id` string
  - `name` string
  - `has_value` boolean: Whether an encrypted value is stored for this secret
  - `project_id` string
  - `created_at` string, date-time
  - `updated_at` string, date-time

## Other responses

- `400`: Bad request (missing required fields)
- `401`: Unauthorized
- `403`: Forbidden
- `500`: Internal server error

---

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