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

# Link a port

> Wires an exit of a step to a block, replacing whatever the port led to before. If other edits keep changing the workflow while the call saves, it returns 409 and writes nothing; read the workflow again and resend.



## OpenAPI

````yaml /specs-prettified/realtime/openapi.stable.json put /v2/stable/workflow/{workflowID}/step/{stepID}/link/{portKey}
openapi: 3.0.0
info:
  title: Realtime
  description: Realtime gateway API service
  version: 1.0.0
  contact: {}
servers:
  - url: https://realtime-api.voiceflow.com
security: []
tags: []
paths:
  /v2/stable/workflow/{workflowID}/step/{stepID}/link/{portKey}:
    put:
      tags:
        - Workflow
      summary: Link a port
      description: Wires an exit of a step to a block, replacing whatever the port led
        to before. If other edits keep changing the workflow while the call
        saves, it returns 409 and writes nothing; read the workflow again and
        resend.
      operationId: StableWorkflowController_linkV2
      parameters:
        - name: workflowID
          required: true
          in: path
          schema:
            type: string
          x-vf-doc:
            description: The ID of the workflow to operate on.
          description: The ID of the workflow to operate on.
        - name: stepID
          required: true
          in: path
          schema:
            type: string
          x-vf-doc:
            description: The ID of the step to operate on.
          description: The ID of the step to operate on.
        - name: portKey
          required: true
          in: path
          schema:
            type: string
          x-vf-doc:
            description: "The port to operate on: next, fail, else, no-reply, or the ID of a
              branch."
          description: "The port to operate on: next, fail, else, no-reply, or the ID of a
            branch."
        - name: projectID
          required: true
          in: query
          schema:
            type: string
            description: The ID of the project to operate on.
        - name: environmentAlias
          required: true
          in: query
          schema:
            type: string
            description: The alias of the environment to operate on (e.g. `main`).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StableWorkflowLinkRequest"
      responses:
        "200":
          description: Confirms the new link. Returns a message and the link; when a link
            was replaced, `replacedLink` and the message name the block the port
            led to before.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StableWorkflowLinkResponseV2"
          x-vf-doc:
            description: Confirms the new link. Returns a message and the link; when a link
              was replaced, `replacedLink` and the message name the block the
              port led to before.
      security:
        - token: []
components:
  schemas:
    StableWorkflowLinkRequest:
      type: object
      properties:
        toBlockID:
          type: string
          description: The block the port will lead to. Links point at blocks, never at a
            step inside one.
      required:
        - toBlockID
      additionalProperties: false
    StableWorkflowLinkResponseV2:
      type: object
      properties:
        message:
          type: string
        link:
          type: object
          properties:
            stepID:
              type: string
            port:
              type: string
            to:
              nullable: true
              description: The block the port leads to now, or null.
              type: string
          required:
            - stepID
            - port
            - to
        replacedLink:
          description: "Present when the port already led to another block: the link this
            call replaced."
          allOf:
            - $ref: "#/components/schemas/StableWorkflowReplacedLink"
      required:
        - message
        - link
    StableWorkflowReplacedLink:
      type: object
      properties:
        stepID:
          type: string
          description: The step whose port the call re-pointed.
        port:
          type: string
          description: The port key, for example fail or a branch ID.
        to:
          type: string
          description: The block the port led to before this call. It no longer leads there.
      required:
        - stepID
        - port
        - to
  securitySchemes:
    token:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Voiceflow bearer token
````
