Documentation

Code Examples

API usage examples in multiple languages. All examples use the public endpoint without authentication.

cURL

# Get latest 10 news items
curl -s "https://www.instnews.net/api/news?limit=10" | jq .

# Search for NVIDIA news
curl -s "https://www.instnews.net/api/news?q=nvidia&limit=5" | jq .

# News for specific tickers (matches each item's target_asset)
curl -s "https://www.instnews.net/api/news?tickers=NVDA&limit=5" | jq .

# Get bullish headlines only
curl -s "https://www.instnews.net/api/news?sentiment=bullish&limit=10" | jq .

Python

import requests

BASE_URL = "https://www.instnews.net"

# Get latest bullish news
response = requests.get(f"{BASE_URL}/api/news", params={
    "sentiment": "bullish",
    "limit": 10,
})

for item in response.json()["items"]:
    score = item.get("sentiment_score")  # Pro/Max only
    label = f"{score:+.2f}" if score is not None else "n/a"
    print(f"[{label}] {item['title']}")

Ticker Filter (Python)

import requests

response = requests.get("https://www.instnews.net/api/news", params={
    "tickers": "NVDA",  # comma-separated, e.g. "NVDA,AMD"
    "limit": 5,
})

for item in response.json()["items"]:
    print(f"[{item['target_asset']}] {item['source']}: {item['title']}")

SSE Streaming (Python)

import json
import requests

URL = "https://www.instnews.net/api/news/stream"
since_seq = "latest"

while True:  # the server closes each stream after ~10 min; resume losslessly
    with requests.get(URL, params={"since_seq": since_seq}, stream=True, timeout=60) as resp:
        event = None
        for line in resp.iter_lines(decode_unicode=True):
            if line.startswith("id: "):
                since_seq = line[4:]
            elif line.startswith("event: "):
                event = line[7:]
            elif line.startswith("data: ") and event in ("verdict", "priced_in"):
                item = json.loads(line[6:])["data"]
                print(event, item.get("target_asset"), item["title"])

JavaScript / Node.js

const BASE_URL = "https://www.instnews.net";

async function getNews(params = {}) {
  const query = new URLSearchParams(params);
  const res = await fetch(`${BASE_URL}/api/news?${query}`);
  return res.json();
}

const data = await getNews({ sentiment: "bullish", limit: 10 });
data.items.forEach(item =>
  console.log(`[${item.source}] ${item.title}`)
);

Go

package main

import (
    "encoding/json"
    "fmt"
    "net/http"
)

type NewsResponse struct {
    Count int        `json:"count"`
    Items []NewsItem `json:"items"`
}
type NewsItem struct {
    Title  string  `json:"title"`
    Source string  `json:"source"`
    Score  float64 `json:"sentiment_score"`
}

func main() {
    resp, _ := http.Get("https://www.instnews.net/api/news?limit=5")
    defer resp.Body.Close()
    var result NewsResponse
    json.NewDecoder(resp.Body).Decode(&result)
    for _, item := range result.Items {
        fmt.Printf("[%s] %s\n", item.Source, item.Title)
    }
}

R

library(httr)
library(jsonlite)

base_url <- "https://www.instnews.net"

response <- GET(
  paste0(base_url, "/api/news"),
  query = list(sentiment = "bullish", limit = 20)
)

data <- fromJSON(content(response, "text"))
df <- data$items
# sentiment_score requires a Pro/Max API key (X-API-Key header);
# anonymous responses omit it, so select defensively:
print(df[, intersect(c("source", "title", "sentiment_score"), names(df))])

Rust

use reqwest;
use serde::Deserialize;

#[derive(Debug, Deserialize)]
struct NewsResponse {
    count: u32,
    items: Vec<NewsItem>,
}
#[derive(Debug, Deserialize)]
struct NewsItem {
    title: String,
    source: String,
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let url = "https://www.instnews.net/api/news?limit=5";
    let resp: NewsResponse = reqwest::get(url).await?.json().await?;
    for item in &resp.items {
        println!("[{}] {}", item.source, item.title);
    }
    Ok(())
}

Trading Bot Pattern (Python)

import time
import requests

BASE_URL = "https://www.instnews.net"
seen_ids = set()

while True:
    try:
        response = requests.get(f"{BASE_URL}/api/news", params={"limit": 50})
        data = response.json()
        for item in data["items"]:
            if item["id"] not in seen_ids:
                seen_ids.add(item["id"])
                print(f"NEW: [{item['source']}] {item['title']}")
                # trigger your trading logic here
    except requests.RequestException as e:
        print(f"Error: {e}")
    time.sleep(5)