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

# Update Secret

> Updates an existing secret. You can update the name, value, description, or tags.



## OpenAPI

````yaml /api-reference/openapi.json patch /v1/projects/secrets/{id}
openapi: 3.0.1
info:
  title: Hamsa API
  description: Trying out our transcription and media-to-text APIs
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.tryhamsa.com
security: []
paths:
  /v1/projects/secrets/{id}:
    patch:
      summary: Update a Secret
      description: >-
        Updates an existing secret. You can update the name, value, description,
        or tags.
      parameters:
        - in: path
          name: id
          required: true
          description: The ID of the secret to update.
          schema:
            type: string
            example: ed9b5601-f731-441a-8500-d9fc7610ef8f
      requestBody:
        description: Request body containing the fields to update
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSecretRequestBody'
      responses:
        '200':
          description: Secret updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateSecretResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '409':
          description: Secret with the same name already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '500':
          description: Server Side Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    UpdateSecretRequestBody:
      type: object
      properties:
        name:
          type: string
          description: The new name for the secret.
          example: API_KEY_UPDATED
        value:
          type: string
          description: The new secret value.
          example: new-super-secret-value
        description:
          type: string
          description: The new description for the secret.
          example: Updated production API key
        tags:
          type: array
          description: The new tags for the secret.
          items:
            type: string
          example:
            - production
            - api
            - updated
    UpdateSecretResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: success
        data:
          type: object
          properties:
            id:
              type: string
              example: ed9b5601-f731-441a-8500-d9fc7610ef8f
            name:
              type: string
              example: API_KEY_UPDATED
            description:
              type: string
              example: Updated production API key
            tags:
              type: array
              items:
                type: string
              example:
                - production
                - api
                - updated
            lastAccessedAt:
              type: string
              nullable: true
              example: null
            createdAt:
              type: string
              example: '2024-12-15T00:00:00.000Z'
            updatedAt:
              type: string
              example: '2024-12-15T00:00:00.000Z'
    ErrorSchema:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Pass the API key in the Authorization header, You need to put Token
        keyword before the API key. e.g. 'Authorization: Token <api-key>'

````