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

# Update a semantic router

> Replaces the router's configuration and presentation. Its catalogues are set with PUT /semantic-routers/{id}/catalogues.



## OpenAPI

````yaml /swagger/5.16/ai-studio-swagger.yml patch /semantic-routers/{id}
openapi: 3.0.1
info:
  title: Midsommar API
  description: This is the API for the Midsommar user and group management system.
  termsOfService: http://swagger.io/terms/
  contact:
    name: API Support
    url: http://www.swagger.io/support
    email: support@swagger.io
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: '1.0'
servers:
  - url: //localhost:8080/api/v1
security: []
paths:
  /semantic-routers/{id}:
    patch:
      tags:
        - semantic-routers
      summary: Update a semantic router
      description: >-
        Replaces the router's configuration and presentation. Its catalogues are
        set with PUT /semantic-routers/{id}/catalogues.
      parameters:
        - name: id
          in: path
          description: Semantic Router ID
          required: true
          schema:
            type: integer
      requestBody:
        description: Semantic router
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api.SemanticRouterInput'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.ErrorResponse'
        '402':
          description: Enterprise feature required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    api.SemanticRouterInput:
      type: object
      properties:
        data:
          type: object
          properties:
            attributes:
              $ref: '#/components/schemas/api.SemanticRouterAttributes'
            type:
              type: string
    api.ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              detail:
                type: string
              title:
                type: string
      description: Error response model
    api.SemanticRouterAttributes:
      type: object
      properties:
        active:
          type: boolean
          description: >-
            Active is the live switch. Omitted = inactive on create, unchanged
            on

            update. Setting it needs semantic-routers:publish.
        description:
          type: string
        embedder_id:
          type: integer
          description: >-
            EmbedderID is the embedder of the embedding stage (0 or omitted:
            none).

            A settings.embedding naming an LLM ({llm_id, model}) is still
            accepted

            and saved as the embedder linked to that LLM with that model.
        logo_url:
          type: string
        long_description:
          type: string
        name:
          type: string
        namespace:
          type: string
        routes:
          type: array
          items:
            $ref: '#/components/schemas/semanticrouting.Route'
        settings:
          $ref: '#/components/schemas/semanticrouting.Settings'
        short_description:
          type: string
          description: Portal presentation (the router is published in LLM catalogues).
        slug:
          type: string
        workspace_id:
          type: integer
          description: |-
            WorkspaceID places the router (create) or moves it (update);
            omitted = the landing rule / no move.
    semanticrouting.Route:
      type: object
      properties:
        description:
          type: string
          description: |-
            Description says what belongs on this route. The judge reads it, and
            the portal shows it.
        keywords:
          type: array
          description: Keywords decide the route outright when one matches.
          items:
            $ref: '#/components/schemas/semanticrouting.Keyword'
        name:
          type: string
          description: |-
            Name is the route's identifier ("complex", "code"): what the judge
            answers with and what "{router}/{route}" names.
        priority:
          type: integer
          description: Priority breaks ties between routes (higher first).
        target:
          $ref: '#/components/schemas/semanticrouting.Target'
        threshold:
          type: number
          description: >-
            Threshold is the similarity (0..1] the best example must reach for
            the

            route to be picked by the embedding stage. 0 means DefaultThreshold.
        utterances:
          type: array
          description: |-
            Utterances are example requests. The input is compared with each and
            the route scores its best match (cosine similarity).
          items:
            type: string
    semanticrouting.Settings:
      type: object
      properties:
        affinity:
          $ref: '#/components/schemas/semanticrouting.AffinitySettings'
        allow_explicit_route:
          type: boolean
        default_route:
          type: string
        embedding:
          $ref: '#/components/schemas/semanticrouting.ModelRef'
        input_scope:
          $ref: '#/components/schemas/semanticrouting.InputScope'
        judge:
          $ref: '#/components/schemas/semanticrouting.JudgeSettings'
        max_input_chars:
          type: integer
        mode:
          $ref: '#/components/schemas/semanticrouting.Mode'
    semanticrouting.Keyword:
      type: object
      properties:
        pattern:
          type: string
        regex:
          type: boolean
    semanticrouting.Target:
      type: object
      properties:
        llm_id:
          type: integer
        model:
          type: string
        model_router_id:
          type: integer
        type:
          $ref: '#/components/schemas/semanticrouting.TargetType'
    semanticrouting.AffinitySettings:
      type: object
      properties:
        enabled:
          type: boolean
        header:
          type: string
        ttl_seconds:
          type: integer
    semanticrouting.ModelRef:
      type: object
      properties:
        allow_internal_host:
          type: boolean
          description: |-
            AllowInternalHost is a standalone embedder's "Allow internal host"
            switch: its endpoint may be internal (netguard.ExemptionFor). A
            reference to an LLM uses the LLM's own switch.
        api_key_encrypted:
          type: string
        embedder_id:
          type: integer
        endpoint:
          type: string
        llm_id:
          type: integer
        model:
          type: string
        timeout_ms:
          type: integer
        vendor:
          type: string
    semanticrouting.InputScope:
      type: string
      enum:
        - last_user
        - all_user
      x-enum-varnames:
        - ScopeLastUser
        - ScopeAllUser
    semanticrouting.JudgeSettings:
      type: object
      properties:
        enabled:
          type: boolean
        model_ref:
          $ref: '#/components/schemas/semanticrouting.ModelRef'
        when:
          $ref: '#/components/schemas/semanticrouting.JudgeWhen'
    semanticrouting.Mode:
      type: string
      enum:
        - enforce
        - shadow
      x-enum-varnames:
        - ModeEnforce
        - ModeShadow
    semanticrouting.TargetType:
      type: string
      enum:
        - llm
        - model_router
      x-enum-varnames:
        - TargetLLM
        - TargetModelRouter
    semanticrouting.JudgeWhen:
      type: string
      enum:
        - always
        - low_confidence
      x-enum-varnames:
        - JudgeAlways
        - JudgeLowConfidence
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````