// Get token with API key
const tokenRes = 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 tokenRes.json();
// Place a paper order
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: 10, side: 'buy', type: 'market', timeInForce: 'day'
})
});
import requests
# Get token
r = requests.post('https://api.paperinvest.io/v1/auth/token', json={ 'apiKey': 'YOUR_API_KEY' })
access_token = r.json()['access_token']
# Place order
headers = { 'Authorization': f'Bearer {access_token}', 'Content-Type': 'application/json' }
order = {
'accountId': 'your-account-id',
'portfolioId': 'your-portfolio-id',
'symbol': 'MSFT', 'quantity': 5, 'side': 'buy', 'type': 'market', 'timeInForce': 'day'
}
requests.post('https://api.paperinvest.io/v1/orders', headers=headers, json=order)
Yes. The free tier lets you create an API key, stream quotes and place a limited number of simulated orders per day. Upgrade for higher limits.
Yes. You can stream real-time quotes and portfolio updates. See the WebSocket guide for details.
Any language that can call HTTP and SSE/WebSockets. We provide examples for Python and Node.