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

# Replace connection

> Repoints a specific workflow's usage from originalConnectionId to
newConnectionId. Both connections must belong to the caller's account; the
original connection itself is left intact and is not deleted by this call.



## OpenAPI

````yaml /developers/api-reference/openapi.json post /v1/connections/replace
openapi: 3.0.0
info:
  title: Engini API
  version: v1
  description: The Engini public API.
servers:
  - url: https://api.engini.io
security:
  - Bearer: []
  - ApiKey: []
tags:
  - name: Auth
    description: Identify the caller a Developer API request is authenticated as.
  - name: On-prem agents
    description: >-
      Provision and manage agents that run Engini tasks inside a customer's
      network.
  - name: Applications
    description: >-
      Discover the applications (toolkits) available in Engini and their
      connection requirements.
  - name: Tools
    description: Browse and execute the tools exposed by Engini applications.
  - name: Toolsets
    description: Manage toolsets - named groupings of connections and tools.
  - name: McpServers
    description: >-
      Inspect and maintain MCP servers - the account-wide endpoints that expose
      Engini tools and workflows over the Model Context Protocol. Distinct from
      the MCPClient connection kind, which is Engini consuming a third-party MCP
      server.
  - name: Connections
    description: >-
      Manage connections to applications, including OAuth sign-in and
      default-connection selection.
  - name: Triggers
    description: >-
      Create triggers that fire when something changes in a connected app, and
      manage the destinations their events are delivered to.
paths:
  /v1/connections/replace:
    post:
      tags:
        - Connections
      summary: Replace connection
      description: >-
        Repoints a specific workflow's usage from originalConnectionId to

        newConnectionId. Both connections must belong to the caller's account;
        the

        original connection itself is left intact and is not deleted by this
        call.
      operationId: Connections_ReplaceConnection
      parameters: []
      requestBody:
        x-name: request
        description: The replacement payload identifying the source and target connections.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReplaceConnectionRequest'
        required: true
        x-position: 1
      responses:
        '200':
          description: >-
            The per-activity replacement result when every activity replaced
            cleanly. Any
                        activity that could not be replaced (activity/object unavailable on the target) surfaces
                        as a 400 ErrorResponse instead - see ConnectionApiService.ReplaceConnection.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionReplaceResult'
        '400':
          description: Bad request - malformed body or invalid parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - missing or invalid bearer token or API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden - the caller lacks access to the resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found - the resource does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Too many requests - rate limit exceeded.
          headers:
            Retry-After:
              description: Number of seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error - an unexpected error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - Bearer: []
        - ApiKey: []
      x-codeSamples:
        - lang: python
          label: Python
          source: |-
            from engini import Engini

            client = Engini()  # reads ENGINI_API_KEY

            result = client.connections.replace(
                workflow_id=903, original_connection_id=481, new_connection_id=482
            )
        - lang: typescript
          label: TypeScript
          source: |-
            import { Engini } from "@engini/sdk";

            const client = new Engini(); // reads ENGINI_API_KEY

            const result = await client.connections.replace({
              workflowId: 903,
              originalConnectionId: 481,
              newConnectionId: 482,
            });
        - lang: bash
          label: CLI
          source: engini connections replace --workflow 903 --from 481 --to 482
components:
  schemas:
    ReplaceConnectionRequest:
      type: object
      description: Request body for replacing a connection used by a workflow.
      additionalProperties: false
      required:
        - workflowId
        - originalConnectionId
        - newConnectionId
      properties:
        workflowId:
          type: integer
          description: Identifier of the workflow whose connection is being replaced.
          format: int32
        originalConnectionId:
          type: integer
          description: Identifier of the connection currently used by the workflow.
          format: int32
        newConnectionId:
          type: integer
          description: Identifier of the connection to use instead.
          format: int32
    ConnectionReplaceResult:
      type: object
      description: >-
        Result of a connection replace across a workflow. Returned as the 200
        body from both

        WorkflowUIController.ReplaceWorkflowConnection (UI, always 200 + toast)
        and

        ConnectionsController.ReplaceConnection (Developer API, 200 only when
        every activity replaced

        cleanly - any skip outcome maps to a 400 ErrorResponse instead).
      additionalProperties: false
      required:
        - succeeded
        - activities
      properties:
        succeeded:
          type: boolean
          description: >-
            Overall success - true unless a caller-facing hard failure occurred
            upstream of replacement.
        activities:
          type: array
          description: Per-activity outcomes for every activity considered for the replace.
          items:
            $ref: '#/components/schemas/ConnectionReplaceActivityOutcome'
    ErrorResponse:
      type: object
      description: >-
        Unified machine-readable error envelope returned by every non-200
        Developer API response.
      additionalProperties: false
      required:
        - errorCode
        - message
        - requestId
        - timestamp
      properties:
        errorCode:
          type: string
          description: Machine-readable error code identifying the failure.
        message:
          type: string
          description: Human-readable error message.
        requestId:
          type: string
          description: Identifier of the request, for support/correlation.
        timestamp:
          type: string
          description: Timestamp when the error occurred (ISO 8601).
        details:
          type: array
          description: Per-field validation details, when applicable.
          nullable: true
          items:
            $ref: '#/components/schemas/ErrorDetail'
    ConnectionReplaceActivityOutcome:
      type: object
      description: One workflow activity's outcome within a ConnectionReplaceResult.
      additionalProperties: false
      required:
        - stepNo
        - activityName
        - outcome
        - strippedFields
        - removedFilterConditions
      properties:
        stepNo:
          type: integer
          description: The activity's step number within the workflow.
          format: int32
        activityName:
          type: string
          description: Display name of the activity.
        outcome:
          description: What happened to this activity during the replace.
          oneOf:
            - $ref: '#/components/schemas/ConnectionReplacementOutcome'
        missingObjectName:
          type: string
          description: >-
            Name of the object that was missing on the target connection, when
            applicable.
          nullable: true
        strippedFields:
          type: array
          description: Field names removed because they don't exist on the target object.
          items:
            type: string
        removedFilterConditions:
          type: array
          description: >-
            Filter/condition entries removed - reported separately since
            dropping a filter silently broadens the data the activity
            reads/writes.
          items:
            type: string
    ErrorDetail:
      type: object
      description: A single field-level error detail within an ErrorResponse.
      additionalProperties: false
      required:
        - field
        - issue
      properties:
        field:
          type: string
          description: Name of the field the issue relates to.
        issue:
          type: string
          description: Description of the issue with the field.
    ConnectionReplacementOutcome:
      type: integer
      description: >-
        Per-activity outcome of a connection replace/swap (batch: the UI
        workflow-settings replace and

        the public Connections/Replace endpoint both share this shape). Level 1
        (activity + object

        existence) blocks/skips an activity; Level 2 (field existence) never
        blocks - it only strips

        the missing fields and proceeds.
      x-enumNames:
        - Replaced
        - ReplacedWithStrippedFields
        - SkippedActivityUnavailable
        - SkippedObjectMissing
        - SkippedObjectSchemaUnavailable
        - SkippedDescribeFailed
      enum:
        - 0
        - 1
        - 2
        - 3
        - 4
        - 5
  securitySchemes:
    Bearer:
      type: http
      description: Enter your JWT token
      scheme: bearer
      bearerFormat: JWT
    ApiKey:
      type: apiKey
      description: >-
        Opaque Developer API key (prefix `eng_`). Authenticates as the key's
        owner and resolves the account automatically.
      name: x-api-key
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.