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

# Rename a model route

> Renames a route in one transaction: every target, and the route's
route-group memberships (BCP-4580). Renaming target by target through
`PUT /admin/model-mappings/{id}` still works, but leaves the route split
across two names until the last PUT lands, and moves the memberships on the
first one.



## OpenAPI

````yaml /api-reference/openapi.yaml post /api/llm-gateway/admin/model-routes/rename
openapi: 3.1.0
info:
  title: Barndoor.ai Public API
  description: Unified public API specification for Barndoor.ai platform
  version: 2.18.0
servers:
  - url: https://{host}
    description: Barndoor public API
    variables:
      host:
        default: platform.barndoor.ai
        description: >-
          The host serving your Barndoor deployment. Defaults to production;
          override it for another environment or a dedicated deployment.
security:
  - ApiKey: []
  - OAuth2:
      - openid
      - profile
      - email
tags:
  - name: dlp
    x-group: Data Control Center
  - name: identity
    x-group: Identity
  - name: llm-gateway
    x-group: LLM Gateway
  - name: notification
    x-group: Notifications
  - name: policy
    x-group: Policies
  - name: registry
    x-group: MCP Gateway
  - name: system-management
    x-group: Log Exports
paths:
  /api/llm-gateway/admin/model-routes/rename:
    post:
      tags:
        - llm-gateway
      summary: Rename a model route
      description: >-
        Renames a route in one transaction: every target, and the route's

        route-group memberships (BCP-4580). Renaming target by target through

        `PUT /admin/model-mappings/{id}` still works, but leaves the route split

        across two names until the last PUT lands, and moves the memberships on
        the

        first one.
      operationId: rename_model_route
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RenameModelRouteRequest'
        required: true
      responses:
        '200':
          description: The route was renamed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RenameModelRouteResponse'
        '400':
          description: Malformed request
        '401':
          description: Missing or invalid credentials
        '403':
          description: Caller is not permitted to act on this resource in this organization
        '404':
          description: No route has this name in this organization
        '409':
          description: Another route already has the new name
components:
  schemas:
    RenameModelRouteRequest:
      type: object
      description: |-
        `POST /admin/model-routes/rename`: rename a route in one step — every
        target, and the route's route-group memberships with it (BCP-4580).
      required:
        - model_alias
        - new_model_alias
      properties:
        change_note:
          type:
            - string
            - 'null'
          description: >-
            Optional note explaining the rename (BCP-3998), stamped on every
            target.
        model_alias:
          type: string
          description: The route's current name.
        new_model_alias:
          type: string
          description: |-
            The new name. Any name no other route uses, including the name of a
            model one of its targets points at.
    RenameModelRouteResponse:
      type: object
      required:
        - model_alias
        - targets_renamed
        - route_group_memberships_moved
        - token_budgets_retargeted
        - rate_limit_policies_retargeted
        - model_access_policies_retargeted
        - governance_targets_kept
      properties:
        governance_targets_kept:
          type: integer
          format: int64
          description: >-
            Budgets, rate limits and model-access policies that stayed on the
            old

            name, because a model enablement or routing policy still answers to

            it. Nonzero means those rows no longer apply to this route.
          minimum: 0
        model_access_policies_retargeted:
          type: integer
          format: int64
          description: How many model-access policies had a target renamed.
          minimum: 0
        model_alias:
          type: string
        rate_limit_policies_retargeted:
          type: integer
          format: int64
          description: How many rate-limit policies now target the new name.
          minimum: 0
        route_group_memberships_moved:
          type: integer
          format: int64
          description: How many route-group memberships moved to the new name.
          minimum: 0
        targets_renamed:
          type: integer
          format: int64
          description: How many route targets were renamed.
          minimum: 0
        token_budgets_retargeted:
          type: integer
          format: int64
          description: |-
            How many token budgets now target the new name. Their usage so far
            this period moved with them.
          minimum: 0
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      description: >-
        A Barndoor API key, sent as `Authorization: Bearer <key>`. Keys are
        prefixed `bdai_` and are opaque — do not attempt to decode one.
        Interchangeable with an OAuth 2.0 access token.
    OAuth2:
      type: oauth2
      x-issuer: https://auth.barndoor.ai/realms/barndoor
      description: >-
        An OAuth 2.0 access token from Barndoor's identity provider, sent as
        `Authorization: Bearer <token>`. Public clients must use PKCE.
        Interchangeable with an API key.
      flows:
        authorizationCode:
          authorizationUrl: >-
            https://auth.barndoor.ai/realms/barndoor/protocol/openid-connect/auth
          tokenUrl: >-
            https://auth.barndoor.ai/realms/barndoor/protocol/openid-connect/token
          scopes:
            openid: Issue an OIDC ID token identifying the caller.
            profile: Read the caller's basic profile claims.
            email: Read the caller's email address.
            offline_access: Issue a refresh token. Optional — no operation requires it.
        clientCredentials:
          tokenUrl: >-
            https://auth.barndoor.ai/realms/barndoor/protocol/openid-connect/token
          scopes:
            openid: Issue an OIDC ID token identifying the caller.
            profile: Read the caller's basic profile claims.
            email: Read the caller's email address.
            offline_access: Issue a refresh token. Optional — no operation requires it.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.