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

# Create a Connection

> Open a connection to a source. Returns an access token to run future jobs.



## OpenAPI

````yaml /api-reference/v1.json post /connections
openapi: 3.0.4
info:
  title: Deck API
  description: "# Deck API makes it straightforward for users to connect to any portal securely and quickly.\r\n\r\n### Welcome! Looking for a quick introduction to our API? Check out the 🚀[Quickstart guide](https://docs.deck.co/guides/guides/quickstart).\r\n\r\nGetting started is easy:\r\n\r\n1. Create an account using the [dashboard](https://dashboard.deck.co) to get your client id and secret\r\n2. Enter your client id and secret in the Authentication section below\r\n3. Hit the \"Try\" buttons below for each endpoint.\r\n\r\nHappy querying!"
  contact:
    name: Ready to start building? Contact us!
    url: https://deck.co
  version: v1
servers:
  - url: https://live.deck.co/api/v1
    description: Deck API
  - url: https://sandbox.deck.co/api/v1
    description: Deck Sandbox API (Enterprise only)
security: []
tags:
  - name: Agents
    description: Agent management
  - name: Connection
    description: Manage connections
  - name: Connections
    description: Endpoints for creating and managing workflow connections.
  - name: Decks
    description: Endpoints related to decks.
  - name: Jobs
    description: Endpoints related to jobs.
  - name: Sources
    description: Endpoints for managing and searching data sources
  - name: Link
    description: >-
      These endpoints are used by the Link widget. They can also be used for
      creating your own UX experience and connecting data from utility data
      sources.
paths:
  /connections:
    post:
      tags:
        - Connections
      summary: Create a Connection
      description: >-
        Open a connection to a source. Returns an access token to run future
        jobs.
      requestBody:
        description: Connection creation request
        content:
          application/json:
            schema:
              allOf:
                - $ref: >-
                    #/components/schemas/Datadeck_Api_WebModels_Models_Api_V1_Connections_CreateConnectionRequest
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Datadeck_Api_WebModels_Models_Api_V1_Connections_ConnectionResponse
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Datadeck_Api_WebModels_Models_Api_V1_Connections_ConnectionErrorResponse
        '401':
          description: Unauthorized - Invalid API key
      security:
        - client_id: []
          secret: []
components:
  schemas:
    Datadeck_Api_WebModels_Models_Api_V1_Connections_CreateConnectionRequest:
      required:
        - auth_method
        - source_id
      type: object
      properties:
        source_id:
          type: string
          format: uuid
        auth_method:
          minLength: 1
          type: string
        auth_credentials:
          allOf:
            - $ref: >-
                #/components/schemas/Datadeck_Api_WebModels_Models_Api_V1_Connections_ConnectionCredentials
          nullable: true
        deck_id:
          type: string
          format: uuid
          nullable: true
      additionalProperties: false
    Datadeck_Api_WebModels_Models_Api_V1_Connections_ConnectionResponse:
      required:
        - auth_method
        - connection_id
        - created_at
        - source_id
        - status
        - updated_at
      type: object
      properties:
        connection_id:
          type: string
          format: uuid
        status:
          type: string
        source_id:
          type: string
          format: uuid
        auth_method:
          type: string
        access_token:
          type: string
          nullable: true
        created_at:
          type: integer
          format: int64
        updated_at:
          type: integer
          format: int64
      additionalProperties: false
    Datadeck_Api_WebModels_Models_Api_V1_Connections_ConnectionErrorResponse:
      required:
        - category
        - error_code
        - message
      type: object
      properties:
        error_code:
          type: string
        message:
          type: string
        category:
          type: string
        details:
          type: object
          additionalProperties: {}
          nullable: true
      additionalProperties: false
    Datadeck_Api_WebModels_Models_Api_V1_Connections_ConnectionCredentials:
      type: object
      properties:
        username:
          type: string
          nullable: true
        password:
          type: string
          nullable: true
      additionalProperties: false
  securitySchemes:
    client_id:
      type: apiKey
      description: Enter your client id
      name: x-deck-client-id
      in: header
    secret:
      type: apiKey
      description: Enter your secret
      name: x-deck-secret
      in: header

````