Skip to documentation
Weavers Docs

Pages and endpoints

Tab to navigate · Enter to openEsc to close

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

ParameterLocationType and requirement
x-idempotency-keyheaderstring · required

Pattern: ^[A-Za-z0-9_-]{8,128}$

X-Request-Nonceheaderstring · required

Generate a fresh nonce for every attempt.

Pattern: ^[A-Za-z0-9_-]{16,128}$

X-Request-Timestampheaderstring · required

Current Unix seconds (10 digits) or milliseconds (13 digits).

Pattern: ^(?:[0-9]{10}|[0-9]{13})$

Originheaderstring · required

An origin allowed by this deployment.

X-CSRF-Tokenheaderstring · required

Must match the CSRF cookie issued to this browser.

Body · application/json

strategyId required · string
strategyAuthorId optional · string | number
params optional · object

Parameters 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 · string
endDate required · string
capital required · string | number
articleId optional · string
interval optional · string

Example

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.

Save as request.json
{
  "strategyId": "sma",
  "startDate": "2025-01-01",
  "endDate": "2025-06-30",
  "capital": 10000
}
cURL (POSIX shell)
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.json

Responses

202 · Work accepted. Poll the returned job or request identifier.

application/json

202 example · synthetic data
{
  "jobId": "1",
  "status": "accepted",
  "message": "Explain the data used in this research."
}
View response model
jobId required · string
status required · "accepted" | "queued"
message required · string

Additional fields: JSON values.

400 · Invalid request.

application/json

400 example · synthetic data
{
  "error": "example"
}
View response model
Variant 1: object
error required · string

Additional fields: JSON values.

401 · Authentication is missing or invalid.

application/json

401 example · synthetic data
{}
View response model

Error envelopes can include resource-specific details. Check the status before reading these fields.

error optional · string
code optional · string
message optional · string

Additional fields: JSON values.

402 · Credits or entitlement required.

application/json

402 example · synthetic data
{
  "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 · 30
scope required · string

Additional fields: JSON values.

Variant 2: object
error required · "insufficient_funds"
missing required · number
balance required · number
unlockCost required · 80

Additional fields: JSON values.

403 · Permission, origin or CSRF check failed.

application/json

403 example · synthetic data
{}
View response model

Error envelopes can include resource-specific details. Check the status before reading these fields.

error optional · string
code optional · string
message optional · string

Additional fields: JSON values.

429 · Rate limit reached; honor Retry-After when supplied.

application/json

429 example · synthetic data
{
  "error": "example"
}
View response model
error required · string

Additional fields: JSON values.

500 · Server failure.

application/json

500 example · synthetic data
{
  "error": "example"
}
View response model
Variant 1: object
error required · string

Additional fields: JSON values.