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

# Commit on behalf of author

> Commit workspace changes with custom author information and timestamp.
This endpoint is used for importing commits from external VCS systems (e.g., Perforce)
where the original author and timestamp should be preserved.
Requires Admin access to the repository.




## OpenAPI

````yaml post /repos/{repo_id}/workspaces/{workspace_id}/commit-on-behalf
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}/workspaces/{workspace_id}/commit-on-behalf:
    parameters:
      - $ref: '#/components/parameters/RepoParam'
      - $ref: '#/components/parameters/WorkspaceParam'
    post:
      tags:
        - Repository Commit Manipulation
      summary: Commit on behalf of author
      description: >
        Commit workspace changes with custom author information and timestamp.

        This endpoint is used for importing commits from external VCS systems
        (e.g., Perforce)

        where the original author and timestamp should be preserved.

        Requires Admin access to the repository.
      operationId: src.handlersv2.workspace.commit_on_behalf
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommitOnBehalfRequest'
      responses:
        '200':
          $ref: '#/components/responses/OKEmpty'
          description: Workspace contains no changes to commit
        '201':
          $ref: '#/components/responses/CommitCreated'
        '400':
          $ref: '#/components/responses/CommitInvalidPaths'
        '409':
          description: Workspace contains conflicts
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '412':
          $ref: '#/components/responses/PreconditionFailed'
          description: Workspace is detached
        '503':
          description: Service unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '522':
          description: Server service error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        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.
    WorkspaceParam:
      in: path
      name: workspace_id
      required: true
      schema:
        type: string
        example: example_id
        minLength: 3
        maxLength: 128
      description: The repo ID of the workspace.
  schemas:
    CommitOnBehalfRequest:
      allOf:
        - $ref: '#/components/schemas/CommitMessage'
        - type: object
          description: |
            Commit request for importing commits from external VCS systems.
            Allows specifying custom author information and timestamp.
            Requires Admin access to the repository.
          properties:
            include_paths:
              $ref: '#/components/schemas/PathsList'
              description: >-
                Inclusion list of modified paths to commit. Other modifications
                will not be committed.
            author_info:
              $ref: '#/components/schemas/AuthorInfo'
              description: >-
                Author information for the commit (original author from external
                VCS).
            commit_time:
              type: integer
              format: int64
              description: >-
                Commit timestamp (Unix seconds since epoch) from the original
                VCS.
          required:
            - author_info
            - commit_time
    Error:
      type: object
      properties:
        status:
          type: integer
          description: HTTP status code
        detail:
          type: string
        title:
          type: string
        type:
          type: string
      required:
        - status
        - detail
    CommitMessage:
      type: object
      properties:
        commit_message:
          type: string
          maxLength: 16384
      required:
        - commit_message
    PathsList:
      description: >-
        Inclusion list of paths to include in the operation. If `null`, all
        paths will be included.
      type: array
      nullable: true
      minItems: 1
      items:
        type: string
        description: A relative path to a file or directory inside the repository.
        minLength: 1
    AuthorInfo:
      type: object
      description: >-
        Author information for imported commits when the author is not a
        Diversion user
      properties:
        alias:
          type: string
          maxLength: 256
          description: Display alias (e.g., Perforce username)
        full_name:
          type: string
          maxLength: 256
          description: Full name of the author
        email:
          type: string
          maxLength: 256
          format: email
          description: Email address of the author
      required:
        - full_name
        - email
    NewCommit:
      allOf:
        - $ref: '#/components/schemas/NewResourceId'
        - $ref: '#/components/schemas/FailedCommitPaths'
    FailedCommitPaths:
      type: object
      properties:
        failed_paths:
          type: array
          nullable: true
          items:
            type: string
          description: A list of paths that were not found/failed to commit
    NewResourceId:
      type: object
      properties:
        id:
          type: string
          description: The id of the newly created resource
          example: example_id
        read_only:
          type: boolean
      required:
        - id
  responses:
    OKEmpty:
      description: Request completed successfully
    CommitCreated:
      description: Commit created
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NewCommit'
    CommitInvalidPaths:
      description: None of the commit paths exist
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - $ref: '#/components/schemas/FailedCommitPaths'
    PreconditionFailed:
      description: The specified resource is no longer up to date
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error:
      description: An error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  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

````