---
title: "Restore Version"
method: POST
path: "/v1/strategies/{strategy_id}/versions/restore"
tags: ["strategies"]
---

# Restore Version

`POST /v1/strategies/{strategy_id}/versions/restore`

## 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/strategies/{strategy_id}/versions/restore`
- Auth: none declared

Restore a historical version as new HEAD.

``expected_head_commit_id``, when sent, is the version the caller is
restoring over: a moved HEAD is a 409 ``HEAD_MOVED`` and nothing is
written (Q-2227 S1).

## Path parameters

- `strategy_id` string, required

## Headers

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

## Request body

- RestoreRequest
  - `ref` string, required
  - `message` string, nullable
  - `expected_head_commit_id` string, nullable

## Response `200`

Successful Response

- StrategyResponse
  - `id` string, required
  - `name` string, required
  - `status` string, required
  - `visibility` string, nullable
  - `forked_from_id` string, nullable
  - `forked_from_name` string, nullable
  - `fork_count` integer
  - `description` string, nullable
  - `source` string, nullable
  - `source_hash` string, nullable
  - `created_via` string, nullable
  - `library_source_slug` string, nullable
  - `library_entry_version` string, nullable
  - `library_entry_name` string, nullable
  - `library_variant_id` string, nullable
  - `library_import_id` string, nullable
  - `library_source_hash` string, nullable
  - `backtested_page_slug` string, nullable
  - `backtested_cell_id` string, nullable
  - `backtested_page_subject` string, nullable
  - `head_commit_id` string, nullable
  - `head_source_hash` string, nullable
  - `compilation_error` string, nullable
  - `validation` object, nullable
  - `unchanged` boolean, nullable
  - `universe_resolution` object, nullable
  - `universe_state` object, nullable
  - `graph` object, nullable
  - `s3_key` string, nullable
  - `org_id` string, nullable
  - `component_lock` object, nullable
  - `deprecations` object[], nullable
  - `lock_hash` string, nullable
  - `current_sequence` integer, nullable
  - `deployed_sequence` integer, nullable
  - `deployed_version_string` string, nullable
  - `deployment_id` string, nullable
  - `deployment_schedule` string, nullable
  - `deployed_at` string, date-time, nullable
  - `latest_backtest_metrics` object, nullable
  - `latest_backtest_id` string, nullable
  - `latest_backtest_sequence` integer, nullable
  - `latest_backtest_start_date` string, date-time, nullable
  - `latest_backtest_end_date` string, date-time, nullable
  - `latest_backtest_sub_window` boolean, nullable
  - `backtest_state` string, nullable
  - `backtest_run_count` integer, nullable
  - `journey_projection` object, nullable
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, nullable

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