---
title: "Create a secret"
method: POST
path: "/secrets"
tags: ["secrets"]
---

# Create a secret

`POST /secrets`

This operation submits a request to create a secret based on the input parameters.

## Request body

- SecretIntentInput — An intentful representation of a secret
  - `spec` Secret, required — Secret Entity Definition
    - `name` string, required — The secret name
    - `resources` SecretResources, required — Secret details
      - `payload_type` string — Used to indicate the type of secret being stored.
      - `payload_content_type` string — The media type for the content of payload. This determines how to parse the contents of payload.
      - `path` string — The secret path
      - `object_type` string — The object type to determine whether it is a secret or directory.
      - `payload_content_encoding` string — The encoding used for the payload to be able to include it in the JSON request. Currently only base64 is supported, required if payload is encoded.
      - `payload` string — The secret’s data to be stored. payload_content_type must also be supplied if payload is included.
      - `expiration` string, date-time — UTC date and time in RFC-3339 format when secret expires.
  - `api_version` string
  - `metadata` SecretMetadata, required — The secret kind metadata
    - `last_update_time` string, date-time — UTC date and time in RFC-3339 format when secret was last updated
    - `kind` string, required — The kind name
    - `uuid` string, UUID — secret uuid
    - `spec_version` integer — Version number of the latest spec.
    - `creation_time` string, date-time — UTC date and time in RFC-3339 format when secret was created
    - `spec_hash` string — Hash of the spec. This will be returned from server.
    - `should_force_translate` boolean — Applied on Prism Central only. Indicate whether force to translate the spec of the fanout request to fit the target cluster API schema.
    - `owner_reference` UserReference — The reference to a user
      - `kind` string, required — The kind name
      - `name` string
      - `uuid` string, UUID, required
    - `categories` object — Categories for the secret
    - `name` string — secret name

## Response `202`

Request Accepted

- SecretIntentResponse — Response object for intentful operations on a secret
  - `status` SecretDefStatus — Secret Entity Definition
    - `name` string, required — The secret name
    - `resources` SecretResourcesDefStatus, required — Secret details
      - `payload_content_type` string — The media type for the content of payload. This determines how to parse the contents of payload.
      - `object_type` string — The object type to determine whether it is a secret or directory.
      - `payload_content_encoding` string — The encoding used for the payload to be able to include it in the JSON request. Currently only base64 is supported, required if payload is encoded.
      - `payload_type` string — Used to indicate the type of secret being stored.
      - `user_metadata` string — Metadata provided by a user or system for informational purposes.
      - `path` string — The secret path
      - `payload` string — The secret’s data to be stored. payload_content_type must also be supplied if payload is included.
      - `expiration` string, date-time — UTC date and time in RFC-3339 format when secret expires.
  - `spec` Secret — Secret Entity Definition
    - `name` string, required — The secret name
    - `resources` SecretResources, required — Secret details
      - `payload_type` string — Used to indicate the type of secret being stored.
      - `payload_content_type` string — The media type for the content of payload. This determines how to parse the contents of payload.
      - `path` string — The secret path
      - `object_type` string — The object type to determine whether it is a secret or directory.
      - `payload_content_encoding` string — The encoding used for the payload to be able to include it in the JSON request. Currently only base64 is supported, required if payload is encoded.
      - `payload` string — The secret’s data to be stored. payload_content_type must also be supplied if payload is included.
      - `expiration` string, date-time — UTC date and time in RFC-3339 format when secret expires.
  - `api_version` string, required
  - `metadata` SecretMetadata, required — The secret kind metadata
    - `last_update_time` string, date-time — UTC date and time in RFC-3339 format when secret was last updated
    - `kind` string, required — The kind name
    - `uuid` string, UUID — secret uuid
    - `spec_version` integer — Version number of the latest spec.
    - `creation_time` string, date-time — UTC date and time in RFC-3339 format when secret was created
    - `spec_hash` string — Hash of the spec. This will be returned from server.
    - `should_force_translate` boolean — Applied on Prism Central only. Indicate whether force to translate the spec of the fanout request to fit the target cluster API schema.
    - `owner_reference` UserReference — The reference to a user
      - `kind` string, required — The kind name
      - `name` string
      - `uuid` string, UUID, required
    - `categories` object — Categories for the secret
    - `name` string — secret name

## Other responses

- `409` — Conflict
- `default` — Internal Error

---

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