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

# Create a route connection

> Creates a team's connection to an upstream provider.

<Note>
  This endpoint is in beta. The request and response structure may change before it's generally available.
</Note>


## OpenAPI

````yaml post /v1/routes/connections
openapi: 3.1.0
info:
  description: REST API for management of Baseten resources
  title: Baseten management API
  version: 1.0.0
servers:
  - url: https://api.baseten.co
security:
  - BearerAuth: []
paths:
  /v1/routes/connections:
    post:
      summary: Creates a connection
      description: Creates a connection from the team to an upstream provider.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRouteConnectionRequestV1'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RouteConnectionV1'
      x-codeSamples:
        - lang: bash
          source: |-
            curl --request POST \
            --url https://api.baseten.co/v1/routes/connections \
            --header "Authorization: Bearer $BASETEN_API_KEY" \
            --data '{
              "team_id": "abc1234",
              "config": {
                "provider": "ANTHROPIC",
                "secret_id": "abc1234"
              }
            }'
        - lang: python
          source: |-
            import requests
            import os
            API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
            url = "https://api.baseten.co/v1/routes/connections"

            headers = {"Authorization": f"Bearer {API_KEY}"}

            response = requests.request(
                "POST",
                url,
                headers=headers,
                json={'team_id': 'abc1234', 'config': {'provider': 'ANTHROPIC', 'secret_id': 'abc1234'}}
            )

            print(response.text)
components:
  schemas:
    CreateRouteConnectionRequestV1:
      additionalProperties: false
      properties:
        team_id:
          anyOf:
            - minLength: 1
              type: string
            - type: 'null'
          default: null
          description: Identifier of the team that owns the connection.
          examples:
            - abc1234
          title: Team Id
        config:
          description: >-
            Provider the connection authenticates with, and the team secret
            holding its API key.
          discriminator:
            mapping:
              ANTHROPIC: '#/components/schemas/UpsertRouteConnectionConfigAnthropicV1'
              OPENAI: '#/components/schemas/UpsertRouteConnectionConfigOpenAIV1'
              XAI: '#/components/schemas/UpsertRouteConnectionConfigXAIV1'
            propertyName: provider
          examples:
            - provider: ANTHROPIC
              secret_id: abc1234
          oneOf:
            - $ref: '#/components/schemas/UpsertRouteConnectionConfigAnthropicV1'
            - $ref: '#/components/schemas/UpsertRouteConnectionConfigOpenAIV1'
            - $ref: '#/components/schemas/UpsertRouteConnectionConfigXAIV1'
          title: Config
      required:
        - config
      title: CreateRouteConnectionRequestV1
      type: object
    RouteConnectionV1:
      properties:
        id:
          description: Stable connection identifier.
          title: Id
          type: string
        team_id:
          description: Identifier of the team that owns the connection.
          title: Team Id
          type: string
        config:
          description: >-
            Provider the connection authenticates with, and the team secret
            holding its API key.
          discriminator:
            mapping:
              ANTHROPIC: '#/components/schemas/RouteConnectionConfigAnthropicV1'
              OPENAI: '#/components/schemas/RouteConnectionConfigOpenAIV1'
              XAI: '#/components/schemas/RouteConnectionConfigXAIV1'
            propertyName: provider
          oneOf:
            - $ref: '#/components/schemas/RouteConnectionConfigAnthropicV1'
            - $ref: '#/components/schemas/RouteConnectionConfigOpenAIV1'
            - $ref: '#/components/schemas/RouteConnectionConfigXAIV1'
          title: Config
        created_at:
          description: Creation time, ISO 8601.
          format: date-time
          title: Created At
          type: string
        updated_at:
          description: Last update time, ISO 8601.
          format: date-time
          title: Updated At
          type: string
      required:
        - id
        - team_id
        - config
        - created_at
        - updated_at
      title: RouteConnectionV1
      type: object
    UpsertRouteConnectionConfigAnthropicV1:
      additionalProperties: false
      properties:
        provider:
          const: ANTHROPIC
          description: Provider kind for Anthropic.
          title: Provider
          type: string
        secret_id:
          description: >-
            Identifier of an existing secret, owned by the same team, that holds
            the provider API key.
          minLength: 1
          title: Secret Id
          type: string
      required:
        - provider
        - secret_id
      title: UpsertRouteConnectionConfigAnthropicV1
      type: object
    UpsertRouteConnectionConfigOpenAIV1:
      additionalProperties: false
      properties:
        provider:
          const: OPENAI
          description: Provider kind for OpenAI.
          title: Provider
          type: string
        secret_id:
          description: >-
            Identifier of an existing secret, owned by the same team, that holds
            the provider API key.
          minLength: 1
          title: Secret Id
          type: string
      required:
        - provider
        - secret_id
      title: UpsertRouteConnectionConfigOpenAIV1
      type: object
    UpsertRouteConnectionConfigXAIV1:
      additionalProperties: false
      properties:
        provider:
          const: XAI
          description: Provider kind for xAI.
          title: Provider
          type: string
        secret_id:
          description: >-
            Identifier of an existing secret, owned by the same team, that holds
            the provider API key.
          minLength: 1
          title: Secret Id
          type: string
      required:
        - provider
        - secret_id
      title: UpsertRouteConnectionConfigXAIV1
      type: object
    RouteConnectionConfigAnthropicV1:
      properties:
        provider:
          const: ANTHROPIC
          description: Provider kind for Anthropic.
          title: Provider
          type: string
        secret_id:
          description: Identifier of the team secret holding the provider API key.
          title: Secret Id
          type: string
        secret_name:
          description: Name of the team secret holding the provider API key.
          title: Secret Name
          type: string
      required:
        - provider
        - secret_id
        - secret_name
      title: RouteConnectionConfigAnthropicV1
      type: object
    RouteConnectionConfigOpenAIV1:
      properties:
        provider:
          const: OPENAI
          description: Provider kind for OpenAI.
          title: Provider
          type: string
        secret_id:
          description: Identifier of the team secret holding the provider API key.
          title: Secret Id
          type: string
        secret_name:
          description: Name of the team secret holding the provider API key.
          title: Secret Name
          type: string
      required:
        - provider
        - secret_id
        - secret_name
      title: RouteConnectionConfigOpenAIV1
      type: object
    RouteConnectionConfigXAIV1:
      properties:
        provider:
          const: XAI
          description: Provider kind for xAI.
          title: Provider
          type: string
        secret_id:
          description: Identifier of the team secret holding the provider API key.
          title: Secret Id
          type: string
        secret_name:
          description: Name of the team secret holding the provider API key.
          title: Secret Name
          type: string
      required:
        - provider
        - secret_id
        - secret_name
      title: RouteConnectionConfigXAIV1
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send `Authorization: Bearer <api_key>`. The legacy `Authorization:
        Api-Key <api_key>` scheme is also accepted.

````