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

# Roll Back To Version

> Make a published version the live one: the version new sessions run.
No version is created and the draft is not touched.



## OpenAPI

````yaml post /v1/agent/agents/{agent_id}/versions/{version_number}/rollback
openapi: 3.1.0
info:
  title: FishAudio OpenAPI
  version: '1'
servers:
  - description: Fish Audio API
    url: https://api.fish.audio
security: []
tags: []
paths:
  /v1/agent/agents/{agent_id}/versions/{version_number}/rollback:
    post:
      tags:
        - Agents
      summary: Roll Back To Version
      description: >-
        Make a published version the live one: the version new sessions run. The

        target can be older or newer than the current live version, so the same

        call switches back to the latest version after a rollback.


        Nothing is created and the draft is not touched: it keeps its current

        content, including unpublished edits (`GET /config` shows a
        `config_hash`

        different from the live version's if they differ). Sessions in progress

        keep the version they started on; new sessions and incoming calls use
        the

        target at once. Agent-level settings (name, description, public access,

        allowed origins, overridable fields) and data retention are not part of
        a

        version and do not move.


        Publishing after a rollback publishes the draft: if it differs from the

        live version, a new version is created with the next version_number.


        The response is `version` (the live version, `is_live: true`),

        `previous_version_number` and `changed`. If the target is already live,

        nothing is written and `changed` is `false`. Every change is recorded:
        see

        List Deployments.


        The body is optional:

        - `expected_live_version` switches only while that is the live version
          number. Take it from List Agent Versions. Otherwise the call returns 409
          with `reason: "live_changed"` and `live_version_number`. Nothing is
          written.
        - `reason` is stored on the deployment record.


        409 with `reason: "missing_references"` means the target version uses

        something that no longer exists: a knowledge source (deleted or
        archived,

        or its pinned revision) or an integration connection (deleted).
        `missing`

        lists each as `{type, id}`. Restore it or choose another version; the
        live

        version stays.
      parameters:
        - in: path
          name: agent_id
          description: ''
          required: true
          schema:
            title: Agent Id
            type: string
          deprecated: false
        - in: path
          name: version_number
          description: ''
          required: true
          schema:
            title: Version Number
            type: integer
          deprecated: false
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                expected_live_version:
                  type: integer
                  minimum: 1
                  description: >-
                    Switch only while this is the live version number. Otherwise
                    409 with reason `live_changed` and nothing is written.
                reason:
                  type: string
                  maxLength: 500
                  description: >-
                    Why the live version is moving. Kept on the deployment
                    record.
      responses:
        '200':
          description: Request fulfilled, document follows
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  version:
                    $ref: '#/components/schemas/PublicAgentVersionSummary'
                    description: 'The version that is live now (`is_live: true`).'
                  previous_version_number:
                    description: The version that was live before the call.
                    title: Previous Version Number
                    type: integer
                  changed:
                    description: >-
                      Whether the live version moved. False when the target was
                      already live; nothing is written then.
                    title: Changed
                    type: boolean
                required:
                  - version
                  - previous_version_number
                  - changed
                type: object
        '401':
          description: No permission -- see authorization schemes
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '404':
          description: Nothing matches the given URI
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '409':
          description: Request conflict
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '422':
          description: ''
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '503':
          description: The server cannot process the request due to a high load
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: bash
          label: Roll Back
          source: |-
            curl --request POST \
              --url https://api.fish.audio/v1/agent/agents/<agent-id>/versions/2/rollback \
              --header 'Authorization: Bearer <token>' \
              --header 'Content-Type: application/json' \
              --data '{
                "expected_live_version": 3,
                "reason": "The new booking tool returns 404 until the backend ships"
              }'
components:
  schemas:
    PublicAgentVersionSummary:
      properties:
        version_number:
          title: Version Number
          type: integer
        version_title:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Version Title
        version_description:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Version Description
        config_hash:
          title: Config Hash
          type: string
        published_at:
          format: date-time
          title: Published At
          type: string
        is_live:
          description: >-
            Whether this is the version new sessions run. Exactly one version of
            an agent is live, and after a rollback it is not necessarily the
            highest version_number.
          title: Is Live
          type: boolean
      required:
        - version_number
        - config_hash
        - published_at
        - is_live
      title: PublicAgentVersionSummary
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````

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