Skip to main content
QFEX provides three REST endpoints for subaccount workflows:
  • GET /user/subaccounts
  • POST /user/subaccounts
  • POST /user/transfer
These endpoints require authentication.

Authentication

The CLI authenticates these requests with either:
  • Authorization: Bearer <access_token> after qfex login, or
  • QFEX HMAC headers when API keys are configured
For HMAC auth, sign ${nonce}:${unix_ts} with HMAC-SHA256 using your secret key, then hex-encode the result. Send:
  • x-qfex-public-key
  • x-qfex-hmac-signature
  • x-qfex-nonce
  • x-qfex-timestamp

List Subaccounts

Returns the authenticated user’s secondary account IDs.
GET /user/subaccounts
CLI command:
qfex account subaccounts list
Example:
curl https://api.qfex.com/user/subaccounts \
  -H "accept: application/json" \
  -H "x-qfex-public-key: $QFEX_PUBLIC_KEY" \
  -H "x-qfex-hmac-signature: $SIG" \
  -H "x-qfex-nonce: $NONCE" \
  -H "x-qfex-timestamp: $TS"
Response shape:
{
  "account_ids": [
    "11111111-1111-1111-1111-111111111111",
    "22222222-2222-2222-2222-222222222222"
  ]
}

Create Subaccount

Allocates a new subaccount for the authenticated user.
POST /user/subaccounts
Content-Type: application/json
CLI command:
qfex account subaccounts create
The CLI sends an empty JSON body. Example:
curl https://api.qfex.com/user/subaccounts \
  -X POST \
  -H "content-type: application/json" \
  -H "accept: application/json" \
  -H "x-qfex-public-key: $QFEX_PUBLIC_KEY" \
  -H "x-qfex-hmac-signature: $SIG" \
  -H "x-qfex-nonce: $NONCE" \
  -H "x-qfex-timestamp: $TS" \
  -d '{}'

Transfer Between Primary Account And Subaccounts

Transfers balance between two accounts owned by the authenticated user.
POST /user/transfer?src_account_id=<account-id>&dst_account_id=<account-id>
Content-Type: application/json
CLI command:
qfex account subaccounts transfer --from <account-id|primary> --to <account-id|primary> --amount <usd>
The CLI resolves primary to the authenticated user’s primary account ID, then sends:
  • src_account_id as a query parameter
  • dst_account_id as a query parameter
  • {"amount": <number>} as the JSON body
Example:
curl "https://api.qfex.com/user/transfer?src_account_id=$PRIMARY_ACCOUNT_ID&dst_account_id=$SUBACCOUNT_ID" \
  -X POST \
  -H "content-type: application/json" \
  -H "accept: application/json" \
  -H "x-qfex-public-key: $QFEX_PUBLIC_KEY" \
  -H "x-qfex-hmac-signature: $SIG" \
  -H "x-qfex-nonce: $NONCE" \
  -H "x-qfex-timestamp: $TS" \
  -d '{"amount":100}'