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

# Create a Secret

`POST /secrets`

## Request body

- union — The secret creation request
  - union
    - CreateBasicAuthSecretRequestDto
      - `type` 'basic', required
      - `provider` string, required — The provider/credential name chosen by the user
      - `username` string, required — The username for basic authentication.
      - `password` string — The password for basic authentication.
    - CreateBearerAuthSecretRequestDto
      - `type` 'bearer', required
      - `provider` string, required — The provider/credential name chosen by the user
      - `token` string — The bearer token for authentication.
    - CreateApiKeyAuthSecretRequestDto
      - `type` 'api_key', required
      - `provider` string, required — The provider/credential name chosen by the user
      - `api_key` string — The API key for authentication.
      - `header_name` string — Custom header name for the API key (e.g., "Authorization", "X-API-Key").
  - union
    - CreateSecretOpenAIRequestDto
      - `api_key` string — The API key for OpenAI/Azure OpenAI authentication.
      - `model` string, required — The OpenAI model to use
      - `endpoint` string, required — The OpenAI API endpoint URL
      - `isStreaming` boolean, required — Whether to use streaming for LLM responses
      - `maxMessages` number, double — Maximum number of messages to include in the conversation
      - `provider` 'external-openai', required — The provider type for OpenAI.
    - CreateSecretAzureOpenAIRequestDto
      - `api_key` string — The API key for OpenAI/Azure OpenAI authentication.
      - `model` string, required — The OpenAI model to use
      - `endpoint` string, required — The OpenAI API endpoint URL
      - `isStreaming` boolean, required — Whether to use streaming for LLM responses
      - `maxMessages` number, double — Maximum number of messages to include in the conversation
      - `provider` 'external-azure-openai', required — The provider type for Azure OpenAI.
      - `version` string — The version of the Azure OpenAI API to use

## Response `201`

Created

- SanitizedSecretDto
  - `id` string, required
  - `provider` string, required
  - `type` 'bearer' | 'api_key' | 'basic' | 'oauth2', required — Authentication types supported by the secrets service
  - `created_at` string, required
  - `last_used_at` string, required
  - `sanitized_secret` string, required
  - `config` string

## Other responses

- `401` — AuthorizationError

---

[API](https://skmtc.net/d-id/apis/realtime-endpoints.md) · [All operations](https://skmtc.net/d-id/apis/realtime-endpoints/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/d-id/realtime-endpoints/versions/2f2425e1b6b6/schema)
