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

# Patch ModuleInstance



## OpenAPI

````yaml https://api.ravion.com/openapi.yaml patch /module-instances/{id}
openapi: 3.0.0
info:
  title: Ravion
  version: 0.0.0
servers:
  - url: https://api.ravion.com
security:
  - BearerAuth: []
tags:
  - name: Projects
  - name: Environments
  - name: Pipelines
  - name: PipelineRuns
  - name: TerraformResources
  - name: TerraformExecutionSummaries
  - name: PipelineStepExecutions
  - name: AwsCloudWatch
  - name: PipelineVersions
  - name: Organizations
  - name: Stacks
  - name: StackWorkspaces
  - name: Auth
  - name: OAuth
  - name: User
  - name: Health
  - name: Memberships
  - name: ServiceAccounts
  - name: AwsDefaultNetworks
  - name: AwsAccounts
  - name: ApiKeys
  - name: ExecutionEnvironments
  - name: ModuleDefinitions
  - name: ModuleVersions
  - name: ModuleInstances
  - name: DefaultValueDefinitions
  - name: DefaultValues
  - name: CodeSources
  - name: Github
  - name: Gitlab
  - name: Git
  - name: Values
  - name: Deployments
  - name: DeploymentResources
  - name: InfrastructureEvents
  - name: WebSocket
  - name: Describe
