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

> ## Agent Instructions
> Treat Stackdome as an application-delivery platform for coding agents and developers, not as a Kubernetes dashboard.
> Prefer the Stackdome agent plugin as the user entry point and the stackdome CLI as the execution interface.
> Route agents who need the maintained deploy skill to npx skills add stackdome/skills and the complete operational workflow to /guides/ai-agents.
> Verify commands and flags with stackdome --help. Run stackdome init before authoring stackfile.yaml and stackdome validate before deploying.
> Use -o json for automation and verify documented terminal states before claiming success.
> Never request a user's account password. Use API-token authentication.
> During alpha, Stackdome Cloud is ephemeral and capacity-limited, and each organization can connect one cluster.
> Do not expose Kubernetes as a user concern unless the task is self-hosting or infrastructure architecture.

# Create stack connection



## OpenAPI

````yaml /openapi.yaml post /api/v1/organizations/{org_id}/projects/{project_name}/stacks/{id}/connections
openapi: 3.0.0
info:
  description: >-
    Deploy, debug, and operate applications through the Stackdome REST API on
    Stackdome Cloud or a self-hosted installation. This API is in alpha and may
    change before general availability.
  title: Stackdome API
  version: 0.0.1-alpha
servers:
  - url: /
security: []
paths:
  /api/v1/organizations/{org_id}/projects/{project_name}/stacks/{id}/connections:
    post:
      summary: Create stack connection
      parameters:
        - description: The ID of the organization
          explode: false
          in: path
          name: org_id
          required: true
          schema:
            type: string
          style: simple
        - description: The name of the project
          explode: false
          in: path
          name: project_name
          required: true
          schema:
            type: string
          style: simple
        - description: The id of record
          explode: false
          in: path
          name: id
          required: true
          schema:
            type: string
          style: simple
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StackConnection'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StackConnection'
          description: Stack connection created successfully
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Invalid request data
        '401':
          description: Unauthorized
        '404':
          description: Stack not found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Stack connection already exists
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Internal server error
      security:
        - Bearer: []
