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

# Create Connection

> Creates a new connection with validation, duplicate checking, and OAuth2 processing.

Args:
    current_user: Authenticated user profile
    session: Database session
    connection_data: Connection creation data

Returns:
    dict: Status message with connection ID or OAuth2 redirect URL

Raises:
    HTTPException: If connection already exists or validation fails



## OpenAPI

````yaml post /v1/connections/applications
openapi: 3.1.0
info:
  title: WxO Server API
  summary: API for the next gen watsonx Orchestrate stack
  description: >+

    The watsonx Orchestrate Server provides a set of APIs to power the watsonx
    Orchestrate AI assistant. This includes the following core services:


    * Orchestrate Assistant - a built-in AI assistant that powers the
    Orchestrate end-user experience.

    * Custom Assistants - a service layer for interacting with existing AI
    assistatns (such as those in watsonx Assistant).

    * Message Threads - a chat history and async message tracking store.

    * Document Store - manage collections of documents in nearly any format
    including text, pdf, html and many more.

    * Information Extraction - automatically extract clean text and images from
    any document in the Document Store.  Also extract other useful metadata like
    questions answered, keywords, and named entities.

    * Embedding - generate vector embeddings for text and images in the Document
    Store.

    * Vector Index and Retrieval - automatically index documents with rich
    metadata for vector search or hybrid search.

    * Search Engine - create a Gen AI powered search engine that works like Bing
    or Google.

    * Query Engine - configure your own RAG (Retrieval Augmented Generation)
    engine supporting advanced retrieval patterns and automated data management.

    * Model Proxy - create your own LLM model endpoints for chat completions and
    embeddings.  Supports IBM watsonx.ai, IBM BAM, OpenAI, MistralAI, or Ollama
    for local models.


    WxO API Server utilizes the following open source projects:


    * [PostgreSQL](https://www.postgresql.org/)

    * [PGVector](https://github.com/pgvector/pgvector)

    * [LlamaIndex](https://docs.llamaindex.ai/en/stable/)

    * [LangChain](https://python.langchain.com/docs/get_started/introduction)

    * [FastAPI](https://fastapi.tiangolo.com/)

    * [Unstructured](https://unstructured.io/)

    * [Celery](https://docs.celeryproject.org/en/stable/)

  version: 0.1.0
servers:
  - url: https://{api_endpoint}
    description: version
security: []
paths:
  /v1/connections/applications:
    post:
      tags:
        - Connections
      summary: Create Connection
      description: >-
        Creates a new connection with validation, duplicate checking, and OAuth2
        processing.


        Args:
            current_user: Authenticated user profile
            session: Database session
            connection_data: Connection creation data

        Returns:
            dict: Status message with connection ID or OAuth2 redirect URL

        Raises:
            HTTPException: If connection already exists or validation fails
      operationId: Create_Connection_v1_connections_applications_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateConnection'
              properties:
                appid:
                  type: string
                  description: Application ID for the connection.
                connection_type:
                  type: string
                  enum:
                    - basic_auth
                    - bearer_token
                    - api_key_auth
                    - oauth2_auth_code
                    - oauth2_implicit
                    - oauth2_password
                    - oauth2_client_creds
                    - key_value_creds
                  description: >-
                    Type of connection. Must match one of the supported
                    authentication methods.
                credentials:
                  properties:
                    username:
                      type: string
                      description: Username for basic authentication.
                    password:
                      type: string
                      description: Password for basic authentication.
                    api_key:
                      type: string
                      description: API key for API key authentication.
                    client_id:
                      type: string
                      description: Client ID for OAuth2 flows.
                    client_secret:
                      type: string
                      description: Client Secret for OAuth2 flows.
                    well_known_url:
                      type: string
                      format: uri
                      description: URL for OAuth2 discovery.
                    scope:
                      type: string
                      description: >-
                        Optional scope for OAuth2. Defaults to `openid` if not
                        provided.
                  type: object
                  required:
                    - client_id
                    - client_secret
                    - well_known_url
                  description: Authentication credentials for the connection.
                shared:
                  type: boolean
                  description: Whether the connection is shared. Defaults to `true`.
                  default: true
              type: object
              required:
                - appid
                - connection_type
                - credentials
                - shared
            examples:
              basic_auth:
                description: Basic authentication example.
                value:
                  appid: my-app-id
                  connection_type: basic_auth
                  credentials:
                    username: my-username
                    password: my-password
                  shared: true
              bearer_token:
                description: Bearer token authentication example.
                value:
                  appid: my-app-id
                  connection_type: bearer_token
                  credentials:
                    token: my-bearer-token
                  shared: true
              api_key_auth:
                description: API key authentication example.
                value:
                  appid: my-app-id
                  connection_type: api_key_auth
                  credentials:
                    api_key: my-api-key
                  shared: true
              oauth2_auth_code:
                description: OAuth2 Authorization Code flow example.
                value:
                  appid: my-app-id
                  connection_type: oauth2_auth_code
                  credentials:
                    client_id: my-client-id
                    client_secret: my-client-secret
                    well_known_url: https://example.com/.well-known/openid-configuration
                    scope: profile email openid
                  shared: true
              oauth2_implicit:
                description: OAuth2 Implicit flow example.
                value:
                  appid: my-app-id
                  connection_type: oauth2_implicit
                  credentials:
                    client_id: my-client-id
                    well_known_url: https://example.com/.well-known/openid-configuration
                    scope: profile email openid
                  shared: true
              oauth2_password:
                description: OAuth2 Password Grant flow example.
                value:
                  appid: my-app-id
                  connection_type: oauth2_password
                  credentials:
                    client_id: my-client-id
                    client_secret: my-client-secret
                    username: user@example.com
                    password: user-password
                    well_known_url: https://example.com/.well-known/openid-configuration
                    scope: profile email openid
                  shared: true
              oauth2_client_creds:
                description: >-
                  OAuth2 Client Credentials flow example with default `openid`
                  scope.
                value:
                  appid: my-app-id
                  connection_type: oauth2_client_creds
                  credentials:
                    client_id: my-client-id
                    client_secret: my-client-secret
                    well_known_url: https://example.com/.well-known/openid-configuration
                    scope: openid
                  shared: true
              key_value_creds:
                description: Key value authentication example.
                value:
                  appid: my-app-id
                  connection_type: key_value_creds
                  credentials:
                    key: value
                  shared: true
        required: true
      responses:
        '200':
          description: Connection created successfully.
          content:
            application/json:
              schema:
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                    example: Connection created successfully.
                  connection_id:
                    type: string
                    example: 123e4567-e89b-12d3-a456-426614174000
                additionalProperties: true
                type: object
                title: Response Create Connection V1 Connections Applications Post
        '400':
          description: 'Bad Request: Invalid input.'
        '409':
          description: 'Conflict: Connection already exists.'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    CreateConnection:
      properties:
        appid:
          type: string
          title: Appid
          description: Application ID or application  name
        connection_type:
          $ref: '#/components/schemas/ConnectionTypeEnum'
          description: Type of connection
        credentials:
          additionalProperties: true
          type: object
          title: Credentials
          description: Credentials as a JSON object
        shared:
          type: boolean
          title: Shared
          description: Whether the connection is shared, default is true
          default: true
      type: object
      required:
        - appid
        - connection_type
        - credentials
      title: CreateConnection
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ConnectionTypeEnum:
      type: string
      enum:
        - basic_auth
        - bearer_token
        - api_key_auth
        - oauth2_auth_code
        - oauth2_implicit
        - oauth2_password
        - oauth2_client_creds
        - key_value_creds
      title: ConnectionTypeEnum
    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:
    HTTPBearer:
      type: http
      scheme: bearer

````