> ## Documentation Index
> Fetch the complete documentation index at: https://infisical-platfor-532.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Update

> Update Secret Validation Rule



## OpenAPI

````yaml PATCH /api/v1/projects/{projectId}/secret-validation-rules/{ruleId}
openapi: 3.0.3
info:
  title: Infisical API
  description: List of all available APIs that can be consumed
  version: 0.0.1
servers:
  - url: https://us.infisical.com
    description: Production server (US)
  - url: https://eu.infisical.com
    description: Production server (EU)
  - url: http://localhost:8080
    description: Local server
security: []
paths:
  /api/v1/projects/{projectId}/secret-validation-rules/{ruleId}:
    patch:
      tags:
        - Secret Validation Rules
      description: Update Secret Validation Rule
      operationId: updateSecretValidationRule
      parameters:
        - schema:
            type: string
          in: path
          name: projectId
          required: true
          description: The ID of the project the secret validation rule belongs to.
        - schema:
            type: string
            format: uuid
          in: path
          name: ruleId
          required: true
          description: The ID of the secret validation rule to update.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 100
                  description: The name of the secret validation rule.
                description:
                  type: string
                  maxLength: 500
                  nullable: true
                  description: An optional description of the secret validation rule.
                environmentSlug:
                  type: string
                  minLength: 1
                  nullable: true
                  description: >-
                    The slug of the environment this rule is scoped to. Omit to
                    leave the current scope unchanged; pass `null` to make the
                    rule apply to every environment in the project.
                secretPath:
                  type: string
                  minLength: 1
                  description: The secret path this rule is scoped to.
                rule:
                  anyOf:
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - static-secrets
                          description: >-
                            The kind of secret the rule applies to. Determines
                            which fields the rule accepts and where the
                            constraints are enforced: `static-secrets`
                            constraints run on write, while `dynamic-secrets`
                            and `secret-rotations` constraints shape the
                            generated credential.
                        constraints:
                          type: array
                          items:
                            type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - min-length
                                  - max-length
                                  - regex-pattern
                                  - required-prefix
                                  - required-suffix
                                  - prevent-value-reuse
                                description: >-
                                  The kind of check this constraint performs,
                                  e.g. `min-length`, `regex-pattern`,
                                  `required-prefix`, or `prevent-value-reuse`.
                                example: min-length
                              appliesTo:
                                type: string
                                enum:
                                  - key
                                  - value
                                description: >-
                                  What the constraint checks: the secret key or
                                  the secret value.
                                example: value
                              value:
                                type: string
                                description: >-
                                  The value the constraint is checked against,
                                  e.g. the minimum length, the regex pattern, or
                                  the required prefix/suffix string.
                                example: '8'
                            required:
                              - type
                              - appliesTo
                              - value
                            additionalProperties: false
                          minItems: 1
                          description: >-
                            The constraints enforced by this rule. Each
                            constraint names what it checks (`type`), what it
                            applies to (`appliesTo`), and its `value`, e.g. the
                            minimum character count for `min-length` or the
                            pattern for `regex-pattern`.
                      required:
                        - type
                        - constraints
                      additionalProperties: false
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - dynamic-secrets
                          description: >-
                            The kind of secret the rule applies to. Determines
                            which fields the rule accepts and where the
                            constraints are enforced: `static-secrets`
                            constraints run on write, while `dynamic-secrets`
                            and `secret-rotations` constraints shape the
                            generated credential.
                        providers:
                          type: array
                          items:
                            type: string
                            enum:
                              - sql-database
                              - milvus
                          minItems: 1
                          description: >-
                            The dynamic secret providers this rule applies to. A
                            lease is only constrained when its provider is
                            listed here.
                        constraints:
                          type: array
                          items:
                            type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - min-length
                                  - max-length
                                  - regex-pattern
                                  - required-prefix
                                  - required-suffix
                                description: >-
                                  The kind of check this constraint performs,
                                  e.g. `min-length`, `regex-pattern`, or
                                  `required-prefix`.
                                example: min-length
                              appliesTo:
                                type: string
                                enum:
                                  - password
                                description: >-
                                  What the constraint checks: the generated
                                  credential.
                                example: password
                              value:
                                type: string
                                description: >-
                                  The value the constraint is checked against,
                                  e.g. the minimum length, the regex pattern, or
                                  the required prefix/suffix string.
                                example: '8'
                            required:
                              - type
                              - appliesTo
                              - value
                            additionalProperties: false
                          minItems: 1
                          description: >-
                            The constraints enforced by this rule. Each
                            constraint names what it checks (`type`), what it
                            applies to (`appliesTo`), and its `value`, e.g. the
                            minimum character count for `min-length` or the
                            pattern for `regex-pattern`.
                      required:
                        - type
                        - providers
                        - constraints
                      additionalProperties: false
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - secret-rotations
                          description: >-
                            The kind of secret the rule applies to. Determines
                            which fields the rule accepts and where the
                            constraints are enforced: `static-secrets`
                            constraints run on write, while `dynamic-secrets`
                            and `secret-rotations` constraints shape the
                            generated credential.
                        providers:
                          type: array
                          items:
                            type: string
                            enum:
                              - postgres-credentials
                          minItems: 1
                          description: >-
                            The secret rotation providers this rule applies to.
                            A rotation is only constrained when its provider is
                            listed here.
                        constraints:
                          type: array
                          items:
                            type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - min-length
                                  - max-length
                                  - regex-pattern
                                  - required-prefix
                                  - required-suffix
                                description: >-
                                  The kind of check this constraint performs,
                                  e.g. `min-length`, `regex-pattern`, or
                                  `required-prefix`.
                                example: min-length
                              appliesTo:
                                type: string
                                enum:
                                  - password
                                description: >-
                                  What the constraint checks: the generated
                                  credential.
                                example: password
                              value:
                                type: string
                                description: >-
                                  The value the constraint is checked against,
                                  e.g. the minimum length, the regex pattern, or
                                  the required prefix/suffix string.
                                example: '8'
                            required:
                              - type
                              - appliesTo
                              - value
                            additionalProperties: false
                          minItems: 1
                          description: >-
                            The constraints enforced by this rule. Each
                            constraint names what it checks (`type`), what it
                            applies to (`appliesTo`), and its `value`, e.g. the
                            minimum character count for `min-length` or the
                            pattern for `regex-pattern`.
                      required:
                        - type
                        - providers
                        - constraints
                      additionalProperties: false
                  description: >-
                    The rule configuration: which secret type it targets and the
                    constraints to enforce. Replaces the existing configuration
                    as a whole, or omits to leave it untouched.
                isActive:
                  type: boolean
                  description: Whether the secret validation rule is active.
              additionalProperties: false
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  rule:
                    allOf:
                      - type: object
                        properties:
                          id:
                            type: string
                            format: uuid
                          name:
                            type: string
                          description:
                            type: string
                            nullable: true
                          projectId:
                            type: string
                          envId:
                            type: string
                            format: uuid
                            nullable: true
                          secretPath:
                            type: string
                          isActive:
                            type: boolean
                            default: true
                          createdAt:
                            type: string
                            format: date-time
                          updatedAt:
                            type: string
                            format: date-time
                        required:
                          - id
                          - name
                          - projectId
                          - secretPath
                          - createdAt
                          - updatedAt
                      - anyOf:
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - static-secrets
                                description: >-
                                  The kind of secret the rule applies to.
                                  Determines which fields the rule accepts and
                                  where the constraints are enforced:
                                  `static-secrets` constraints run on write,
                                  while `dynamic-secrets` and `secret-rotations`
                                  constraints shape the generated credential.
                              constraints:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    type:
                                      type: string
                                      enum:
                                        - min-length
                                        - max-length
                                        - regex-pattern
                                        - required-prefix
                                        - required-suffix
                                        - prevent-value-reuse
                                      description: >-
                                        The kind of check this constraint
                                        performs, e.g. `min-length`,
                                        `regex-pattern`, `required-prefix`, or
                                        `prevent-value-reuse`.
                                      example: min-length
                                    appliesTo:
                                      type: string
                                      enum:
                                        - key
                                        - value
                                      description: >-
                                        What the constraint checks: the secret
                                        key or the secret value.
                                      example: value
                                    value:
                                      type: string
                                      description: >-
                                        The value the constraint is checked
                                        against, e.g. the minimum length, the
                                        regex pattern, or the required
                                        prefix/suffix string.
                                      example: '8'
                                  required:
                                    - type
                                    - appliesTo
                                    - value
                                  additionalProperties: false
                                minItems: 1
                                description: >-
                                  The constraints enforced by this rule. Each
                                  constraint names what it checks (`type`), what
                                  it applies to (`appliesTo`), and its `value`,
                                  e.g. the minimum character count for
                                  `min-length` or the pattern for
                                  `regex-pattern`.
                            required:
                              - type
                              - constraints
                            additionalProperties: false
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - dynamic-secrets
                                description: >-
                                  The kind of secret the rule applies to.
                                  Determines which fields the rule accepts and
                                  where the constraints are enforced:
                                  `static-secrets` constraints run on write,
                                  while `dynamic-secrets` and `secret-rotations`
                                  constraints shape the generated credential.
                              providers:
                                type: array
                                items:
                                  type: string
                                  enum:
                                    - sql-database
                                    - milvus
                                minItems: 1
                                description: >-
                                  The dynamic secret providers this rule applies
                                  to. A lease is only constrained when its
                                  provider is listed here.
                              constraints:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    type:
                                      type: string
                                      enum:
                                        - min-length
                                        - max-length
                                        - regex-pattern
                                        - required-prefix
                                        - required-suffix
                                      description: >-
                                        The kind of check this constraint
                                        performs, e.g. `min-length`,
                                        `regex-pattern`, or `required-prefix`.
                                      example: min-length
                                    appliesTo:
                                      type: string
                                      enum:
                                        - password
                                      description: >-
                                        What the constraint checks: the
                                        generated credential.
                                      example: password
                                    value:
                                      type: string
                                      description: >-
                                        The value the constraint is checked
                                        against, e.g. the minimum length, the
                                        regex pattern, or the required
                                        prefix/suffix string.
                                      example: '8'
                                  required:
                                    - type
                                    - appliesTo
                                    - value
                                  additionalProperties: false
                                minItems: 1
                                description: >-
                                  The constraints enforced by this rule. Each
                                  constraint names what it checks (`type`), what
                                  it applies to (`appliesTo`), and its `value`,
                                  e.g. the minimum character count for
                                  `min-length` or the pattern for
                                  `regex-pattern`.
                            required:
                              - type
                              - providers
                              - constraints
                            additionalProperties: false
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - secret-rotations
                                description: >-
                                  The kind of secret the rule applies to.
                                  Determines which fields the rule accepts and
                                  where the constraints are enforced:
                                  `static-secrets` constraints run on write,
                                  while `dynamic-secrets` and `secret-rotations`
                                  constraints shape the generated credential.
                              providers:
                                type: array
                                items:
                                  type: string
                                  enum:
                                    - postgres-credentials
                                minItems: 1
                                description: >-
                                  The secret rotation providers this rule
                                  applies to. A rotation is only constrained
                                  when its provider is listed here.
                              constraints:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    type:
                                      type: string
                                      enum:
                                        - min-length
                                        - max-length
                                        - regex-pattern
                                        - required-prefix
                                        - required-suffix
                                      description: >-
                                        The kind of check this constraint
                                        performs, e.g. `min-length`,
                                        `regex-pattern`, or `required-prefix`.
                                      example: min-length
                                    appliesTo:
                                      type: string
                                      enum:
                                        - password
                                      description: >-
                                        What the constraint checks: the
                                        generated credential.
                                      example: password
                                    value:
                                      type: string
                                      description: >-
                                        The value the constraint is checked
                                        against, e.g. the minimum length, the
                                        regex pattern, or the required
                                        prefix/suffix string.
                                      example: '8'
                                  required:
                                    - type
                                    - appliesTo
                                    - value
                                  additionalProperties: false
                                minItems: 1
                                description: >-
                                  The constraints enforced by this rule. Each
                                  constraint names what it checks (`type`), what
                                  it applies to (`appliesTo`), and its `value`,
                                  e.g. the minimum character count for
                                  `min-length` or the pattern for
                                  `regex-pattern`.
                            required:
                              - type
                              - providers
                              - constraints
                            additionalProperties: false
                required:
                  - rule
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 400
                  message:
                    type: string
                  error:
                    type: string
                  details: {}
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 401
                  message:
                    type: string
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
        '403':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 403
                  message:
                    type: string
                  details: {}
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 404
                  message:
                    type: string
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
        '422':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 422
                  message: {}
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - error
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 500
                  message:
                    type: string
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false

````