> ## Documentation Index
> Fetch the complete documentation index at: https://docs.insforge.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Update secret

> Update an existing secret's value or metadata



## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/secrets.yaml put /api/secrets/{key}
openapi: 3.0.3
info:
  title: Insforge Secrets API
  version: 1.0.0
  description: >-
    Secure secrets management for storing API keys, tokens, and sensitive
    configuration
servers: []
security: []
paths:
  /api/secrets/{key}:
    put:
      tags:
        - Admin
      summary: Update secret
      description: Update an existing secret's value or metadata
      parameters:
        - name: key
          in: path
          required: true
          schema:
            type: string
            pattern: ^[A-Z0-9_]+$
          description: Secret key identifier
          example: STRIPE_API_KEY
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                value:
                  type: string
                  description: New secret value (will be encrypted)
                isActive:
                  type: boolean
                  description: Whether the secret is active
                isReserved:
                  type: boolean
                  description: Whether the secret is protected from deletion
                expiresAt:
                  type: string
                  format: date-time
                  nullable: true
                  description: Expiration date (null to remove expiration)
      responses:
        '200':
          description: Secret updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
              example:
                success: true
                message: Secret STRIPE_API_KEY has been updated successfully
        '404':
          description: Secret not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: NOT_FOUND
                message: 'Secret not found: INVALID_KEY'
                statusCode: 404
        '500':
          description: Failed to update secret
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: INTERNAL_ERROR
                message: 'Failed to update secret: STRIPE_API_KEY'
                statusCode: 500
      security:
        - bearerAuth: []
components:
  schemas:
    ErrorResponse:
      type: object
      required:
        - error
        - message
        - statusCode
      properties:
        error:
          type: string
          description: Error code for programmatic handling
          example: INVALID_INPUT
        message:
          type: string
          description: Human-readable error message
          example: Invalid input data
        statusCode:
          type: integer
          description: HTTP status code
          example: 400
        nextActions:
          type: string
          description: Suggested action to resolve the error
          example: Check the request body format
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````