paths:
  /module-instances/{id}:
    patch:
      tags:
        - ModuleInstances
      summary: Patch ModuleInstance
      operationId: PatchModuleInstance
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              description: >-
                Request body for updating resources, with optional
                update-visible properties
              properties:
                data:
                  additionalProperties: false
                  description: The template for adding optional properties.
                  properties:
                    autoapprove:
                      description: >-
                        Pass autoapprove=true to stack change pipeline runs
                        after config updates when supported.
                      type: boolean
                    description:
                      description: Optional description of the module instance.
                      maxLength: 1000
                      type: string
                    environmentId:
                      description: Environment ID where this instance is deployed
                      minLength: 1
                      type: string
                    givenId:
                      allOf:
                        - $ref: '#/components/schemas/GivenId'
                      description: >-
                        User-provided unique identifier. Must be unique within
                        environment.
                      maxLength: 255
                      minLength: 1
                    input:
                      additionalProperties:
                        nullable: true
                      description: Configuration input object for the module instance
                      type: object
                    moduleDefinitionId:
                      description: Module definition ID
                      minLength: 1
                      type: string
                    moduleVersionId:
                      description: Module version ID for the current configuration
                      minLength: 1
                      type: string
                    name:
                      description: User-provided instance name.
                      maxLength: 255
                      minLength: 1
                      type: string
                    runStack:
                      description: >-
                        Trigger a stack change pipeline run after module config
                        updates. Defaults to true.
                      type: boolean
                  type: object
              required:
                - data
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  data:
                    $ref: '#/components/schemas/ModuleInstance'
                required:
                  - data
                type: object
          description: The request has succeeded.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: The request is invalid or malformed.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: You are not authenticated
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: You do not have permission to access this resource.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: The server cannot find the requested resource.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: Client error
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: Server error
components:
  schemas:
    GivenId:
      description: User-provided identifier pattern used by all givenId fields
      maxLength: 60
      pattern: ^[a-zA-Z0-9][a-zA-Z0-9_-]*$
      type: string
    ModuleInstance:
      additionalProperties: false
      properties:
        createdAt:
          allOf:
            - $ref: '#/components/schemas/UtcDateTime'
          readOnly: true
        description:
          description: Optional description of the module instance.
          maxLength: 1000
          type: string
        environmentId:
          description: Environment ID where this instance is deployed
          minLength: 1
          type: string
        error:
          allOf:
            - $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: >-
            Structured error from the last failed delete; set only when status
            is ERROR_DELETING (read-only).
          readOnly: true
        givenId:
          allOf:
            - $ref: '#/components/schemas/GivenId'
          description: User-provided unique identifier. Must be unique within environment.
          maxLength: 255
          minLength: 1
        id:
          readOnly: true
          type: string
        input:
          additionalProperties:
            nullable: true
          description: Configuration input object for the module instance
          type: object
        moduleDefinitionId:
          description: Module definition ID
          minLength: 1
          type: string
        moduleVersionId:
          description: Module version ID for the current configuration
          minLength: 1
          type: string
        name:
          description: User-provided instance name.
          maxLength: 255
          minLength: 1
          type: string
        organizationId:
          readOnly: true
          type: string
        projectId:
          description: Project ID this instance belongs to.
          readOnly: true
          type: string
        stackId:
          description: Stack ID for the associated Terraform/OpenTofu stack
          readOnly: true
          type: string
        status:
          allOf:
            - $ref: '#/components/schemas/ModuleInstance.Status'
          description: Lifecycle status (read-only).
          readOnly: true
        type:
          description: >-
            Module type identifier, copied from the module definition at
            creation time.
          readOnly: true
          type: string
        ui:
          allOf:
            - $ref: '#/components/schemas/ModuleInstance.ResolvedModuleUI'
          description: >-
            Module UI configuration with template expressions resolved.
            Populated

            server-side at write time (create/patch + after every stack apply

            alongside `Stack.output`). Every field is optional and nullable
            because

            a freshly-created module instance has no stack output yet — fields
            that

            reference `<< stack.output.* >>` stay null until the first apply.
          readOnly: true
        updatedAt:
          allOf:
            - $ref: '#/components/schemas/UtcDateTime'
          readOnly: true
      required:
        - id
        - createdAt
        - updatedAt
        - organizationId
        - name
        - givenId
        - type
        - moduleDefinitionId
        - moduleVersionId
        - environmentId
        - projectId
        - status
        - input
      type: object
    Errors.UserFacingErrorData:
      additionalProperties: false
      description: |-
        User-facing error presentation data.
        This is what the API returns to the frontend after formatting ErrorData
        using CEL templates from the error registry.

        Used for both:
        - Error fields on domain models (e.g., PipelineRun.error)
        - API error response bodies (HTTP 4xx/5xx responses)
      properties:
        action:
          allOf:
            - $ref: '#/components/schemas/Errors.Action'
          description: Optional action to help resolve the error
        code:
          description: Full error code, e.g., "Ravion:Pipeline:NOT_FOUND"
          type: string
        description:
          description: Additional description with more details
          type: string
        details:
          description: Structured details rendered as user-facing sections.
          items:
            $ref: '#/components/schemas/Errors.UserFacingErrorDetailSection'
          type: array
        isInternal:
          description: >-
            Indicates whether this error is internal (only set when
            ShowInternal=true).

            This allows SUPERADMINs to identify internal errors while viewing
            full details.
          type: boolean
        message:
          description: Main error message (required)
          type: string
        metadata:
          additionalProperties: {}
          description: >-
            Error params/metadata. Stripped for internal errors unless
            superadmin.
          type: object
        requestId:
          description: Request ID for correlating errors with server logs.
          type: string
      required:
        - code
        - message
      type: object
    UtcDateTime:
      description: UTC RFC3339 timestamp with a required Z suffix
      format: date-time
      pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,9})?Z$
      type: string
      x-go-type: apitypes.UTCDateTime
      x-go-type-import:
        name: apitypes
        path: ravion/api-go/pkg/apitypes
    ModuleInstance.Status:
      description: >-
        Module instance lifecycle status. DELETING while a delete workflow runs,
        ERROR_DELETING if it fails.
      enum:
        - ACTIVE
        - DELETING
        - ERROR_DELETING
        - DELETED
      type: string
    ModuleInstance.ResolvedModuleUI:
      additionalProperties: false
      description: |-
        Resolved module UI configuration. Mirrors `Module.ModuleUI` but with all
        fields optional and nullable: the resolver writes this column at create
        time (before stack apply) and after every successful stack apply, and
        any field that depends on stack output stays null between create and the
        first apply.
      properties:
        links:
          items:
            $ref: '#/components/schemas/ModuleInstance.ResolvedUILink'
          nullable: true
          type: array
        logs:
          items:
            $ref: '#/components/schemas/ModuleInstance.ResolvedUILog'
          nullable: true
          type: array
        metrics:
          items:
            $ref: '#/components/schemas/ModuleInstance.ResolvedUIMetric'
          nullable: true
          type: array
      type: object
    Errors.Action:
      additionalProperties: false
      description: Action to help user resolve the error
      properties:
        label:
          description: Button/link label text
          type: string
        url:
          description: URL to navigate to for resolution
          type: string
      required:
        - label
        - url
      type: object
    Errors.UserFacingErrorDetailSection:
      additionalProperties: false
      description: Structured user-facing error detail section.
      properties:
        items:
          description: List of detail values for this section.
          items:
            type: string
          type: array
        object:
          additionalProperties: {}
          description: Structured detail payload for object rendering.
          type: object
        render:
          description: Rendering hint for clients. Valid values are list or object.
          type: string
        title:
          description: Detail section title shown in the UI.
          type: string
      required:
        - title
        - render
      type: object
    ModuleInstance.ResolvedUILink:
      additionalProperties: false
      description: |-
        Resolved UI link. All fields optional and nullable because the resolver
        leaves stack-output-dependent fields unresolved until a successful stack
        apply re-resolves them.
      properties:
        href:
          nullable: true
          type: string
        name:
          nullable: true
          type: string
      type: object
    ModuleInstance.ResolvedUILog:
      additionalProperties: false
      description: |-
        Resolved UI log. All fields optional and nullable so a log source can be
        displayed only after its CloudWatch source has concrete stack outputs.
      properties:
        id:
          nullable: true
          type: string
        name:
          nullable: true
          type: string
        source:
          allOf:
            - $ref: '#/components/schemas/ModuleInstance.ResolvedLogSource'
          nullable: true
      type: object
    ModuleInstance.ResolvedUIMetric:
      additionalProperties: false
      description: |-
        Resolved UI metric. All fields optional and nullable so a metric can be
        displayed even when its source still points at unresolved stack outputs.
      properties:
        id:
          nullable: true
          type: string
        name:
          nullable: true
          type: string
        source:
          allOf:
            - $ref: '#/components/schemas/ModuleInstance.ResolvedMetricSource'
          nullable: true
        type:
          allOf:
            - $ref: '#/components/schemas/Module.MetricType'
          nullable: true
      type: object
    ModuleInstance.ResolvedLogSource:
      additionalProperties: false
      description: |-
        Resolved CloudWatch log source. All fields optional and nullable —
        stack-output-dependent fields stay null until a successful stack apply
        triggers re-resolution.
      properties:
        aws_account_id:
          nullable: true
          type: string
        filter_pattern:
          nullable: true
          type: string
        log_group:
          nullable: true
          type: string
        log_stream_prefix:
          nullable: true
          type: string
        region:
          nullable: true
          type: string
        type:
          enum:
            - cloudwatch
          nullable: true
          type: string
      type: object
    ModuleInstance.ResolvedMetricSource:
      additionalProperties: false
      description: |-
        Resolved CloudWatch metric source. All fields optional and nullable —
        stack-output-dependent fields stay null until a successful stack apply
        triggers re-resolution.
      properties:
        aws_account_id:
          nullable: true
          type: string
        dimensions:
          additionalProperties:
            nullable: true
            type: string
          nullable: true
          type: object
        name:
          nullable: true
          type: string
        namespace:
          nullable: true
          type: string
        region:
          nullable: true
          type: string
        statistic:
          nullable: true
          type: string
        type:
          enum:
            - cloudwatch
          nullable: true
          type: string
      type: object
    Module.MetricType:
      description: Allowed metric chart types.
      enum:
        - line
        - bar
      type: string
  securitySchemes:
    BearerAuth:
      scheme: Bearer
      type: http

````