POST /api/backtest
Account required · HTTP API reference
All endpoints · Authentication and retries · Download OpenAPI
- Requires a signed-in account and permission to access this resource. Use identifiers returned by your own account's earlier requests.
- Select an available strategy identifier and supported parameters from the strategy workflow. Dates must form a supported historical window and capital must be positive. Poll the returned jobId.
- Protected writes require an allowed Origin, the CSRF cookie and matching X-CSRF-Token header.
- Send a fresh X-Request-Nonce and current X-Request-Timestamp on every attempt. Reuse an idempotency key only for the same logical action.
Request
| Parameter | Location | Type and requirement |
|---|---|---|
x-idempotency-key | header | string · required Pattern: |
X-Request-Nonce | header | string · required Generate a fresh nonce for every attempt. Pattern: |
X-Request-Timestamp | header | string · required Current Unix seconds (10 digits) or milliseconds (13 digits). Pattern: |
Origin | header | string · required An origin allowed by this deployment. |
X-CSRF-Token | header | string · required Must match the CSRF cookie issued to this browser. |
Body · application/json
strategyId required · stringstrategyAuthorId optional · string | numberparams optional · objectParameters accepted by the selected registered strategy; names and supported values vary by strategy.. Parameters accepted by the selected registered strategy; names and supported values vary by strategy.
startDate required · stringendDate required · stringcapital required · string | numberarticleId optional · stringinterval optional · stringExample
Examples use fictional data. Replace identifiers with resources you can access. For account requests, cookies.txt must contain your own session; set CSRF_TOKEN to the matching CSRF cookie value where required.
{
"strategyId": "sma",
"startDate": "2025-01-01",
"endDate": "2025-06-30",
"capital": 10000
}curl --include \
--request POST \
'https://api.weavers.app/api/backtest' \
--cookie cookies.txt --cookie-jar cookies.txt \
--header 'x-idempotency-key: example-request-0001' \
--header "X-Request-Nonce: $(openssl rand -hex 16)" \
--header "X-Request-Timestamp: $(date +%s)" \
--header 'Origin: https://weavers.app' \
--header "X-CSRF-Token: ${CSRF_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @request.jsonResponses
202 · Work accepted. Poll the returned job or request identifier.
application/json
{
"jobId": "1",
"status": "accepted",
"message": "Explain the data used in this research."
}View response model
jobId required · stringstatus required · "accepted" | "queued"message required · stringAdditional fields: JSON values.
400 · Invalid request.
application/json
{
"error": "example"
}View response model
Variant 1: object
error required · stringAdditional fields: JSON values.
401 · Authentication is missing or invalid.
application/json
{}View response model
Error envelopes can include resource-specific details. Check the status before reading these fields.
error optional · stringcode optional · stringmessage optional · stringAdditional fields: JSON values.
402 · Credits or entitlement required.
application/json
{
"error": "entitlement_required",
"entitlementKey": "advanced_indicators",
"price": 30,
"scope": "example"
}View response model
Variant 1: object
error required · "entitlement_required"entitlementKey required · "advanced_indicators"price required · 30scope required · stringAdditional fields: JSON values.
Variant 2: object
error required · "insufficient_funds"missing required · numberbalance required · numberunlockCost required · 80Additional fields: JSON values.
403 · Permission, origin or CSRF check failed.
application/json
{}View response model
Error envelopes can include resource-specific details. Check the status before reading these fields.
error optional · stringcode optional · stringmessage optional · stringAdditional fields: JSON values.
429 · Rate limit reached; honor Retry-After when supplied.
application/json
{
"error": "example"
}View response model
error required · stringAdditional fields: JSON values.
500 · Server failure.
application/json
{
"error": "example"
}View response model
Variant 1: object
error required · stringAdditional fields: JSON values.