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

# Update Canary Deploy

> Endpoint to update a canary deploy configuration for an assistant.

Updates the existing canary deploy configuration with new version IDs and percentages.
  All old versions and percentages are replaces by new ones from this request.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/ai/assistants.yml put /ai/assistants/{assistant_id}/canary-deploys
openapi: 3.1.0
info:
  title: Telnyx AI Assistants API
  version: 2.0.0
  description: >-
    API for managing AI Assistants, including CRUD fields, versions, tags,
    integrations, MCP servers, and shared tools.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /ai/assistants/{assistant_id}/canary-deploys:
    put:
      tags:
        - Assistants
      summary: Update Canary Deploy
      description: >-
        Endpoint to update a canary deploy configuration for an assistant.


        Updates the existing canary deploy configuration with new version IDs
        and percentages.
          All old versions and percentages are replaces by new ones from this request.
      operationId: update_canary_deploy_assistants__assistant_id__canary_deploys_put
      parameters:
        - name: assistant_id
          in: path
          required: true
          schema:
            type: string
            title: Assistant Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CanaryDeployRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CanaryDeployResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });


            const canaryDeployResponse = await
            client.ai.assistants.canaryDeploys.update('assistant_id');


            console.log(canaryDeployResponse.assistant_id);
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            canary_deploy_response = client.ai.assistants.canary_deploys.update(
                assistant_id="assistant_id",
            )
            print(canary_deploy_response.assistant_id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcanaryDeployResponse, err := client.AI.Assistants.CanaryDeploys.Update(\n\t\tcontext.TODO(),\n\t\t\"assistant_id\",\n\t\ttelnyx.AIAssistantCanaryDeployUpdateParams{\n\t\t\tCanaryDeploy: telnyx.CanaryDeployParam{},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", canaryDeployResponse.AssistantID)\n}\n"
        - lang: Java
          source: >-
            package com.telnyx.sdk.example;


            import com.telnyx.sdk.client.TelnyxClient;

            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

            import
            com.telnyx.sdk.models.ai.assistants.canarydeploys.CanaryDeploy;

            import
            com.telnyx.sdk.models.ai.assistants.canarydeploys.CanaryDeployResponse;

            import
            com.telnyx.sdk.models.ai.assistants.canarydeploys.CanaryDeployUpdateParams;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    CanaryDeployUpdateParams params = CanaryDeployUpdateParams.builder()
                        .assistantId("assistant_id")
                        .canaryDeploy(CanaryDeploy.builder().build())
                        .build();
                    CanaryDeployResponse canaryDeployResponse = client.ai().assistants().canaryDeploys().update(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


            telnyx = Telnyx::Client.new(api_key: "My API Key")


            canary_deploy_response =
            telnyx.ai.assistants.canary_deploys.update("assistant_id")


            puts(canary_deploy_response)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $canaryDeployResponse = $client->ai->assistants->canaryDeploys->update(
                'assistant_id',
                rules: [
                  [
                    'serve' => [
                      'rollout' => [['versionID' => 'version_id', 'weight' => 0]],
                      'versionID' => 'version_id',
                    ],
                    'match' => [
                      [
                        'attribute' => 'attribute',
                        'operator' => 'in',
                        'values' => ['string'],
                      ],
                    ],
                  ],
                ],
              );

              var_dump($canaryDeployResponse);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx ai:assistants:canary-deploys update \
              --api-key 'My API Key' \
              --assistant-id assistant_id
components:
  schemas:
    CanaryDeployRequest:
      properties:
        rules:
          title: Rules
          items:
            $ref: '#/components/schemas/Rule-Input'
          type: array
      type: object
      title: CanaryDeployRequest
      description: |-
        Create/update request body. Accepts:
        - ``rules`` — canonical ordered list of routing rules
    CanaryDeployResponse:
      properties:
        assistant_id:
          type: string
          title: Assistant Id
        rules:
          items:
            $ref: '#/components/schemas/Rule-Output'
          type: array
          title: Rules
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - assistant_id
        - rules
        - created_at
        - updated_at
      title: CanaryDeployResponse
      description: |-
        Response shape.

        Always carries ``rules`` (canonical).
    HTTPValidationError:
      title: HTTPValidationError
      type: object
      properties:
        detail:
          title: Detail
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    Rule-Input:
      properties:
        match:
          items:
            $ref: '#/components/schemas/Clause'
          type: array
          title: Match
        serve:
          $ref: '#/components/schemas/Serve'
      type: object
      required:
        - serve
      title: Rule
      description: |-
        A targeting rule: ``match`` clauses (AND) gate ``serve``.

        An empty ``match`` is a catch-all (always fires).
    Rule-Output:
      properties:
        match:
          items:
            $ref: '#/components/schemas/Clause'
          type: array
          title: Match
        serve:
          $ref: '#/components/schemas/Serve'
      type: object
      required:
        - serve
      title: Rule
      description: |-
        A targeting rule: ``match`` clauses (AND) gate ``serve``.

        An empty ``match`` is a catch-all (always fires).
    ValidationError:
      title: ValidationError
      required:
        - loc
        - msg
        - type
      type: object
      properties:
        loc:
          title: Location
          type: array
          items:
            anyOf:
              - type: string
              - type: integer
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
    Clause:
      properties:
        attribute:
          type: string
          title: Attribute
          description: Attribute name from the routing context
        operator:
          $ref: '#/components/schemas/Operator'
          description: Match operator
        values:
          items:
            type: string
          type: array
          minItems: 1
          title: Values
      type: object
      required:
        - attribute
        - operator
        - values
      title: Clause
      description: |-
        A single attribute/operator/values check.

        A clause matches when the routing context's value for ``attribute``
        satisfies ``operator`` against any of ``values``.
    Serve:
      properties:
        version_id:
          type: string
          title: Version Id
        rollout:
          title: Rollout
          items:
            $ref: '#/components/schemas/RolloutSlot'
          type: array
      type: object
      title: Serve
      description: |-
        What a rule serves when matched.

        Exactly one of:
        - ``version_id`` — serve a specific version
        - ``rollout`` — weighted random across versions; weights must sum to
          less than 100, with the leftover routing to the main version
    Operator:
      type: string
      enum:
        - in
        - not_in
        - starts_with
      title: Operator
    RolloutSlot:
      properties:
        version_id:
          type: string
          title: Version Id
        weight:
          type: number
          title: Weight
          minimum: 0
          maximum: 100
      type: object
      required:
        - version_id
        - weight
      title: RolloutSlot
      description: One slot in a percentage rollout.
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````