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

# Fork a public repository into the caller's organization.

> Business logic mirrors the orchestrator's former `ForkRepository` action:
resolve the source public ref to a commit, branch a VM from it (a storage
CoW clone, so no access check is needed — the public repo layer already
authorized it), commit that VM to a snapshot owned by the forker, then
create (or reuse) the target repo and tag the new commit within it.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v2/repositories/fork
openapi: 3.1.0
info:
  title: Vers API
  description: >-
    REST API for creating, checkpointing, branching, and managing Vers computers
    and projects.
  version: 2.0.0
servers:
  - url: https://api.vers.sh
    description: Vers API
security:
  - bearerAuth: []
tags:
  - name: Computers
    description: Create, inspect, execute commands in, sleep, wake, and delete computers.
  - name: Branches
    description: Branch one or more computers from a live computer, checkpoint, or tag.
  - name: Checkpoints
    description: Capture, inspect, tag, and delete whole-computer checkpoints.
  - name: Projects
    description: >-
      Organize computers into projects with private service networks and grouped
      restores.
  - name: Operations
    description: Inspect and stream status events for asynchronous durable operations.
  - name: Images
    description: >-
      Import and manage custom OCI images, system images, and registry
      artifacts.
  - name: Repositories
    description: Manage checkpoint repositories, tags, and public catalog entries.
  - name: Domains
    description: Register and manage custom domains.
  - name: Environment Variables
    description: Manage account-level environment variables applied to new computers.
  - name: Account & System
    description: Inspect API key identity, usage, and control-plane health.
paths:
  /api/v2/repositories/fork:
    post:
      tags:
        - Repositories
      summary: Fork a public repository into the caller's organization.
      description: >-
        Business logic mirrors the orchestrator's former `ForkRepository`
        action:

        resolve the source public ref to a commit, branch a VM from it (a
        storage

        CoW clone, so no access check is needed — the public repo layer already

        authorized it), commit that VM to a snapshot owned by the forker, then

        create (or reuse) the target repo and tag the new commit within it.
      operationId: fork_repository
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ForkRepositoryRequest'
        required: true
      responses:
        '201':
          description: Repository forked successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForkRepositoryResponse'
        '401':
          description: Missing or invalid API key
        '404':
          description: Source repository or tag not found
        '409':
          description: Target repository name already exists
        '503':
          description: Insufficient capacity on this node and no peer could take the fork
components:
  schemas:
    ForkRepositoryRequest:
      type: object
      description: Request body for POST /api/v2/repositories/fork
      required:
        - source_org
        - source_repo
        - source_tag
      properties:
        keep_alive:
          type: boolean
          description: >-
            Whether the forked VM is exempt from inactivity auto-sleep. Defaults
            to true.
        repo_name:
          type:
            - string
            - 'null'
          description: Optional name for the forked repository (defaults to source_repo)
        source_org:
          type: string
          description: The org that owns the source (public) repository
        source_repo:
          type: string
          description: The source repository name
        source_tag:
          type: string
          description: The source tag within the source repository
        tag_name:
          type:
            - string
            - 'null'
          description: Optional tag name for the fork (defaults to source_tag)
    ForkRepositoryResponse:
      type: object
      description: Response body for POST /api/v2/repositories/fork
      required:
        - vm_id
        - commit_id
        - repo_name
        - tag_name
        - reference
        - keep_alive
      properties:
        commit_id:
          type: string
          format: uuid
          description: The commit ID of the forked snapshot
        keep_alive:
          type: boolean
          description: Whether the forked VM is exempt from inactivity auto-sleep.
        reference:
          type: string
          description: Full reference in repo_name:tag format
        repo_name:
          type: string
          description: The forked repository name
        tag_name:
          type: string
          description: The fork's tag name
        vm_id:
          type: string
          description: The VM created from the fork
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: 'Vers API key (`VERS_API_KEY`) sent as `Authorization: Bearer <key>`.'

````

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