---
title: "Rerun a whole book across 2 to 5 values of one book level knob (BILLS K×N credits; async → jobId). Idempotency-Key supported"
method: POST
path: "/v1/portfolio/sweep"
---

# Rerun a whole book across 2 to 5 values of one book level knob (BILLS K×N credits; async → jobId). Idempotency-Key supported

`POST /v1/portfolio/sweep`

## Request

- Base URL: `https://app.texttoquant.com/api`
- URL: `https://app.texttoquant.com/api/v1/portfolio/sweep`
- Auth: one of:
  - API key in header `x-api-key`
  - HTTP bearer

## Request body

- object
  - `config` object, required
  - `parameter` object, required
    - `key` 'initialCapital' | 'maxConcurrentPositions' | 'bookMaxDrawdownPct' | 'totalExposureCapPct', required
    - `values` number[], required
  - `idempotency_key` string

## Response `202`

Returns {jobId, credits}

- object
  - `success` true, required
  - `data` object, required

## Other responses

- `400`: config/parameter missing or malformed (see error for which), or SYMBOL_UNRESOLVED (no market and no company name match) or SYMBOL_AMBIGUOUS (a crypto token and a listed share use the same symbol, e.g. CAT). Refused before billing, nothing is charged. details.blockers[0] is the repair card. For the run's own asset each candidates[].patch.asset is a one tap fix (the near company listing, or the token pair and the share listings): resend with the chosen asset. With scope "condition" the symbol is read by a condition (another market's indicator, a ratio, a correlation), not the run's asset: never change asset. Write the chosen symbol in that condition. When one entry or exit condition holds it, the card has a locator {section, index} and each candidates[].condition is that whole condition with its symbol field rewritten: replace the condition at the locator and resend. On a rerun of a saved backtest (storedRun true) a condition card has no candidates: the saved run cannot be changed in place, so edit that condition in the strategy and run it as a new backtest.
- `402`: PORTFOLIO_SWEEP_QUOTA_EXCEEDED
- `409`: PORTFOLIO_SWEEP_RETRY_ORIGINAL_FAILED — an Idempotency-Key replay whose original request threw; retry with a new key
- `503`: PORTFOLIO_SWEEP_DISABLED — disabled in production unless PORTFOLIO_SWEEP_ENABLED=true

---

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