---
title: "Create secret"
method: POST
path: "/secrets/{namespace}"
tags: ["secrets"]
---

# Create secret

`POST /secrets/{namespace}`

Creates a new secret in the specified namespace.

## Path parameters

- `namespace` string, required

## Request body

- ApiSecretCreateEnvelope
  - `data` SecretsSecretCreate, required
    - `contents` SecretsSecretData, required
    - `immutable` boolean, required
    - `name` string, required
    - `type` string, required

## Response `201`

Secret created successfully

- ApiSecretCreateEnvelope
  - `data` SecretsSecretCreate, required
    - `contents` SecretsSecretData, required
    - `immutable` boolean, required
    - `name` string, required
    - `type` string, required

## Other responses

- `400` — Bad request
- `401` — Unauthorized
- `403` — Forbidden
- `409` — Secret already exists
- `413` — Request Entity Too Large. The request body is too large.
- `415` — Unsupported Media Type. Content-Type header is not correct.
- `422` — Unprocessable Entity. Validation error.
- `500` — Internal server error

---

[API](https://skmtc.dev/opendatahub-io/apis/kubeflow-notebooks-api.md) · [All operations](https://skmtc.dev/opendatahub-io/apis/kubeflow-notebooks-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/opendatahub-io/kubeflow-notebooks-api/revisions/97fe86faf733/schema)
