---
title: "POST Create a new secret"
description: "Create a new secret"
last_updated: "2026-05-06T07:33:58.393951+00:00"
canonical_url: "https://www.doc0.dev/docs/49c89830-117b-4def-8edc-b5bcc50766e0/api/secrets/createsecret"
---

<APIEndpoint
  method={"POST"}
  path={"/api/secrets"}
  summary={"Create a new secret"}
  description={"Create a new secret"}
  deprecated={false}
  baseUrl={""}
/>

## Request Body

<APIRequestBody
  contentType={"application/json"}
  required={true}
  schema={{"type":"object"}}
/>

## Responses

<APIResponse
  statusCode={"201"}
  description={"Secret created successfully"}
  contentType={"application/json"}
  schema={{"type":"object"}}
/>

<APIResponse
  statusCode={"400"}
  description={"Invalid input or secret name already exists"}
  contentType={"application/json"}
  schema={{"type":"object"}}
/>

<APIResponse
  statusCode={"401"}
  description={"Unauthorized"}
  contentType={"application/json"}
  schema={{"type":"object"}}
/>

<APIResponse
  statusCode={"403"}
  description={"Forbidden"}
  contentType={"application/json"}
  schema={{"type":"object"}}
/>

<APIResponse
  statusCode={"500"}
  description={"Failed to create secret"}
  contentType={"application/json"}
  schema={{"type":"object"}}
/>

## Try It

<APIPlayground
  method={"POST"}
  path={"/api/secrets"}
  parameters={[]}
  requestBody={{"contentType":"application/json","required":true,"description":"","schema":{"type":"object"}}}
  baseUrl={""}
/>


## Sitemap

See the full [sitemap](https://www.doc0.dev/docs/49c89830-117b-4def-8edc-b5bcc50766e0/llms.txt) for all pages in this wiki.
