Skip to main content

Connect Account

Connect a new trading account (exchange account).

Endpoint​

POST /api/v3/tradingAccount/connect

Description​

Connects an exchange trading account using API credentials. Once connected, the trading account can be used for trading operations and portfolio management.

Authentication​

Requires Bearer token authentication.

Authorization: Bearer {access_token}

Request Body​

FieldTypeRequiredDescription
venuestringYesExchange venue (e.g., BINANCE, COINBASE)
apiKeystringYesExchange API key
apiSecretstringYesExchange API secret
apiPassphrasestringNoAPI passphrase (required for some exchanges like Coinbase)
namestringNoCustom name for the trading account
accountTypestringNoAccount type (e.g., SPOT, MARGIN, FUTURES)

Response​

Returns the connected trading account object.

FieldTypeDescription
tradingAccountIdstringUnique trading account identifier
userIdstringUser ID
venuestringExchange venue
namestringTrading account name
accountTypestringAccount type
statusstringAccount status (ACTIVE, DISABLED)
createdAtintegerCreation timestamp (milliseconds)
updatedAtintegerLast update timestamp (milliseconds)

Usage​

import requests

headers = {"Authorization": f"Bearer {access_token}"}

# Connect a Binance account
response = requests.post(
"https://cadenza-api-uat.algo724.com/api/v3/tradingAccount/connect",
headers=headers,
json={
"venue": "BINANCE",
"apiKey": "your-api-key",
"apiSecret": "your-api-secret",
"name": "My Binance Account"
}
)

account = response.json()["data"]
trading_account_id = account["tradingAccountId"]
print(f"Connected trading account: {trading_account_id}")

# Connect a Coinbase account (requires passphrase)
response = requests.post(
"https://cadenza-api-uat.algo724.com/api/v3/tradingAccount/connect",
headers=headers,
json={
"venue": "COINBASE",
"apiKey": "your-api-key",
"apiSecret": "your-api-secret",
"apiPassphrase": "your-passphrase",
"name": "My Coinbase Account"
}
)
curl -X POST https://cadenza-api-uat.algo724.com/api/v3/tradingAccount/connect \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
-H "Content-Type: application/json" \
-d '{
"venue": "BINANCE",
"apiKey": "your-api-key",
"apiSecret": "your-api-secret",
"name": "My Trading Account"
}'

Example Response​

{
"data": {
"tradingAccountId": "550e8400-e29b-41d4-a716-446655440000",
"userId": "user-uuid-here",
"venue": "BINANCE",
"name": "My Binance Account",
"accountType": "SPOT",
"status": "ACTIVE",
"createdAt": 1703052635110,
"updatedAt": 1703052635110
},
"success": true,
"errno": 0,
"error": null
}

Error Responses​

HTTP CodeErrorDescription
400Invalid requestMissing or invalid parameters
400Invalid credentialsAPI credentials are invalid
401UnauthorizedInvalid or expired access token
403ForbiddenInsufficient permissions

Example Error​

{
"data": null,
"success": false,
"errno": -120001,
"error": "Invalid API credentials for BINANCE"
}

Notes​

  • API credentials are validated against the exchange during connection
  • Credentials are stored securely and encrypted
  • The trading account must have appropriate permissions on the exchange (trading, read balance, etc.)
  • Some exchanges require additional fields (passphrase, specific permissions)
  • Use tradingAccount.disconnect to remove a trading account