> ## 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.

# Get file history

> Retrieves the complete change history for a specific file or directory path from a given reference (branch or commit).

**Returns:**
A list of commits that modified the path, with each entry containing:
- Commit details
- File entry state at that commit

**Features:**
- Supports pagination via optional `limit` and `skip` parameters

**Requirements:**
Requires READ access to the repository.




## OpenAPI

````yaml get /repos/{repo_id}/files/history/{ref_id}/{path}
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}/files/history/{ref_id}/{path}:
    parameters:
      - $ref: '#/components/parameters/RepoParam'
      - $ref: '#/components/parameters/RefParam'
      - $ref: '#/components/parameters/PathParam'
    get:
      tags:
        - Repository Manipulation
      summary: Get object history in a ref by its latest path
      operationId: src.handlersv2.commit.get_object_history
      parameters:
        - $ref: '#/components/parameters/PageLimit'
        - $ref: '#/components/parameters/PageSkip'
      responses:
        '200':
          $ref: '#/components/responses/FileHistoryResponse'
        '404':
          $ref: '#/components/responses/NotFound'
        default:
          $ref: '#/components/responses/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.
    RefParam:
      in: path
      name: ref_id
      schema:
        type: string
        example: example_id
        minLength: 3
        maxLength: 128
      required: true
      description: An ID of a workspace, branch or commit.
    PathParam:
      in: path
      name: path
      schema:
        type: string
        format: path
        example: /path/to/file
      required: true
      description: A path to a file inside the repository.
    PageLimit:
      in: query
      name: limit
      schema:
        type: integer
        example: 17
        minimum: 1
        default: 100
      description: Limit the number or items returned from a listing api
    PageSkip:
      in: query
      name: skip
      schema:
        type: integer
        example: 17
        minimum: 0
      description: Skip a number of items returned from a listing api
  responses:
    FileHistoryResponse:
      description: List of changes in the history of a versioned file
      content:
        application/json:
          schema:
            type: object
            properties:
              entries:
                type: array
                items:
                  $ref: '#/components/schemas/FileHistoryEntry'
            required:
              - entries
    NotFound:
      description: The specified resource was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error:
      description: An error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    FileHistoryEntry:
      description: >-
        A change in the history of a versioned item along with the relevant
        commit
      type: object
      properties:
        entry:
          $ref: '#/components/schemas/FileEntry'
        commit:
          $ref: '#/components/schemas/Commit'
      required:
        - entry
        - commit
    Error:
      type: object
      properties:
        status:
          type: integer
          description: HTTP status code
          example: 403
        detail:
          type: string
          example: User not authorized to perform the requested action on the resource
        title:
          type: string
        type:
          type: string
      required:
        - status
        - detail
    FileEntry:
      type: object
      properties:
        path:
          type: string
          example: hello.cc
        prev_path:
          type: string
          description: Optional hint in case the item was renamed or moved
        status:
          $ref: '#/components/schemas/ObjectStatus'
        mode:
          $ref: '#/components/schemas/FileMode'
        mtime:
          type: string
          format: date-time
        blob:
          type: object
          properties:
            storage_uri:
              $ref: '#/components/schemas/StorageUri'
            storage_backend:
              $ref: '#/components/schemas/StorageBackend'
            size:
              type: integer
              format: int64
              description: Size in bytes
            sha:
              type: string
          required:
            - storage_uri
            - storage_backend
            - size
            - sha
      required:
        - path
        - status
        - size
        - mode
    Commit:
      allOf:
        - $ref: '#/components/schemas/CommitId'
        - type: object
          properties:
            created_ts:
              type: integer
              description: Seconds since epoch UTC
              format: int64
            commit_message:
              type: string
            branch_id:
              type: string
              description: The branch on which this commit was created
            author:
              $ref: '#/components/schemas/User'
              description: Details of the user who added the commit
            parents:
              type: array
              description: List of parent commits of this commit
              items:
                type: string
          required:
            - created_ts
            - branch_id
            - author
            - parents
    ObjectStatus:
      type: integer
      enum:
        - 1
        - 2
        - 3
        - 4
      description: 'One of: 1 - INTACT, 2 - ADDED, 3 - MODIFIED, 4 - DELETED'
      x-ogen-enum-naming:
        '1': ObjectStatus_INTACT
        '2': ObjectStatus_ADDED
        '3': ObjectStatus_MODIFIED
        '4': ObjectStatus_DELETED
    FileMode:
      type: integer
      description: The file mode (as Unix mode)
      enum:
        - 16877
        - 33188
        - 33261
        - 40960
      x-ogen-enum-naming:
        '16877': FileMode_TREE
        '33188': FileMode_FILE
        '33261': FileMode_EXECUTABLE
        '40960': FileMode_SYMLINK
    StorageUri:
      type: string
      description: Coupled with storage_backend, a uri to storage location
      example: repo_id/2aae6c35c94fcfb415dbe95f408b9ce91ee846ed
    StorageBackend:
      type: integer
      enum:
        - 1
        - 2
      description: 'One of: 1 - EFS, 2 - S3'
      x-ogen-enum-naming:
        '1': StorageBackend_EFS
        '2': StorageBackend_S3
    CommitId:
      type: object
      properties:
        commit_id:
          type: string
          example: example_id
          minLength: 3
          maxLength: 128
      required:
        - commit_id
    User:
      description: User details
      type: object
      properties:
        image:
          type: string
          description: URL of the user image
        email:
          type: string
          format: email
        full_name:
          type: string
        id:
          type: string
        name:
          type: string
      required:
        - id
  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

````