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

# Revert an agent to a previous version

> Re-applies a previously-recorded version's whole-definition snapshot (prompt + spec + tags + skills) onto the live agent, recording a new head version equal to the chosen one. Requires agent.edit.



## OpenAPI

````yaml https://app.cotool.ai/api/docs/openapi.json post /api/agents/{agentId}/versions/{versionId}/revert
openapi: 3.1.0
info:
  title: Cotool API
  version: 1.0.0
  description: >-
    # Cotool API Documentation


    The Cotool API allows you to interact with the Cotool platform
    programmatically, enabling you to build powerful integrations and automate
    your workflows.


    ## Getting an API Key


    Follow these steps to generate your API key:


    1. **Log in** to the Cotool web interface

    2. **Navigate** to `/settings/api-keys`

    3. **Click** "Generate Key"

    4. **Copy and store** your API key securely ⚠️ *It won't be shown again*


    ## API Key Authentication


    For programmatic access and integrations, use your API key with the
    Authorization header:


    ```http

    Authorization: Bearer your_api_key_here

    ```


    ```bash

    curl -X GET "https://app.cotool.ai/api/endpoint" \
      -H "Authorization: Bearer your_api_key_here" \
      -H "Content-Type: application/json"
    ```
servers:
  - url: https://app.cotool.ai
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /api/agents/{agentId}/versions/{versionId}/revert:
    post:
      tags:
        - Agent Versions
      summary: Revert an agent to a previous version
      description: >-
        Re-applies a previously-recorded version's whole-definition snapshot
        (prompt + spec + tags + skills) onto the live agent, recording a new
        head version equal to the chosen one. Requires agent.edit.
      parameters:
        - in: path
          name: agentId
          schema:
            type: string
            format: uuid
          required: true
        - in: path
          name: versionId
          schema:
            type: string
            format: uuid
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                  agentId:
                    type: string
                    format: uuid
                  definition:
                    type: object
                    properties:
                      name:
                        type: string
                      description:
                        type: string
                      tags:
                        type: array
                        items:
                          type: string
                      modelAlias: {}
                      planningMode:
                        type: string
                        enum:
                          - auto
                          - never
                          - always
                        description: >-
                          Planning behavior mode: auto (plan when needed), never
                          (skip planning), or always (always create a plan
                          first)
                      agentFilesystem:
                        type: boolean
                      toolNames:
                        type: array
                        items:
                          type: string
                      toolSelectionMode:
                        type: string
                        enum:
                          - manual
                          - all_read_only
                        description: >-
                          Tool selection behavior: manual uses the stored tool
                          list, all_read_only resolves all non-mutating tools at
                          runtime
                      slackReplyScope:
                        type: string
                        enum:
                          - anyone
                          - cotool_users
                        description: >-
                          Who may reply in a Slack thread to continue this
                          agent: anyone (any Slack user) or cotool_users (only
                          mapped Cotool users with execute permission)
                      toolActionConfigs:
                        type: array
                        items:
                          oneOf:
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: slack_sendMessage
                                allowedChannels:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      id:
                                        type: string
                                        minLength: 1
                                        description: >-
                                          Slack channel ID (for example
                                          C123ABC456)
                                      name:
                                        type: string
                                        minLength: 1
                                        description: 'Slack channel name without the leading #'
                                    required:
                                      - id
                                      - name
                                    additionalProperties: false
                                  minItems: 1
                                  description: >-
                                    Allowlist of Slack channels this agent may
                                    access when using this tool action
                                hideAgentButton:
                                  type: boolean
                                  description: >-
                                    When true, omits the "Open Agent Run in
                                    Cotool" button from Slack messages produced
                                    by this tool action. Defaults to false
                                    (button is shown).
                              required:
                                - type
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: slack_replyToThread
                                allowedChannels:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      id:
                                        type: string
                                        minLength: 1
                                        description: >-
                                          Slack channel ID (for example
                                          C123ABC456)
                                      name:
                                        type: string
                                        minLength: 1
                                        description: 'Slack channel name without the leading #'
                                    required:
                                      - id
                                      - name
                                    additionalProperties: false
                                  minItems: 1
                                  description: >-
                                    Allowlist of Slack channels this agent may
                                    access when using this tool action
                                hideAgentButton:
                                  type: boolean
                                  description: >-
                                    When true, omits the "Open Agent Run in
                                    Cotool" button from Slack messages produced
                                    by this tool action. Defaults to false
                                    (button is shown).
                              required:
                                - type
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: slack_readChannelMessages
                                allowedChannels:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      id:
                                        type: string
                                        minLength: 1
                                        description: >-
                                          Slack channel ID (for example
                                          C123ABC456)
                                      name:
                                        type: string
                                        minLength: 1
                                        description: 'Slack channel name without the leading #'
                                    required:
                                      - id
                                      - name
                                    additionalProperties: false
                                  minItems: 1
                                  description: >-
                                    Allowlist of Slack channels this agent may
                                    access when using this tool action
                              required:
                                - type
                                - allowedChannels
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: slack_readThreadMessages
                                allowedChannels:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      id:
                                        type: string
                                        minLength: 1
                                        description: >-
                                          Slack channel ID (for example
                                          C123ABC456)
                                      name:
                                        type: string
                                        minLength: 1
                                        description: 'Slack channel name without the leading #'
                                    required:
                                      - id
                                      - name
                                    additionalProperties: false
                                  minItems: 1
                                  description: >-
                                    Allowlist of Slack channels this agent may
                                    access when using this tool action
                              required:
                                - type
                                - allowedChannels
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  const: slack_waitForUserResponse
                                allowedChannels:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      id:
                                        type: string
                                        minLength: 1
                                        description: >-
                                          Slack channel ID (for example
                                          C123ABC456)
                                      name:
                                        type: string
                                        minLength: 1
                                        description: 'Slack channel name without the leading #'
                                    required:
                                      - id
                                      - name
                                    additionalProperties: false
                                  minItems: 1
                                  description: >-
                                    Allowlist of Slack channels this agent may
                                    access when using this tool action
                                hideAgentButton:
                                  type: boolean
                                  description: >-
                                    When true, omits the "Open Agent Run in
                                    Cotool" button from Slack messages produced
                                    by this tool action. Defaults to false
                                    (button is shown).
                                timeout:
                                  type: object
                                  properties:
                                    amount:
                                      type: integer
                                      exclusiveMinimum: 0
                                      description: >-
                                        Number of units to wait before an
                                        unanswered prompt times out.
                                    unit:
                                      type: string
                                      enum:
                                        - minutes
                                        - hours
                                        - days
                                      description: Unit for the timeout amount.
                                  required:
                                    - amount
                                    - unit
                                  additionalProperties: false
                                  description: >-
                                    Optional fixed timeout for unanswered
                                    prompts. When omitted, the agent decides how
                                    long to wait via the tool input (and waits
                                    indefinitely if it specifies nothing).
                              required:
                                - type
                              additionalProperties: false
                          description: Configuration for a specific tool action
                        description: >-
                          Optional per-tool-action configuration entries for the
                          agent
                      agentTools:
                        type: array
                        items:
                          type: object
                          properties:
                            sync_key:
                              type: string
                          required:
                            - sync_key
                      cliNames:
                        type: array
                        items:
                          type: string
                      skills:
                        type: array
                        items:
                          type: string
                      inputs:
                        type: array
                        items:
                          type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - text
                                - image
                                - pdf
                                - audio
                                - video
                              description: The type of input expected by the agent
                            name:
                              type: string
                              description: The name of the input field
                            description:
                              type: string
                              description: A description of what this input is used for
                            required:
                              type: boolean
                              description: >-
                                Whether this input is required for agent
                                execution
                          required:
                            - type
                            - name
                            - description
                            - required
                      acceptanceCriteria:
                        type: array
                        items:
                          type: string
                      contextDocs:
                        type: array
                        items:
                          type: object
                          properties:
                            provider:
                              type: string
                              enum:
                                - googleDocs
                                - notion
                                - confluence
                                - mcp
                            id:
                              type: string
                            name:
                              type: string
                            mimeType:
                              type: string
                          required:
                            - provider
                            - id
                            - name
                      triggers:
                        type: array
                        items:
                          type: object
                          properties:
                            source:
                              type: string
                              enum:
                                - cron
                                - webhook
                                - jira-automation
                                - jira
                                - slack
                                - linear
                                - email
                                - bugcrowd
                                - hackerone
                            sync_key:
                              type: string
                            name:
                              type: string
                            description:
                              type: string
                            enabled:
                              type: boolean
                            schedule:
                              type: string
                            events:
                              type: array
                              items:
                                type: string
                            jqlFilter:
                              type: string
                            issuePropertyKeysFilter:
                              type: array
                              items:
                                type: string
                            fieldIdsFilter:
                              type: array
                              items:
                                type: string
                            allowedChannelIds:
                              type: array
                              items:
                                type: string
                            allowedUserIds:
                              type: array
                              items:
                                type: string
                            allowedUsergroupIds:
                              type: array
                              items:
                                type: string
                            replyScope:
                              type: string
                              enum:
                                - anyone
                                - cotool_users
                              description: >-
                                Who may reply in a Slack thread to continue this
                                agent: anyone (any Slack user) or cotool_users
                                (only mapped Cotool users with execute
                                permission)
                            mode:
                              type: string
                              enum:
                                - agent-session
                                - legacy-webhook
                            resourceTypes:
                              type: array
                              items:
                                type: string
                            emailAddress:
                              type: string
                          required:
                            - source
                            - name
                      structuredOutputSchema:
                        $ref: '#/components/schemas/CotoolJsonSchema'
                      systemPrompt:
                        type: string
                      syncKey:
                        type: string
                    required:
                      - name
                      - modelAlias
                      - systemPrompt
                    additionalProperties: true
                  origin:
                    type: string
                    enum:
                      - user
                      - sync
                  sourceCommitSha:
                    type:
                      - string
                      - 'null'
                  changedByUserId:
                    type:
                      - string
                      - 'null'
                    format: uuid
                  changedByEmail:
                    type:
                      - string
                      - 'null'
                  description:
                    type:
                      - string
                      - 'null'
                  createdAt:
                    type: string
                required:
                  - id
                  - agentId
                  - definition
                  - origin
                  - sourceCommitSha
                  - changedByUserId
                  - changedByEmail
                  - description
                  - createdAt
        '400':
          description: Bad request — input validation failed or the request was malformed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '401':
          description: Unauthorized — missing or invalid API key / session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden — the authenticated user lacks the required permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PermissionError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-codeSamples:
        - lang: shell
          label: cURL
          source: >-
            curl -X POST
            "https://app.cotool.ai/api/agents/:agentId/versions/:versionId/revert"
            \
              -H "Authorization: Bearer YOUR_API_KEY" \
              -H "Content-Type: application/json"
