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

# Revert to commit

> The operation gets the file version in the specific commit and applies it to the workspace. Changes are the saved to the workspace.




## OpenAPI

````yaml post /repos/{repo_id}/revert_to_commit_workspace
openapi: 3.0.3
info:
  title: Diversion Core API
  description: >-
    Definition of the Core API used to access low-level functionality of
    Diversion
  version: 0.2.0
servers:
  - url: https://api.diversion.dev/v0
    description: Base endpoint
security: []
paths:
  /repos/{repo_id}/revert_to_commit_workspace:
    parameters:
      - $ref: '#/components/parameters/RepoParam'
    post:
      tags:
        - Repository Commit Manipulation
      summary: Revert to commit
      description: >
        The operation gets the file version in the specific commit and applies
        it to the workspace. Changes are the saved to the workspace.
      operationId: src.handlersv2.workspace.revert_to_commit
      parameters:
        - name: workspace_id
          in: query
          schema:
            type: string
          required: true
          description: The workspace ID to revert to
        - name: commit_id
          in: query
          schema:
            type: string
          required: true
          description: The commit ID to revert to
      responses:
        '201':
          description: The revert was completed successfully
        '400':
          $ref: '#/components/responses/BadRequest'
        '409':
          description: The workspace is not empty, cannot revert
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - OAuth2:
            - coreapi/write
components:
  parameters:
    RepoParam:
      in: path
      name: repo_id
      required: true
      schema:
        type: string
        example: example_id
        minLength: 3
        maxLength: 128
      description: >-
        The repo ID of the repository. Repo _name_ can be used instead of the
        ID, but usage of ID for permanent linking and API requests is preferred.
  responses:
    BadRequest:
      description: The request does not meet the required conditions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      properties:
        status:
          type: integer
          description: HTTP status code
        detail:
          type: string
        title:
          type: string
        type:
          type: string
      required:
        - status
        - detail
  securitySchemes:
    OAuth2:
      type: oauth2
      x-tokenInfoFunc: src.token_info.token_auth
      description: This API uses OAuth 2 with the implicit grant flow
      flows:
        implicit:
          authorizationUrl: https://auth.diversion.dev/oauth2/authorize
          scopes:
            coreapi/read: Operations with no possible side-effects
            coreapi/write: Modifying operations
            coreapi/admin: >-
              Organizational operations like adding a repo or changing repo
              properties

````