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

# Fork chat

> Starts a new chat that continues from this chat's history, optionally on another coding agent and with a first message. The replica must be active.



## OpenAPI

````yaml /openapi.json post /v1/replica/{id}/chats/{chat_id}/fork
openapi: 3.1.0
info:
  title: Replicas API
  version: 2.0.0
  description: >-
    Create and control workspaces, and manage the environments, automations, and
    learnings they run with.
servers:
  - url: https://api.replicas.dev
    description: Production API
security:
  - apiKey: []
tags:
  - name: Replica
    description: >-
      A replica is a Replicas workspace: a cloud sandbox where a coding agent
      works on your repositories.
  - name: Chats
    description: Manage the agent chats inside a replica.
  - name: Message queue
    description: Messages waiting for the agent to finish its turn.
  - name: Commands and terminals
    description: Run commands and open shells in a replica.
  - name: Pull requests
    description: Inspect and act on pull requests a replica opened.
  - name: Previews
    description: Public URLs for ports in a replica.
  - name: Canvas
    description: Plans, reports, and other files agents produce.
  - name: Sharing
    description: Add replicas to members' Shared view.
  - name: Environments
    description: >-
      Environments define what a workspace starts with. The `global` environment
      applies to every workspace.
  - name: Environment variables
    description: Variables injected into workspaces.
  - name: Environment files
    description: Files written into workspaces.
  - name: Environment skills
    description: Agent skills installed into workspaces.
  - name: Environment MCPs
    description: MCP servers available to workspace agents.
  - name: Hooks
    description: Scripts that run when warm pool snapshots build and when workspaces start.
  - name: Warm pools
    description: Pre-built workspaces that start faster.
  - name: Automations
    description: Run agents on schedules and events.
  - name: Repositories
    description: Repositories and repository sets connected to the organization.
  - name: Learnings
    description: Organization skills every workspace agent loads.
  - name: Agent credentials
    description: >-
      API keys and endpoints that coding agents use. Connect Claude, Codex, and
      Muse subscriptions with the CLI.
  - name: Plugins
    description: Connect integrations that workspace agents can use.
  - name: Organization
    description: Who you are and who is in your organization.
  - name: Media
    description: Screenshots, recordings, and other files workspaces produce.
  - name: Slack
    description: Route Slack threads to workspaces.
  - name: Workspace identity
    description: OIDC keys for verifying workspace identity tokens.
paths:
  /v1/replica/{id}/chats/{chat_id}/fork:
    post:
      tags:
        - Chats
      summary: Fork chat
      description: >-
        Starts a new chat that continues from this chat's history, optionally on
        another coding agent and with a first message. The replica must be
        active.
      operationId: forkReplicaChat
      parameters:
        - name: id
          in: path
          required: true
          description: Replica ID
          schema:
            type: string
            format: uuid
        - name: chat_id
          in: path
          required: true
          description: Chat ID
          schema:
            type: string
        - $ref: '#/components/parameters/ApiVersion'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ForkChatRequest'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForkWorkspaceChatResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    ApiVersion:
      name: X-Replicas-Api-Version
      in: header
      description: >-
        API version. `2026-10-07` returns `snake_case` responses. See
        [versioning](/features/api#versioning).
      required: false
      schema:
        type: string
        enum:
          - '2026-10-07'
  schemas:
    ForkChatRequest:
      type: object
      description: >-
        Request body for continuing an existing chat on another coding agent
        harness
      properties:
        provider:
          type: string
          enum:
            - claude
            - codex
            - cursor
            - opencode
            - pi
          description: >-
            Harness to continue the chat on. It must have credentials connected
            in the workspace.
        model:
          type: string
          description: Model for the forked chat. Defaults to the harness default.
        thinking_level:
          type: string
          enum:
            - low
            - medium
            - high
            - xhigh
            - max
            - ultra
            - ultracode
          description: Reasoning effort for the forked chat
        title:
          type: string
          description: >-
            Title for the forked chat. Defaults to a title derived from the
            source chat.
        message:
          type: string
          description: >-
            Optional first instruction for the new harness, sent alongside the
            inherited context. Empty or whitespace-only values preserve the
            default continuation behavior.
        id:
          type: string
          format: uuid
          description: Optional client-generated chat ID.
        client_request_id:
          type: string
          description: Opaque client-chosen id echoed back in the `chat.created` event
        enable_interactive_tools:
          type: boolean
          description: Allow the forked chat's first turn to use interactive tools
      required:
        - provider
    ForkWorkspaceChatResponse:
      type: object
      properties:
        chat:
          $ref: '#/components/schemas/WorkspaceChat'
      required:
        - chat
    WorkspaceChat:
      type: object
      properties:
        id:
          type: string
          format: uuid
        provider:
          type: string
          enum:
            - claude
            - codex
            - cursor
            - muse
            - opencode
            - pi
        model:
          type: string
          description: Selected model retained for future messages in this chat.
        title:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        processing:
          type: boolean
        parent_chat_id:
          type:
            - string
            - 'null'
          format: uuid
        last_message_text:
          type:
            - string
            - 'null'
        fork:
          description: >-
            Fork lineage and progress, when this chat was forked from another
            chat in the workspace
          oneOf:
            - $ref: '#/components/schemas/ChatFork'
            - type: 'null'
      required:
        - id
        - provider
        - title
        - created_at
        - updated_at
        - processing
        - parent_chat_id
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
        details:
          type:
            - string
            - 'null'
          description: Additional error details
        code:
          type: string
          description: Machine-readable error code when available
      required:
        - error
    ChatFork:
      type: object
      description: Set on a chat that was forked from another chat in the same workspace
      properties:
        source:
          type: object
          description: The chat this one was forked from
          properties:
            chat_id:
              type: string
              format: uuid
            provider:
              type: string
              enum:
                - claude
                - codex
                - cursor
                - opencode
                - pi
            title:
              type: string
          required:
            - chat_id
            - provider
            - title
        trigger:
          type: string
          enum:
            - manual
            - auto
          description: >-
            `manual` for a requested fork, `auto` when the source harness hit
            its usage limit and the owner opted into automatic fallback
        reason:
          type: string
          enum:
            - rate_limit
            - out_of_credits
          description: Why an automatic fork happened
        state:
          type: string
          enum:
            - preparing
            - ready
            - failed
          description: >-
            `preparing` while the transcript handoff is assembled; `processing`
            stays true until it leaves this state
        error:
          type: string
          description: Failure reason when `state` is `failed`
        started_at:
          type: string
          format: date-time
        completed_at:
          type: string
          format: date-time
      required:
        - source
        - trigger
        - state
        - started_at
  responses:
    BadRequest:
      description: Bad request - Missing or invalid parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized - Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: >-
        Conflict - Resource already exists or operation conflicts with current
        state
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: Organization or personal API key from **Settings → API Keys**.

````

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