> ## 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.

# Update a route connection

> Updates a connection's fields without changing its provider or team.

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


## OpenAPI

````yaml patch /v1/routes/connections/{connection_id}
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/{connection_id}:
    parameters:
      - $ref: '#/components/parameters/connection_id'
    patch:
      summary: Updates a connection
      description: >-
        Updates the connection's fields. The provider and owning team are
        immutable; point the connection at a new team secret to change its API
        key, or rotate the key itself by updating the secret.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateRouteConnectionRequestV1'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RouteConnectionV1'
      x-codeSamples:
        - lang: bash
          source: |-
            curl --request PATCH \
            --url https://api.baseten.co/v1/routes/connections/{connection_id} \
            --header "Authorization: Bearer $BASETEN_API_KEY" \
            --data '{
              "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/{connection_id}"

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

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

            print(response.text)
components:
  parameters:
    connection_id:
      schema:
        type: string
      name: connection_id
      in: path
      required: true
  schemas:
    UpdateRouteConnectionRequestV1:
      additionalProperties: false
      properties:
        config:
          description: >-
            Complete new connection configuration, replacing the current one.
            The provider must match the connection and is immutable.
          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: UpdateRouteConnectionRequestV1
      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.

````