components:
  schemas:
    StackConnection:
      description: A user-authored topology edge between two nodes in a stack.
      example:
        mappings:
          - value:
              output: output
              template: template
              values:
                key:
                  output: output
            target:
              path: path
              name: name
              type: env
          - value:
              output: output
              template: template
              values:
                key:
                  output: output
            target:
              path: path
              name: name
              type: env
        kind: env
        from:
          name: name
          id: id
          type: stack_resource
        id: id
        to:
          name: name
          id: id
          type: stack_resource
        config: null
      properties:
        id:
          description: Stable connection identifier. Generated when omitted.
          type: string
        kind:
          description: >
            The relationship type. `env` injects values into environment
            variables, `volume_mount` mounts a volume into a resource, and
            `build_artifact_source` seeds a volume from build output.
          enum:
            - env
            - volume_mount
            - build_artifact_source
          type: string
        from:
          $ref: '#/components/schemas/TopologyNodeRef'
        to:
          $ref: '#/components/schemas/TopologyNodeRef'
        mappings:
          description: |
            Target/value mappings for kinds that move values, such as `env`.
          items:
            $ref: '#/components/schemas/ConnectionMapping'
          type: array
        config:
          $ref: '#/components/schemas/StackConnectionConfig'
      required:
        - from
        - kind
        - to
      type: object
    Error:
      allOf:
        - $ref: '#/components/schemas/ObjectReference'
        - $ref: '#/components/schemas/Error_allOf'
    TopologyNodeRef:
      description: Identifies a topology node within the stack graph.
      example:
        name: name
        id: id
        type: stack_resource
      properties:
        type:
          description: The node category.
          enum:
            - stack_resource
            - addon/postgres
            - secret
            - volume
            - object_store
          type: string
        id:
          description: Stable ID for persisted resources such as addons or secrets.
          type: string
        name:
          description: >-
            Name-scoped reference for stack-local resources such as
            StackResources or Volumes.
          type: string
      required:
        - type
      type: object
    ConnectionMapping:
      description: Maps one produced value into one target location on the consumer.
      example:
        value:
          output: output
          template: template
          values:
            key:
              output: output
        target:
          path: path
          name: name
          type: env
      properties:
        target:
          $ref: '#/components/schemas/ConnectionTarget'
        value:
          $ref: '#/components/schemas/ValueRef'
      required:
        - target
        - value
      type: object
    StackConnectionConfig:
      description: >
        Kind-specific connection configuration. The shape depends on the
        connection kind and source type: use PostgresEnvConfig when kind is env
        and from.type is addon/postgres, VolumeMountConfig when kind is
        volume_mount, and BuildArtifactSourceConfig when kind is
        build_artifact_source. Omit config entirely for env connections from
        stack_resource or secret sources.
      oneOf:
        - $ref: '#/components/schemas/PostgresEnvConfig'
        - $ref: '#/components/schemas/VolumeMountConfig'
        - $ref: '#/components/schemas/BuildArtifactSourceConfig'
    ObjectReference:
      properties:
        id:
          type: string
        kind:
          type: string
        href:
          type: string
      type: object
    Error_allOf:
      properties:
        code:
          type: string
        reason:
          type: string
        operation_id:
          type: string
        details:
          additionalProperties: true
          description: Optional structured, machine-readable error context
          type: object
      type: object
    ConnectionTarget:
      description: The destination field that receives a mapped value.
      example:
        path: path
        name: name
        type: env
      properties:
        type:
          description: >-
            env writes an environment variable and file writes a mounted file
            path.
          enum:
            - env
            - file
          type: string
        name:
          description: Environment variable name when type is env.
          type: string
        path:
          description: Absolute file path when type is file.
          type: string
      required:
        - type
      type: object
    ValueRef:
      description: >
        Describes how to read a value from the connection's `from` node. This is
        only used inside `StackConnection.mappings[]`.
      example:
        output: output
        template: template
        values:
          key:
            output: output
      properties:
        output:
          description: >-
            Output accessor on the connection's `from` node, such as `url` or
            `public_url`.
          type: string
        template:
          description: >-
            Template used when one target value must be composed from multiple
            outputs.
          type: string
        values:
          additionalProperties:
            $ref: '#/components/schemas/OutputValueRef'
          description: >-
            Named template inputs, each resolving one output from the
            connection's `from` node.
          type: object
      type: object
    PostgresEnvConfig:
      additionalProperties: false
      description: >
        Config for env connections from a PostgreSQL addon (kind=env,
        from.type=addon/postgres). credential_scope and superuser are mutually
        exclusive.
      properties:
        database:
          description: Target database name within the addon.
          type: string
        credential_scope:
          description: Which credential set to inject. Mutually exclusive with superuser.
          enum:
            - owner
            - superuser
          type: string
        superuser:
          description: Use superuser credentials. Mutually exclusive with credential_scope.
          type: boolean
      type: object
    VolumeMountConfig:
      additionalProperties: false
      description: Config for volume mount connections (kind=volume_mount).
      properties:
        mount_path:
          description: Absolute path where the volume is mounted in the container.
          type: string
        sub_path:
          description: Sub-path within the volume to mount.
          type: string
        read_only:
          description: Mount the volume read-only.
          type: boolean
      required:
        - mount_path
      type: object
    BuildArtifactSourceConfig:
      additionalProperties: false
      description: >-
        Config for build artifact source connections
        (kind=build_artifact_source).
      properties:
        source_path:
          description: Path within the build output to copy from.
          type: string
        destination_path:
          description: Path within the volume to copy to.
          type: string
      required:
        - source_path
      type: object
    OutputValueRef:
      description: References one output on the connection's `from` node.
      example:
        output: output
      properties:
        output:
          description: Output accessor on the connection's `from` node.
          type: string
      required:
        - output
      type: object
  securitySchemes:
    Bearer:
      bearerFormat: JWT
      scheme: bearer
      type: http

````