---
title: "Fork Backtested Cell"
method: POST
path: "/v1/library/backtested/{slug}/fork"
tags: ["library"]
---

# Fork Backtested Cell

`POST /v1/library/backtested/{slug}/fork`

## Request

- Base URL: `https://api.usekeel.io` (the document declares no server; this is the origin it was published from)
- URL: `https://api.usekeel.io/v1/library/backtested/{slug}/fork`
- Auth: none declared

Fork one tested cell of a backtested strategy page into the caller's org.

Reads ``sources[cell_id]`` from the committed class P package — the exact
program whose numbers the page publishes, a basket ``headline`` cell or a
``per_coin`` cell (D-30) — and stores it verbatim as a
normal DRAFT strategy, through the same bake, validate, lock and upload
steps as :func:`fork_library_entry`.

There is no default cell: an unknown slug or cell is a 404 that names the
cells the page does carry (Q-3119: a fork that silently drops its payload
is worse than a refusal). A source the validator rejects is a 422.

Provenance: a class P cell is not a library entry, so the ``library_*``
columns stay NULL (keel-app links ``library_source_slug`` to
``/library/<slug>``). The commit's ``meta.provenance`` records
``{class: P, slug, cell_id, import_id, source_sha256}``.

## Path parameters

- `slug` string, required

## Headers

- `Authorization` string, nullable
- `X-Org-Id` string, nullable

## Request body

- BacktestedForkRequest: Fork one cell of a class P backtested page (spec 12 §6.3, P-D8). ``cell_id`` is required: there is no default cell to fall back to (Q-3119 is the failure this refuses to repeat).
  - `cell_id` string, required
  - `name` string, nullable
  - `created_via` 'app' | 'cli' | 'mcp-local' | 'mcp-remote' | 'sdk' | 'chat' | 'api', nullable
  - `source_surface` string, nullable

## Response `201`

Successful Response

- BacktestedForkResponse: What the app needs to land the user on the forked cell in the editor.
  - `strategy_id` string, required
  - `name` string, required
  - `page_slug` string, required
  - `cell_id` string, required
  - `import_id` string, nullable
  - `source_sha256` string, required
  - `editor_path` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/usekeel/apis/keel-api.md) · [All operations](https://skmtc.dev/usekeel/apis/keel-api/llms.txt) · [OpenAPI document](https://skmtc.dev/usekeel/apis/keel-api/revisions/3191ca10b0ab?raw)
