---
updatedAt: 2026-04-23T08:25:04.000Z
agentTools:
  projectIndex: https://docs.d-id.com/llms.txt
---

# Update a Secret

Update an existing secret.

# OpenAPI definition

```json
{
  "openapi": "3.0.3",
  "info": {
    "title": "Resources Endpoints",
    "version": "0.1"
  },
  "servers": [
    {
      "url": "https://api.d-id.com/"
    }
  ],
  "paths": {
    "/secrets/{id}": {
      "put": {
        "operationId": "UpdateSecret",
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SanitizedSecretDto"
                }
              }
            }
          },
          "404": {
            "description": "NotFoundError",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonError"
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "kind": "NotFoundError",
                      "description": "Secret not found"
                    }
                  }
                }
              }
            }
          }
        },
        "description": "Update an existing secret.",
        "summary": "Update a Secret",
        "tags": [
          "Secrets"
        ],
        "security": [
          {
            "basic": []
          },
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "description": "The unique identifier of the secret to update",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to update",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/UpdateAuthSecretRequestDto"
                  },
                  {
                    "$ref": "#/components/schemas/UpdateSecretExternalLLMRequestDto"
                  }
                ],
                "description": "The fields to update"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "JsonError": {
        "properties": {
          "kind": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "details": {},
          "internal": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "description"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "SecretAuthType": {
        "description": "Authentication types supported by the secrets service",
        "enum": [
          "bearer",
          "api_key",
          "basic",
          "oauth2"
        ],
        "type": "string"
      },
      "SanitizedSecretDto": {
        "properties": {
          "id": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/SecretAuthType"
          },
          "created_at": {
            "type": "string"
          },
          "last_used_at": {
            "type": "string"
          },
          "sanitized_secret": {
            "type": "string"
          },
          "config": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "provider",
          "type",
          "created_at",
          "last_used_at",
          "sanitized_secret"
        ],
        "type": "object",
        "additionalProperties": false,
        "title": "Secret"
      },
      "SecretAuthType.Basic": {
        "enum": [
          "basic"
        ],
        "type": "string"
      },
      "SecretAuthType.Bearer": {
        "enum": [
          "bearer"
        ],
        "type": "string"
      },
      "SecretAuthType.ApiKey": {
        "enum": [
          "api_key"
        ],
        "type": "string"
      },
      "UpdateBasicAuthSecretRequestDto": {
        "properties": {
          "type": {
            "$ref": "#/components/schemas/SecretAuthType.Basic",
            "description": "The authentication type."
          },
          "header_name": {
            "type": "string",
            "description": "Custom header name for authentication.",
            "example": "X-Custom-Auth"
          },
          "provider": {
            "type": "string",
            "description": "The provider/credential name."
          },
          "username": {
            "type": "string",
            "description": "The username for basic authentication.",
            "example": "myuser"
          },
          "password": {
            "type": "string",
            "nullable": true,
            "description": "The password for basic authentication.",
            "example": "my-secure-password"
          }
        },
        "type": "object",
        "additionalProperties": false,
        "title": "Basic Authentication"
      },
      "UpdateBearerAuthSecretRequestDto": {
        "properties": {
          "type": {
            "$ref": "#/components/schemas/SecretAuthType.Bearer",
            "description": "The authentication type."
          },
          "header_name": {
            "type": "string",
            "description": "Custom header name for authentication.",
            "example": "X-Custom-Auth"
          },
          "provider": {
            "type": "string",
            "description": "The provider/credential name. If changed, the secret will be replaced."
          },
          "token": {
            "type": "string",
            "nullable": true,
            "description": "The bearer token for authentication.",
            "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
          }
        },
        "type": "object",
        "additionalProperties": false,
        "title": "Bearer Token"
      },
      "UpdateApiKeyAuthSecretRequestDto": {
        "properties": {
          "type": {
            "$ref": "#/components/schemas/SecretAuthType.ApiKey",
            "description": "The authentication type."
          },
          "header_name": {
            "type": "string",
            "description": "Custom header name for the API key.",
            "example": "X-API-Key"
          },
          "provider": {
            "type": "string",
            "description": "The provider/credential name."
          },
          "api_key": {
            "type": "string",
            "nullable": true,
            "description": "The API key for authentication.",
            "example": "sk-1234567890abcdef"
          }
        },
        "type": "object",
        "additionalProperties": false,
        "title": "API Key"
      },
      "UpdateAuthSecretRequestDto": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/UpdateBasicAuthSecretRequestDto"
          },
          {
            "$ref": "#/components/schemas/UpdateBearerAuthSecretRequestDto"
          },
          {
            "$ref": "#/components/schemas/UpdateApiKeyAuthSecretRequestDto"
          }
        ],
        "title": "Update Secret Request"
      },
      "UpdateSecretOpenAIRequestDto": {
        "properties": {
          "api_key": {
            "type": "string",
            "nullable": true,
            "description": "The API key for OpenAI/Azure OpenAI authentication.",
            "example": "sk-1234567890abcdef"
          },
          "model": {
            "type": "string",
            "description": "The OpenAI model to use",
            "example": "gpt-4"
          },
          "endpoint": {
            "type": "string",
            "description": "The OpenAI API endpoint URL",
            "example": "https://api.openai.com/v1"
          },
          "isStreaming": {
            "type": "boolean",
            "description": "Whether to use streaming for LLM responses",
            "example": true
          },
          "maxMessages": {
            "type": "number",
            "format": "double",
            "description": "Maximum number of messages to include in the conversation",
            "example": 100
          },
          "provider": {
            "type": "string",
            "enum": [
              "external-openai"
            ],
            "nullable": false,
            "description": "The provider type for OpenAI"
          }
        },
        "type": "object",
        "additionalProperties": false,
        "title": "OpenAI Configuration"
      },
      "UpdateSecretAzureOpenAIRequestDto": {
        "properties": {
          "api_key": {
            "type": "string",
            "nullable": true,
            "description": "The API key for OpenAI/Azure OpenAI authentication.",
            "example": "sk-1234567890abcdef"
          },
          "model": {
            "type": "string",
            "description": "The OpenAI model to use",
            "example": "gpt-4"
          },
          "endpoint": {
            "type": "string",
            "description": "The OpenAI API endpoint URL",
            "example": "https://api.openai.com/v1"
          },
          "isStreaming": {
            "type": "boolean",
            "description": "Whether to use streaming for LLM responses",
            "example": true
          },
          "maxMessages": {
            "type": "number",
            "format": "double",
            "description": "Maximum number of messages to include in the conversation",
            "example": 100
          },
          "provider": {
            "type": "string",
            "enum": [
              "external-azure-openai"
            ],
            "nullable": false,
            "description": "The provider type for Azure OpenAI"
          },
          "version": {
            "type": "string",
            "description": "The version of the Azure OpenAI API to use",
            "example": "2023-05-15"
          }
        },
        "type": "object",
        "additionalProperties": false
      },
      "UpdateSecretExternalLLMRequestDto": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/UpdateSecretOpenAIRequestDto"
          },
          {
            "$ref": "#/components/schemas/UpdateSecretAzureOpenAIRequestDto"
          }
        ]
      }
    },
    "securitySchemes": {
      "basic": {
        "type": "http",
        "scheme": "basic"
      }
    }
  },
  "x-readme": {
    "samples-languages": [
      "curl"
    ]
  }
}
```