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

# Update a secret's data

> Replace all data in an existing K8s secret.



## OpenAPI

````yaml put /api/app/{app_id}/secrets/{secret_name}
openapi: 3.1.0
info:
  title: Nx1 AI API
  description: |

    AI API for Nx1 Data Platform Management and Automated Data Tasks.

    Authentication is required via PSK in Authorization header.

    Default PSK is | [ask a friend] |
  version: 0.10.2
servers: []
security: []
paths:
  /api/app/{app_id}/secrets/{secret_name}:
    put:
      tags:
        - App manager
      summary: Update a secret's data
      description: Replace all data in an existing K8s secret.
      operationId: update_secret_api_app__app_id__secrets__secret_name__put
      parameters:
        - name: app_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: App Id
        - name: secret_name
          in: path
          required: true
          schema:
            type: string
            title: Secret Name
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSecretRequest'
      responses:
        '200':
          description: Secret updated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SecretDetailResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden - Requires an `nx1_app_manager` role.
        '404':
          description: Secret not found.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    UpdateSecretRequest:
      properties:
        data:
          items:
            $ref: '#/components/schemas/SecretKeyValue'
          type: array
          title: Data
          description: New key-value pairs, replacing all existing ones.
      type: object
      required:
        - data
      title: UpdateSecretRequest
      description: Request model for updating an existing K8s secret's data.
    SecretDetailResponse:
      properties:
        secret_name:
          type: string
          title: Secret Name
          description: User-facing name of the secret.
        k8s_name:
          type: string
          title: K8S Name
          description: K8s resource name.
        data:
          items:
            $ref: '#/components/schemas/SecretKeyValue'
          type: array
          title: Data
          description: Key-value pairs. NexusOne masks the values as `****`.
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
          description: Secret creation timestamp in ISO 8601 format.
      type: object
      required:
        - secret_name
        - k8s_name
      title: SecretDetailResponse
      description: Detail view of a secret with masked values.
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
          description: A brief description of the error that occurred.
        code:
          type: integer
          title: Code
          description: The HTTP status code associated with the error.
          default: 500
      type: object
      required:
        - error
      title: ErrorResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SecretKeyValue:
      properties:
        key:
          type: string
          title: Key
          description: The key name.
        value:
          type: string
          title: Value
          description: The secret value. NexusOne might mask this as `****`.
      type: object
      required:
        - key
        - value
      title: SecretKeyValue
      description: A single key-value pair within a secret.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2AuthorizationCodeBearer:
      type: oauth2
      flows:
        authorizationCode:
          scopes: {}
          authorizationUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/auth
          tokenUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/token
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization-PSK

````