# Onboard an end customer

When your own platform owns the customer relationship — sign-up, risk, order
entry — you onboard each end customer through the API. Every customer becomes
a trader of their own in your tenant, with their own account and their own
trader credential, so the admin console, reports and risk views show them
individually.

1. ### Get an operator credential with prop management

   In the admin console, **Developers → Create API client**, tick **Prop
   management**. Mint its token as usual (see
   [Mint a token](https://docs.troncharts.xyz/docs/recipes/mint-a-token/)). This credential provisions and
   supervises; it never places orders. See [Trader vs operator](https://docs.troncharts.xyz/docs/auth/audiences/).

2. ### Pick the template the account is created from

   Every account is created from a template, which carries the starting
   balance, currency, trading group and risk profile.

   ```bash
   curl -s https://api.troncharts.xyz/api/v1/prop-templates \
     -H "authorization: Bearer $OPERATOR_TOKEN"
   # → { "templates": [ { "id": "…", "accountSizeUsd": "50000.00", "active": true, … } ] }
   ```

3. ### Create the customer, the account and the trader credential

   One call does all three. `owner` creates the customer the first time you send
   their `externalId` (your own id for them) and reuses it afterwards; the
   account and the credential are created in the same transaction, so you never
   end up with an account you cannot trade.

   ```bash
   curl -s https://api.troncharts.xyz/api/v1/accounts/create-prop \
     -H "authorization: Bearer $OPERATOR_TOKEN" \
     -H 'content-type: application/json' \
     -d '{
       "templateId": "'"$TEMPLATE_ID"'",
       "mode": "paper",
       "owner": { "externalId": "customer-42", "email": "ana@example.com", "displayName": "Ana" },
       "issueTraderCredential": true
     }'
   ```

   ```json
   {
     "mode": "paper",
     "accountId": "…",
     "accountNumber": "150400",
     "propAccount": { "id": "…", "templateId": "…", "startEquityUsd": "50000.00", … },
     "owner": { "id": "…", "created": true },
     "traderCredential": {
       "id": "…", "apiKey": "pk_…", "apiSecret": "sk_…", "tier": "fullTrading"
     }
   }
   ```

   The `apiSecret` is returned **once**. Store it with the customer record on
   your side.

   | Field | Notes |
   | --- | --- |
   | `owner` | `externalId`, `email`, `walletAddress`, `displayName`; at least one of the first three. Use `ownerUserId` instead for a customer created earlier with `POST /api/v1/users`. |
   | `issueTraderCredential` | `true` to receive the trader credential. Only an operator credential may ask: a trader credential gets `403 wrong_credential_audience`. A value that is not a boolean is `400 invalid_body`. |
   | `baselineUsd` | Optional. Overrides the template's starting balance for this account. |
   | `displayName` | Optional account label shown in the admin console. |

   :::caution[A retry creates a second account]
   Re-sending the call reuses the customer (`owner.created: false`) but creates
   another account and another credential. If a call timed out, check the
   customer's accounts with `GET /api/v1/users/{id}/accounts` before retrying.
   :::

4. ### Trade the account with the trader credential

   Mint a token from the trader credential and use it for everything on that
   account: orders, reads and the `/ws/risk` socket.

   ```bash
   curl -s https://api.troncharts.xyz/api/v1/oms/intents \
     -H "authorization: Bearer $TRADER_TOKEN" \
     -H 'content-type: application/json' \
     -H "idempotency-key: $(uuidgen)" \
     -d '{"venue":"paper","symbol":"BTC.HL","side":"buy","type":"market","qty":"0.001"}'
   ```

   See [Place your first order](https://docs.troncharts.xyz/docs/recipes/place-your-first-order/) and
   [Stream account updates](https://docs.troncharts.xyz/docs/recipes/stream-account-updates/).

5. ### Supervise from your risk system

   The operator credential cannot read into the account, but it can act on it.
   When your own risk rules decide to stop a customer, block the account; the
   block reaches the open socket as `Account-Suspension-Update`.

   ```bash
   curl -s -X POST https://api.troncharts.xyz/api/v1/accounts/$ACCOUNT_ID/block \
     -H "authorization: Bearer $OPERATOR_TOKEN" \
     -H 'content-type: application/json' \
     -d '{"reason":"daily loss limit"}'
   # and later: POST /api/v1/accounts/$ACCOUNT_ID/unblock
   ```

**Next:** [Trader vs operator](https://docs.troncharts.xyz/docs/auth/audiences/) · [Orders & OMS](https://docs.troncharts.xyz/docs/trading/orders/) · [Order lifecycle](https://docs.troncharts.xyz/docs/trading/order-lifecycle/)