// First, get JWT token from API key
const tokenResponse = await fetch('https://api.paperinvest.io/v1/auth/token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ apiKey: 'your_api_key' })
});
const { access_token } = await tokenResponse.json();
// Place a market order
const response = await fetch('https://api.paperinvest.io/v1/orders', {
method: 'POST',
headers: {
'Authorization': `Bearer ${access_token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
accountId: 'your-account-id',
portfolioId: 'your-portfolio-id',
symbol: 'AAPL',
quantity: 100,
side: 'buy',
type: 'market',
timeInForce: 'day'
})
});
const order = await response.json();
console.log(`Order status: ${order.status}`);
console.log(`Filled at: $${order.avgFillPrice}`);
// Get real-time quote for a symbol
const quoteResponse = await fetch(
'https://api.paperinvest.io/v1/market-data/quote/AAPL',
{
headers: {
'Authorization': `Bearer ${access_token}`
}
}
);
const quote = await quoteResponse.json();
console.log(`Current price: $${quote.last}`);
console.log(`Bid: $${quote.bid} x ${quote.bidSize}`);
console.log(`Ask: $${quote.ask} x ${quote.askSize}`);
// Get batch quotes for multiple symbols
const batchResponse = await fetch(
'https://api.paperinvest.io/v1/market-data/quotes/batch',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${access_token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
symbols: ['AAPL', 'GOOGL', 'MSFT']
})
}
);
Every API endpoint designed to mirror real trading conditions and help you build better trading systems
NBBO matching, queue position simulation, partial fills, and slippage modeling. Test your algorithms with real market conditions.
Enterprise-grade security with API key authentication, JWT tokens, and comprehensive audit logging.
Smart rate limiting, comprehensive error handling, and detailed documentation. Built for serious trading applications.
Everything you need to build sophisticated trading systems
POST /v1/orders
Create OrderSubmit market, limit, stop, and bracket orders
GET /v1/orders/{orderId}
Get OrderRetrieve order details with fill information
PUT /v1/orders/{orderId}/cancel
Cancel OrderCancel pending orders with realistic latency
POST /v1/orders/batch
Batch OrdersSubmit multiple orders in a single request
GET /v1/accounts/portfolios/{id}
PortfolioReal-time portfolio value, positions, and P&L
GET /v1/market-data/quote/{symbol}
QuoteReal-time NBBO quotes with bid/ask sizes
POST /v1/market-data/quotes/batch
Batch QuotesGet quotes for multiple symbols efficiently
GET /v1/activity-log/portfolio/{id}
Activity LogTrack all trading activity and events
Test your trading bots with realistic market conditions before deploying real capital. Perfect for momentum, mean reversion, and arbitrage strategies.
Forward-test your strategies with live market data. See how your algorithms perform with real slippage and market impact.
Integrate paper trading into your educational platform. Give students realistic trading experience without financial risk.
Get your free API key and start building in minutes. No credit card required.
Free tier includes 5 trades per day. View pricing for unlimited access.