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

# Replace collection settings

> Replaces the collection's retrieval settings.



## OpenAPI

````yaml /openapi/source/external/collections/collections.json put /ai/collections/{uuid}/settings
openapi: 3.1.0
info:
  version: 1.0.0
  title: Telnyx API
  x-latency-category: interactive
  x-endpoint-cost: light
  description: >-
    Create and manage AI Collections — logical, searchable groupings of your
    Telnyx product data (voice, meeting bot, and message sources).


    A collection defines *what* data is searchable and *how* it is retrieved.
    You create a collection, attach one or more sources to it, tune its
    retrieval settings, and then run vector or hybrid search scoped to that
    collection. Every collection is automatically scoped to your organization —
    identity is derived from your Telnyx API key and cannot be overridden.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
    description: Telnyx API v2
security:
  - bearerAuth: []
tags:
  - name: AI Collections
    description: >-
      Create and manage logical collections of your Telnyx data, tune retrieval
      settings, manage sources, and run collection-scoped semantic search.
paths:
  /ai/collections/{uuid}/settings:
    put:
      tags:
        - AI Collections
      summary: Replace collection settings
      description: Replaces the collection's retrieval settings.
      operationId: ReplaceCollectionSettings
      parameters:
        - $ref: '#/components/parameters/Uuid'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SettingsRequest'
      responses:
        '200':
          description: The updated settings.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SettingsEnvelope'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          description: >-
            Validation error -- unsupported `retrieval_type`
            (`unsupported_retrieval_type`) or `top_k` out of range 1-50
            (`invalid_top_k`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
              example:
                errors:
                  - code: unsupported_retrieval_type
                    title: Unsupported retrieval type
                    detail: >-
                      retrieval_type 'semantic' is not supported. Supported
                      types: 'hybrid', 'vector'.
                    meta:
                      pointer: /retrieval/retrieval_type
      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 SettingsEnvelope = await
            client.ai.collections.settings.create('uuid', {
              retrieval: 'retrieval',
            });


            console.log(SettingsEnvelope.data);
        - 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
            )
            settings_envelope = client.ai.collections.settings.create(
                uuid="uuid",
                retrieval="retrieval",
            )
            print(settings_envelope.data)
        - 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\tsetting, err := client.AI.Collections.Settings.New(\n\t\tcontext.TODO(),\n\t\t\"uuid\",\n\t\ttelnyx.AICollectionSettingNewParams{\n\t\t\tRetrieval: telnyx.String(\"retrieval\"),\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", setting.Data)\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.collections.settings.SettingCreateParams;


            public final class Main {
                private Main() {}

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

                    SettingCreateParams params = SettingCreateParams.builder()
                        .retrieval("retrieval")
                        .build();
                    var response = client.ai().collections().settings().create("uuid", params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


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


            settings_envelope = telnyx.ai.collections.settings.create("uuid",
            retrieval: "retrieval")


            puts(settings_envelope)
        - 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 {
              $settings_envelope = $client->ai->collections->settings->create(
                'uuid',
                retrieval: 'retrieval',
              );

              var_dump($settings_envelope);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx ai:collections:settings create \
              --api-key 'My API Key' \
              --uuid 6a09ccbd-8f9b-4c3a-9b0e-2f1d3c4b5a6e \
              --retrieval retrieval
components:
  parameters:
    Uuid:
      name: uuid
      in: path
      required: true
      description: The collection's unique identifier.
      schema:
        type: string
        format: uuid
        example: 6a09ccbd-8f9b-4c3a-9b0e-2f1d3c4b5a6e
  schemas:
    SettingsRequest:
      type: object
      properties:
        retrieval:
          $ref: '#/components/schemas/RetrievalSettings'
    SettingsEnvelope:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/RetrievalSettingsWrapper'
    Errors:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
    RetrievalSettings:
      type: object
      description: How documents are retrieved when searching the collection.
      properties:
        top_k:
          type: integer
          description: Number of top results to retrieve (1–50).
          minimum: 1
          maximum: 50
          default: 5
          example: 5
        retrieval_type:
          type: string
          description: >-
            Retrieval strategy. `vector` runs semantic similarity search;
            `hybrid` combines vector similarity with keyword matching; `keyword`
            runs lexical (BM25) matching.
          enum:
            - vector
            - hybrid
            - keyword
          default: vector
          example: vector
    RetrievalSettingsWrapper:
      type: object
      properties:
        record_type:
          type: string
          description: Identifies the record type. Always `ai_collection_settings`.
          example: ai_collection_settings
          readOnly: true
        retrieval:
          $ref: '#/components/schemas/RetrievalSettings'
    Error:
      type: object
      properties:
        code:
          type: string
        title:
          type: string
        detail:
          type: string
        meta:
          type: object
          additionalProperties: true
          properties:
            pointer:
              type: string
              description: >-
                JSON Pointer to the request field that caused the error. Present
                on field-level validation and conflict errors.
              example: /slug
  responses:
    BadRequest:
      description: The request was malformed or failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Errors'
          example:
            errors:
              - code: '10015'
                title: Bad Request
                detail: The request failed because it was not well-formed.
                meta:
                  url: https://developers.telnyx.com/docs/overview/errors/10015
    Unauthorized:
      description: Missing or invalid authentication.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Errors'
          example:
            errors:
              - code: '10009'
                title: Authentication failed
                detail: >-
                  The required authentication headers were either invalid or not
                  included in the request.
                meta:
                  url: https://developers.telnyx.com/docs/overview/errors/10009
    NotFound:
      description: The requested resource does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Errors'
          example:
            errors:
              - code: collection_not_found
                title: Collection not found
                detail: >-
                  No collection with uuid 'b3b1c8a2-9f4e-4d2a-9c1e-2f7a6d5b4c3a'
                  exists for this account.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Telnyx API key. Collections and results are automatically scoped to the
        authenticated user's organization.

````