API Documentation

Access real-time press releases from major wire services via REST API or WebSocket. Get the news before everyone else.

🚀 Getting Started
Everything you need to know to start using the RTPR API

Base URL

https://api.rtpr.io

Authentication

Include your API key as a Bearer token:

Authorization: Bearer YOUR_API_KEY

Rate Limits

60 requests per minute

GET/articles
Retrieve recent press releases from all tickers

Query Parameters

limitoptional

Number 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

Try it yourself
Get recent press releases
JavaScript
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
GET/articles/{ticker}
Get press releases for a specific ticker

Path Parameters

tickerrequired

Stock ticker symbol (e.g., AAPL, TSLA, MSFT)

Query Parameters

limitoptional

Number 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

Try it yourself
Get articles for AAPL
JavaScript
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
Real-Time

WebSocket API

Get press releases pushed to you instantly via WebSocket. Sub-500ms latency from wire release to your application.

⚡ WebSocket Connection
Connect to our real-time news stream for instant updates

WebSocket URL

wss://ws.rtpr.io

Authentication

Pass your API key as a query parameter when connecting:

wss://ws.rtpr.io?apiKey=YOUR_API_KEY

Connection 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
🎯 Subscribing to Tickers
Choose which tickers you want to receive articles for — no need to filter client-side

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.

subscribeSubscribe to TickersClient → Server

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": ["*"]
}
subscribedSubscription ConfirmedServer → Client

Server confirms your subscription

{
  "type": "subscribed",
  "tickers": ["AAPL", "TSLA", "NVDA", "MSFT"],
  "message": "Subscribed to 4 tickers",
  "timestamp": "2025-07-28T16:30:00.000Z"
}
unsubscribeUnsubscribe from TickersClient → Server

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 existing

Pause Feed

{"action": "unsubscribe", "tickers": ["*"]}
📨 Message Types
Messages you'll receive over the WebSocket connection
connectedConnection Confirmed

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"
}
subscribedSubscription Confirmed

Confirms your ticker subscription was successful

{
  "type": "subscribed",
  "tickers": ["AAPL", "TSLA", "NVDA"],
  "message": "Subscribed to 3 tickers",
  "timestamp": "2025-07-28T16:30:00.000Z"
}
articleNew Article

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"
}
pingHeartbeat

Sent every 30 seconds to keep the connection alive. Respond with a pong message.

{
  "type": "ping",
  "timestamp": "2025-07-28T16:30:30.000Z"
}
errorError

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"
}
💻 WebSocket Code Examples
Connect to the real-time feed in your preferred language
// 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]
  }));
}
🎯 Best Practices
Optimize your WebSocket integration for reliability and performance

✅ 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
⚖️ WebSocket vs REST API
Choose the right approach for your use case
FeatureWebSocketREST API
Latency~50-500ms (real-time push)Depends on poll frequency
Best ForReal-time alertsDashboards
ConnectionPersistent (always connected)On-demand (request/response)
ComplexityRequires reconnection handlingSimple HTTP requests
Rate LimitsUnlimited incoming messages60 requests/minute

💡 Recommendation: Use WebSocket for real-time trading applications where every millisecond counts. Use REST API for dashboards and on-demand queries. Note: articles are available for the last 24 hours.

Error Responses
Common error codes and their meanings
400Bad Request

Missing or invalid parameters

401Unauthorized

Invalid or missing API key. Ensure you include Authorization: Bearer YOUR_API_KEY

403Forbidden

Your free trial has expired. Upgrade to Pro at rtpr.io/dashboard

429Too Many Requests

Rate limit exceeded (60 requests per minute)

500Internal Server Error

Server error - please try again or contact support

Alerts API
Create keyword and watchlist alerts to get notified when articles match your criteria. You can also manage alerts from the dashboard.

Note: Alert processing runs after the raw feed is delivered. If you need the absolute fastest delivery, use the raw WebSocket firehose. Alerts add a few milliseconds of processing time.

Endpoints

GET/alerts

List all your alert configs.

curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.rtpr.io/alerts
POST/alerts

Create a new alert rule. Max 10 per user.

curl -X POST -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "FDA Approvals",
    "keywords": ["FDA", "approval", "drug"],
    "tickers": ["PFE", "MRNA"],
    "match_scope": ["title", "body"],
    "delivery": ["email", "dashboard"]
  }' \
  https://api.rtpr.io/alerts

Request Body Parameters

name — Display name (max 100 chars)

keywords — Array of keywords to match (max 20). Case-insensitive word boundary matching.

tickers — Array of ticker symbols to watch (max 20)

match_scope — Where to search: title, body, ticker

delivery — How to notify: email, dashboard

If both keywords and tickers are specified, an article must match both (AND logic).

PUT/alerts/{alert_id}

Update an existing alert. Send only the fields you want to change.

DELETE/alerts/{alert_id}

Delete an alert rule.

GET/alerts/matches

Get recent articles that matched your alerts (last 24 hours).

limit — Max results (default: 50, max: 200)

since — ISO timestamp to fetch matches after

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.rtpr.io/alerts/matches?limit=20"
DELETE/alerts/matches/{matched_at}

Dismiss a matched alert from the dashboard feed.

Limits

  • 10 alert rules per user
  • 20 keywords per alert
  • 20 tickers per alert
  • Email alerts rate-limited to 1 per rule per 5 minutes
  • Matched alerts retained for 24 hours
Need Help?
We're here to help you succeed

📧 Email Support

Get help from our team

support@rtpr.io

📊 Dashboard

Manage your API keys and usage

rtpr.io/dashboard

💬 Community

Ask questions, share ideas

Join Discord