components:
  schemas:
    CotoolJsonSchema:
      type: object
      properties:
        type:
          type: string
          enum:
            - string
            - number
            - boolean
            - 'null'
            - object
            - array
        title:
          type: string
        description:
          type: string
        properties:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/CotoolJsonSchema'
        items:
          $ref: '#/components/schemas/CotoolJsonSchema'
        required:
          type: array
          items:
            type: string
        enum:
          type: array
          items:
            type: string
        additionalProperties:
          type: boolean
        x-cotool:
          type: object
          properties:
            presetId:
              type: string
              enum:
                - classification
                - markdown
                - templatedReport
                - toolCallEvidence
            viewerId:
              type: string
          additionalProperties:
            $ref: '#/components/schemas/JsonValue'
      required:
        - type
      description: >-
        A JSON Schema definition with Cotool-specific extensions for structured
        output presets
    ValidationError:
      type: object
      properties:
        error:
          type: string
          description: Error message describing what went wrong
        issues:
          type: array
          description: >-
            Detailed validation issues, present when request or response schema
            validation fails
          items:
            type: object
            additionalProperties: true
      required:
        - error
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message describing what went wrong
      required:
        - error
    PermissionError:
      type: object
      properties:
        error:
          type: string
          description: Error message describing what went wrong
        missingPerms:
          type: array
          description: Permissions the authenticated user is missing for this operation
          items:
            type: string
      required:
        - error
    JsonValue:
      anyOf:
        - type: string
        - type: number
        - type: boolean
        - type: 'null'
        - type: array
          items:
            $ref: '#/components/schemas/JsonValue'
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/JsonValue'
      description: A JSON value (string, number, boolean, null, array, or object)
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        API Key authentication for programmatic access. Include your API key in
        the Authorization header as: `Bearer your_api_key_here`

````