Account Management
The Account Management APIs allow you to create and manage user accounts on the PiTrade platform. You can create two types of accounts: Trading Accounts and Signal Accounts.
Account Types
Trading Account
A Trading Account enables users to:
- Place real trading orders in the market
- Execute buy and sell orders with actual capital
- Require wallet funding for trading
- Access full portfolio management features
- Participate in copy trading as a trader
Use Case: For users who want to actively trade stocks and manage their portfolio.
Signal Account
A Signal Account enables users to:
- Create and broadcast trading signals
- Share trading strategies with other users
- No capital required (no wallet funding needed)
- Cannot execute real trades
- Participate in copy trading as a signal provider
Use Case: For experienced traders who want to share their strategies without managing capital.
Create Account
Endpoint: POST /account
Description: Create a new user account on the PiTrade platform
Request Body
{
"email": "user@example.com",
"firstName": "John",
"lastName": "Doe",
"accountType": "TRADING" | "SIGNAL",
"password": "securePassword123"
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | Yes | User's email address (must be unique) |
firstName | string | Yes | User's first name |
lastName | string | Yes | User's last name |
accountType | string | Yes | Account type: TRADING or SIGNAL |
password | string | Yes | User's password (minimum 8 characters) |
cURL Example
# Create a Trading Account
curl -X POST {{BASE_URL}}/account \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"email": "trader@example.com",
"firstName": "John",
"lastName": "Doe",
"accountType": "TRADING",
"password": "securePassword123"
}'
# Create a Signal Account
curl -X POST {{BASE_URL}}/account \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"email": "signalprovider@example.com",
"firstName": "Jane",
"lastName": "Smith",
"accountType": "SIGNAL",
"password": "securePassword456"
}'
Node.js Example
const axios = require("axios");
async function createAccount(token, accountData) {
try {
const response = await axios.post(
"{{BASE_URL}}/account",
accountData,
{
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
},
);
return response.data;
} catch (error) {
console.error("Error creating account:", error.response?.data);
throw error;
}
}
// Create Trading Account
const tradingAccount = await createAccount(token, {
email: "trader@example.com",
firstName: "John",
lastName: "Doe",
accountType: "TRADING",
password: "securePassword123",
});
console.log("Trading Account Created:", tradingAccount);
// Create Signal Account
const signalAccount = await createAccount(token, {
email: "signalprovider@example.com",
firstName: "Jane",
lastName: "Smith",
accountType: "SIGNAL",
password: "securePassword456",
});
console.log("Signal Account Created:", signalAccount);
Response
Success Response (201 Created):
{
"success": true,
"userId": "user-uuid-123",
"email": "trader@example.com",
"accountType": "TRADING",
"createdAt": "2025-01-15T10:30:00Z",
"message": "Account created successfully"
}
Error Response (400 Bad Request):
{
"success": false,
"error": "Email already exists",
"code": "EMAIL_EXISTS"
}
Account Type Comparison
| Feature | Trading Account | Signal Account |
|---|---|---|
| Place Real Trades | ✓ | ✗ |
| Create Signals | ✓ | ✓ |
| Requires Wallet | ✓ | ✗ |
| Copy Trading (Trader) | ✓ | ✗ |
| Copy Trading (Provider) | ✓ | ✓ |
| Portfolio Management | ✓ | ✗ |
| Fund Deposits | ✓ | ✗ |
Trading Account Setup - Broker Profile
For Trading Accounts, users must complete a one-time broker profile setup to enable real trading functionality. This is a required step after account creation.
Setup Process
- Account Created - User receives confirmation email with login credentials
- Login to PiTrade App - User logs in using the created email and password
- Complete Broker Profile - User fills out required broker profile information
- Verification - System verifies the information
- Trading Enabled - Account is ready for trading
Important Notes
- One-Time Setup - Broker profile only needs to be completed once
- Required for Trading - Cannot place trades until profile is complete
- Verification Time - Profile verification typically takes 1-2 business days
- Signal Accounts - Do not require broker profile setup
User Guide
For detailed instructions on completing the broker profile and account setup, refer to:
- Creating Your Account - Step-by-step account creation guide
- Profile Settings - Managing account information
Signal Account Setup
Signal Accounts do not require broker profile setup and can start creating signals immediately after account creation.
Common Errors
Email Already Exists
{
"success": false,
"error": "Email already exists",
"code": "EMAIL_EXISTS"
}
Solution: Check if the email is already registered or allow user to use a different email.
Invalid Account Type
{
"success": false,
"error": "Invalid account type. Must be TRADING or SIGNAL",
"code": "INVALID_ACCOUNT_TYPE"
}
Solution: Ensure accountType is either TRADING or SIGNAL.
Weak Password
{
"success": false,
"error": "Password must be at least 8 characters",
"code": "WEAK_PASSWORD"
}
Solution: Require users to enter a stronger password.
Next Steps
- Creating Your Account - Complete guide for account setup and broker profile
- Bank Linking - Link bank accounts for fund transfers
- Fund Deposits - Add funds to Trading Accounts
- Trading Endpoints - Place trades with Trading Accounts
- Portfolio Access - Retrieve account information