---
title: "Fork experiment"
method: POST
path: "/experiments/{id}/fork"
tags: ["experiments"]
---

# Fork experiment

`POST /experiments/{id}/fork`

Create a copy of an experiment with all its stages and agents.

**Access Control:** You can only fork an experiment if:
- The experiment's visibility is set to `PUBLIC`, OR
- You are the owner/creator of the experiment

The forked experiment will have:
- A new unique ID
- Name set to "Copy of [original name]" (or custom name if provided)
- The current user as creator
- All stages copied
- All agent mediators and agent participants copied

The forked experiment will NOT include:
- Cohorts
- Participants
- Any collected data

## Path parameters

- `id` string, required

## Request body

- object
  - `name` string — Optional custom name for the forked experiment

## Response `201`

Experiment forked successfully

- object
  - `experiment` Experiment
    - `id` string — Unique experiment identifier
    - `versionId` integer — Experiment version ID for backwards compatibility
    - `metadata` Metadata — Experiment metadata
      - `name` string — Experiment name
      - `publicName` string — Public-facing experiment name
      - `description` string — Experiment description
      - `tags` string[] — Tags for categorization
      - `creator` string — Experimenter ID who created the experiment
      - `starred` object — Maps experimenter IDs to starred status
      - `dateCreated` object — Firestore timestamp
      - `dateModified` object — Firestore timestamp
    - `permissions` object — Experiment permissions
      - `visibility` 'public' | 'private' — Experiment visibility
      - `readers` string[] — List of experimenter IDs with read access
    - `stageIds` string[] — Ordered list of stage IDs (stages are stored in a subcollection, not returned in this response)
    - `defaultCohortConfig` object — Default cohort configuration
    - `prolificConfig` object — Prolific integration configuration
    - `cohortLockMap` object — Maps cohort ID to lock status
  - `sourceExperimentId` string — ID of the original experiment that was forked

## Other responses

- `401` — Unauthorized - Missing or invalid API key
- `403` — Forbidden - Insufficient permissions or browser access attempted
- `404` — Not found - Resource doesn't exist
- `429` — Too many requests - Rate limit exceeded

---

[API](https://skmtc.net/pair-code/apis/deliberate-lab-api.md) · [All operations](https://skmtc.net/pair-code/apis/deliberate-lab-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pair-code/deliberate-lab-api/versions/f58e6c25e4f8/schema)
