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

# Create Workflow Connection

> Create a piece connection in the caller's workflow project.

Thin proxy to the workflow engine's app-connection upsert. The engine's
schema validates the per-type ``value`` shape; a bad piece or value is
surfaced as a 4xx via ``_handle_ap_error``.

For OAuth2 types the caller must already hold an authorization ``code``
(obtained via the panel's browser redirect flow); this endpoint only
forwards the ``value`` it is given.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/workflow/connections
openapi: 3.1.0
info:
  title: Diga API
  version: 0.1.0
servers:
  - url: https://api.diga.io
    description: Production
security: []
paths:
  /v1/workflow/connections:
    post:
      tags:
        - Workflows
      summary: Create Workflow Connection
      description: |-
        Create a piece connection in the caller's workflow project.

        Thin proxy to the workflow engine's app-connection upsert. The engine's
        schema validates the per-type ``value`` shape; a bad piece or value is
        surfaced as a 4xx via ``_handle_ap_error``.

        For OAuth2 types the caller must already hold an authorization ``code``
        (obtained via the panel's browser redirect flow); this endpoint only
        forwards the ``value`` it is given.
      operationId: create_workflow_connection_v1_workflow_connections_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWorkflowConnectionRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowConnectionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - CustomHTTPBearer: []
components:
  schemas:
    CreateWorkflowConnectionRequest:
      properties:
        piece_name:
          type: string
          title: Piece Name
          description: Piece identifier the connection is for, e.g. `piece-slack`.
        display_name:
          type: string
          title: Display Name
          description: Human label shown in the panel
        type:
          $ref: '#/components/schemas/WorkflowConnectionType'
        value:
          additionalProperties: true
          type: object
          title: Value
          description: >-
            Type-specific credential fields (secret_text | username+password |
            props | OAuth2 fields). `type` is injected server-side.
      type: object
      required:
        - piece_name
        - display_name
        - type
      title: CreateWorkflowConnectionRequest
      description: Create a piece connection. `value` shape depends on `type`.
    WorkflowConnectionResponse:
      properties:
        id:
          type: string
          title: Id
          description: Referenced inside a step as {{connections['<id>']}}
        display_name:
          type: string
          title: Display Name
        piece_name:
          type: string
          title: Piece Name
        status:
          type: string
          title: Status
          description: ACTIVE | ERROR. A missing connection is absent from the response.
      type: object
      required:
        - id
        - display_name
        - piece_name
        - status
      title: WorkflowConnectionResponse
      description: A workflow piece connection (credential).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    WorkflowConnectionType:
      type: string
      enum:
        - OAUTH2
        - PLATFORM_OAUTH2
        - CLOUD_OAUTH2
        - SECRET_TEXT
        - BASIC_AUTH
        - CUSTOM_AUTH
        - NO_AUTH
      title: WorkflowConnectionType
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    CustomHTTPBearer:
      type: http
      scheme: bearer

````