Skip to content

Create a risk profile and bind it to an account

A risk profile is a named rule set you write once and attach to many accounts. When this is done, one account carries riskProfileId and the order-time gate reads that profile on every compose.

  1. POST /api/v1/risk-profiles/validate parses a rule array and returns a verdict. It never touches the database and always answers 200, so it is the cheapest way to check a rule shape before you commit to it.

    Terminal window
    curl -s https://api.troncharts.xyz/api/v1/risk-profiles/validate \
    -H "authorization: Bearer $TOKEN" \
    -H "x-tenant-slug: $TC_TENANT_SLUG" \
    -H 'content-type: application/json' \
    -d '{"kind":"trader","rules":[{"type":"max_leverage","value":20}]}'
    # → { "valid": true, "ruleCount": 1 }
  2. name and kind are the only required fields. kind is one of trader, challenge or funded — a prop template can bind only the latter two. enforcement is off, soft or hard; rules holds up to 64 entries.

    Terminal window
    curl -s https://api.troncharts.xyz/api/v1/risk-profiles \
    -H "authorization: Bearer $TOKEN" \
    -H "x-tenant-slug: $TC_TENANT_SLUG" \
    -H 'content-type: application/json' \
    -d '{
    "name": "Retail default",
    "kind": "trader",
    "enforcement": "hard",
    "rules": [
    { "type": "max_leverage", "value": 20 },
    { "type": "max_concentration_pct", "value": 0.3 }
    ]
    }'
    # → 201 { "profile": { "id": "…", "kind": "trader", … } }
  3. Binding writes accounts.risk_profile_id and busts the resolver cache, so the next order composes against the new rules.

    Terminal window
    curl -s https://api.troncharts.xyz/api/v1/risk-profiles/$PROFILE_ID/bind \
    -H "authorization: Bearer $TOKEN" \
    -H "x-tenant-slug: $TC_TENANT_SLUG" \
    -H 'content-type: application/json' \
    -d '{"accountId":"'"$ACCOUNT_UUID"'"}'
    # → { "ok": true, "accountId": "…", "riskProfileId": "…" }
  4. An account holds exactly one profile. Binding a second profile replaces the first; binding the literal id none clears it.

    Terminal window
    curl -s https://api.troncharts.xyz/api/v1/risk-profiles/none/bind \
    -H "authorization: Bearer $TOKEN" \
    -H "x-tenant-slug: $TC_TENANT_SLUG" \
    -H 'content-type: application/json' \
    -d '{"accountId":"'"$ACCOUNT_UUID"'"}'

Next: Create a challenge template · Create a trading group · Scopes & tiers