---
title: "Submit Backtest"
method: POST
path: "/v1/backtests"
---

# Submit Backtest

`POST /v1/backtests`

## Request

- Base URL: `https://api.quantradin.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.quantradin.com/v1/backtests`
- Auth: none declared

Enqueue a backtest.

Accepts either:
  - ``strategy_spec``: an inline strategy spec dict
  - ``strategy_id``: id of a previously saved strategy (user-scoped)

The spec is validated synchronously; a background task runs the engine
and writes results to the DB.

Auth: the EFFECTIVE user is the session-cookie user when a valid
session exists, else the X-Vega-Key header user (require_backtest_submitter
— see auth.py). This matters because the home cockpit always sends the
shared demo key alongside a real user's session cookie; without
preferring the session, a logged-in account holder would be treated as
the demo user and hit the free-tier cap below.

## Headers

- `x-vega-key` string, nullable

## Request body

- BacktestRequest: POST /v1/backtests — either inline spec or a saved strategy_id.
  - `strategy_spec` object, nullable
  - `strategy_id` integer, nullable
  - `anon_id` string, nullable

## Response `200`

Successful Response

- BacktestQueued
  - `run_id` string, required
  - `status` string
  - `defaults_applied` string[]

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/quantradin/apis/vega-api.md) · [All operations](https://skmtc.dev/quantradin/apis/vega-api/llms.txt) · [OpenAPI document](https://skmtc.dev/quantradin/apis/vega-api/revisions/47add154ef38?raw)
