API Documentation
Access real-time press releases from major wire services via REST API or WebSocket. Get the news before everyone else.
Base URL
https://api.rtpr.ioAuthentication
Include your API key as a Bearer token:
Authorization: Bearer YOUR_API_KEYRate Limits
60 requests per minute
Query Parameters
limitoptionalNumber of articles to return (default: 20, max: 100)
Response
{
"count": 20,
"articles": [
{
"ticker": "AAPL",
"exchange": "NASDAQ",
"title": "Apple Announces Q4 Results",
"author": "Business Wire",
"created": "Mon, 28 Jul 2025 16:30:00 -0400",
"article_body": "Apple Inc. announced financial results for its fiscal fourth quarter ended September 30, 2025...",
"article_body_html": "<p>Apple Inc. announced financial results for its fiscal fourth quarter ended September 30, 2025...</p>"
}
]
}Code Examples
const response = await fetch('https://api.rtpr.io/articles', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const data = await response.json();
console.log('Found ' + data.count + ' articles');
data.articles.forEach(article => {
console.log(article.ticker + ': ' + article.title);
});💡 JavaScript Notes:
- • Works in Node.js and modern browsers
- • Uses native fetch API (no external dependencies)
- • Async/await for clean promise handling
Path Parameters
tickerrequiredStock ticker symbol (e.g., AAPL, TSLA, MSFT)
Query Parameters
limitoptionalNumber of articles to return (default: 50, max: 100)
Response
{
"count": 3,
"articles": [
{
"ticker": "AAPL",
"exchange": "NASDAQ",
"title": "Apple Announces Q4 Results",
"author": "Business Wire",
"created": "Mon, 28 Jul 2025 16:30:00 -0400",
"article_body": "Apple Inc. announced financial results for its fiscal fourth quarter ended September 30, 2025...",
"article_body_html": "<p>Apple Inc. announced financial results for its fiscal fourth quarter ended September 30, 2025...</p>"
}
]
}Code Examples
const ticker = 'AAPL';
const response = await fetch('https://api.rtpr.io/articles/' + ticker, {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const data = await response.json();
if (data.count > 0) {
console.log('Found ' + data.count + ' articles for ' + ticker);
data.articles.forEach(article => {
console.log('📰 ' + article.title);
console.log('🕒 ' + article.created);
console.log('✍️ ' + article.author);
console.log('---');
});
} else {
console.log('No articles found for ' + ticker);
}💡 JavaScript Notes:
- • Works in Node.js and modern browsers
- • Uses native fetch API (no external dependencies)
- • Async/await for clean promise handling
WebSocket API
Get press releases pushed to you instantly via WebSocket. Sub-500ms latency from wire release to your application.
WebSocket URL
wss://ws.rtpr.ioAuthentication
Pass your API key as a query parameter when connecting:
wss://ws.rtpr.io?apiKey=YOUR_API_KEYConnection Limits
1 concurrent WebSocket connection per API key
💡 Why WebSocket?
- • Sub-500ms latency — Articles delivered as they hit the wire
- • No polling — Server pushes articles to you instantly
- • Ticker subscriptions — Only receive articles for tickers you care about
- • Efficient — Single persistent connection, no repeated API calls
How it works: After connecting, send a subscribe message with your desired tickers. You'll only receive articles that match your subscription. You can update your subscription anytime without reconnecting.
Send this message to specify which tickers you want to receive
// Subscribe to specific tickers
{
"action": "subscribe",
"tickers": ["AAPL", "TSLA", "NVDA", "MSFT"]
}
// Subscribe to ALL tickers (firehose mode)
{
"action": "subscribe",
"tickers": ["*"]
}Server confirms your subscription
{
"type": "subscribed",
"tickers": ["AAPL", "TSLA", "NVDA", "MSFT"],
"message": "Subscribed to 4 tickers",
"timestamp": "2025-07-28T16:30:00.000Z"
}Remove specific tickers from your subscription
// Unsubscribe from specific tickers
{
"action": "unsubscribe",
"tickers": ["TSLA"]
}
// Unsubscribe from all (pause feed)
{
"action": "unsubscribe",
"tickers": ["*"]
}Common Subscription Patterns
Watch a Watchlist
{"action": "subscribe", "tickers": ["AAPL", "GOOGL", "MSFT", "AMZN"]}All News (Firehose)
{"action": "subscribe", "tickers": ["*"]}Add a Ticker
{"action": "subscribe", "tickers": ["NVDA"]} // adds to existingPause Feed
{"action": "unsubscribe", "tickers": ["*"]}Sent immediately after successful authentication. Send your subscription after receiving this.
{
"type": "connected",
"message": "Connected to RTPR real-time feed",
"timestamp": "2025-07-28T16:30:00.000Z"
}Confirms your ticker subscription was successful
{
"type": "subscribed",
"tickers": ["AAPL", "TSLA", "NVDA"],
"message": "Subscribed to 3 tickers",
"timestamp": "2025-07-28T16:30:00.000Z"
}Pushed instantly when a new press release is published
{
"type": "article",
"data": {
"id": "abc123",
"ticker": "AAPL",
"exchange": "NASDAQ",
"tickers": ["AAPL", "MSFT"],
"title": "Apple Announces Strategic Partnership",
"author": "Business Wire",
"created": "2025-07-28T16:30:00.000Z",
"article_body": "Apple Inc. today announced a strategic partnership...",
"article_body_html": "<p>Apple Inc. today announced a strategic partnership...</p>"
},
"timestamp": "2025-07-28T16:30:00.123Z"
}Sent every 30 seconds to keep the connection alive. Respond with a pong message.
{
"type": "ping",
"timestamp": "2025-07-28T16:30:30.000Z"
}Sent when an error occurs (authentication failure, rate limit, etc.)
{
"type": "error",
"code": "AUTH_FAILED",
"message": "Invalid API key",
"timestamp": "2025-07-28T16:30:00.000Z"
}// Browser JavaScript WebSocket Example
const API_KEY = 'YOUR_API_KEY';
const WATCHLIST = ['AAPL', 'TSLA', 'NVDA', 'MSFT'];
const ws = new WebSocket(`wss://ws.rtpr.io?apiKey=${API_KEY}`);
ws.onopen = () => {
console.log('✅ Connected to RTPR real-time feed');
};
ws.onmessage = (event) => {
const message = JSON.parse(event.data);
switch (message.type) {
case 'connected':
console.log('🟢 ' + message.message);
// Subscribe to your watchlist after connecting
ws.send(JSON.stringify({
action: 'subscribe',
tickers: WATCHLIST
}));
break;
case 'subscribed':
console.log('📋 Subscribed to:', message.tickers.join(', '));
break;
case 'article':
const article = message.data;
console.log('📰 NEW ARTICLE:', article.ticker);
console.log(' Title:', article.title);
console.log(' Source:', article.author);
console.log(' Time:', article.created);
// Process the article (e.g., trigger trading logic)
processArticle(article);
break;
case 'ping':
// Respond to keep connection alive
ws.send(JSON.stringify({ type: 'pong' }));
break;
case 'error':
console.error('❌ Error:', message.message);
break;
}
};
ws.onerror = (error) => {
console.error('WebSocket error:', error);
};
ws.onclose = (event) => {
console.log('🔌 Connection closed. Reconnecting in 5s...');
setTimeout(() => reconnect(), 5000);
};
function processArticle(article) {
// Your trading logic here
console.log('🍎 Processing:', article.ticker, '-', article.title);
}
// Add a new ticker to your subscription at any time
function addTicker(ticker) {
ws.send(JSON.stringify({
action: 'subscribe',
tickers: [ticker]
}));
}✅ Do
- • Implement reconnection logic — Connections can drop; auto-reconnect after 5s
- • Respond to ping messages — Send pong to keep connection alive
- • Process articles asynchronously — Don't block the message handler
- • Log connection events — Track connects, disconnects, and errors
- • Handle all message types — connected, article, ping, error
❌ Don't
- • Open multiple connections — 1 connection per API key
- • Ignore ping messages — Connection will timeout after 90s
- • Block on article processing — You'll miss subsequent articles
- • Expose API key in client code — Use server-side connections for production
- • Reconnect immediately on close — Use exponential backoff
| Feature | WebSocket | REST API |
|---|---|---|
| Latency | ~50-500ms (real-time push) | Depends on poll frequency |
| Best For | Real-time alerts | Dashboards |
| Connection | Persistent (always connected) | On-demand (request/response) |
| Complexity | Requires reconnection handling | Simple HTTP requests |
| Rate Limits | Unlimited incoming messages | 60 requests/minute |
💡 Recommendation: Use WebSocket for real-time trading applications where every millisecond counts. Use REST API for dashboards or research tools.
Missing required parameters (e.g., ticker parameter for /article)
Invalid or missing API key
Rate limit exceeded (60 requests per minute)
Server error - please try again or contact support