---
title: "Create secret."
method: POST
path: "/_fabric/{fabric}/_api/kms/secret"
tags: ["Secrets"]
---

# Create secret.

`POST /_fabric/{fabric}/_api/kms/secret`

## Request

- The document declares no server URL.
- Auth: one of:
  - API key in header `Authorization`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/macrometa/apis/macrometa-api-reference/docs/_fabric/:fabric/_api/kms/secret/post.ts> (a function with typed inputs; its response is checked against the schema)

It encodes sensitive data and assigns a name.

## Path parameters

- `fabric` string, required

## Request body

- CreateSecretRequest
  - `name` string
  - `value` string
  - `fileName` string
  - `keyName` string

## Response `200`

Successfully created the secret.

- CreateSecretExampleRc200
  - `error` boolean: Flag if there is an error in response. *False* for this response.
  - `code` integer: The generated response code. `value` property always returns as `null`.
  - `result` object
    - `name` string
    - `value` string
    - `fileName` string
    - `tenant` string
    - `fabric` string
    - `keyName` string
    - `keyId` string
    - `createdAt` number
    - `updatedAt` number

## Other responses

- `401`: Failed because you do not have administrator permissions.
- `403`: Failed due to credentials restrictions.
- `409`: Failed because a secret with this name already exists.
- `412`: Failed due to missing or malformed data. Verify that all parameters are complete.

---

[API](https://skmtc.dev/macrometa/apis/macrometa-api-reference.md) - [All operations](https://skmtc.dev/macrometa/apis/macrometa-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/macrometa/apis/macrometa-api-reference/revisions/2006b6d7f31d?raw)
