Partner APIs Overview
Welcome to the PiTrade Partner APIs documentation. This comprehensive guide provides developers with everything needed to integrate with our trading platform and build powerful applications.
PiTrade offers two distinct API integration flows to suit different use cases:
Integration Flows
Flow 1: PiTrade Native APIs (Standard Flow)
Our native APIs provide a simplified, streamlined interface for common trading operations. Ideal for partners who need essential trading and portfolio functionality.
Capabilities:
- Place market orders (immediate execution)
- Retrieve portfolio information
- Monitor trade execution status
- Schedule trades for future execution
Advantages:
- Simple, intuitive API design
- Quick integration
- Managed order types (market orders)
- Multi-portfolio support
Limitations:
- Limited to market order types (no limit orders, stop-loss, etc.)
- Advanced order features not supported
Flow 2: Interactive Brokers Direct API Access (Advanced Flow)
For advanced trading requirements, connect directly to Interactive Brokers APIs through our bearer token gateway. This flow unlocks full Interactive Brokers functionality while maintaining PiTrade's security standards.
Capabilities:
- Market and limit orders
- Advanced order types (stop-loss, conditional orders, etc.)
- Full Interactive Brokers API ecosystem access
- Real-time margin impact calculations
- Order preview validation
Advantages:
- Complete Interactive Brokers trading functionality
- Advanced order types and strategies
- Comprehensive margin and position analytics
- Direct access to Interactive Brokers documentation
Limitations:
- Single trading portfolio per account
- Requires Interactive Brokers session management
- More complex implementation
Getting Contract IDs:
To place orders via Interactive Brokers APIs, you need contract IDs for the securities. Interactive Brokers provides a CSV file with fractional share contract IDs:
- Download: Interactive Brokers Fractional Shares CSV
- Format: Symbol, Main Exchange, Description, IB Contract ID, Scheduled Ineligibility Date
- Usage: Look up the IB_CONTRACT_ID for your ticker symbol, use in order requests
Getting Started
To begin using the Partner APIs:
- Obtain Credentials - Get your
clientIdandapiKeyfrom PiTrade Support - Generate JWT Token - Create signed JWT tokens using your credentials
- Make API Calls - Use the token in the Authorization header for all requests
- Handle Responses - Process responses and implement error handling
Authentication Flow
All API requests require JWT authentication. Here's the basic flow:
- Create a JWT payload with your
clientIdand expiration time - Sign the JWT with your partner apiKey
- Include the token in the
Authorization: Bearer <JWT_TOKEN>header - Make your API request
Error Handling
All API responses include appropriate HTTP status codes:
200 OK- Request successful400 Bad Request- Invalid request parameters401 Unauthorized- Authentication failed or token expired403 Forbidden- Insufficient permissions429 Too Many Requests- Rate limit exceeded500 Internal Server Error- Server error
Support
For technical support or questions about the Partner APIs:
- Review the detailed endpoint documentation
- Check common issues and troubleshooting guides
- Contact PiTrade Support
Next Steps
Choose your integration path:
For Standard Trading:
- Authentication Guide - Learn how to authenticate requests
- Trading Endpoints - Place and manage trades
- Portfolio Endpoints - Access portfolio data
For Advanced Trading (Interactive Brokers Direct Access):
- Authentication Guide - Learn how to authenticate requests
- Interactive Brokers Integration Guide - Complete Interactive Brokers flow setup
- Bearer Token API - Get Interactive Brokers access tokens
- Interactive Brokers Trading APIs - Place orders via Interactive Brokers
- Interactive Brokers Session Management - Manage Interactive Brokers sessions
- Complete Interactive Brokers Flow Example - Full end-to-end example