Looking for the Tree Terminal docs? They are at tree.news/terminal/docs. This page is the Tree News API: the live feed and the news archive.

Tree News API

The live feed over a WebSocket and the archive over HTTP. Both answer without an account. A key adds what your plan includes.

Live feed
wss://tree.news/ws
Each item the moment it is published, as JSON.
History
GET https://tree.news/api/history
Every item since July 2020, by time, coin, source or words.
wss://tree.news/ws Not connected
The public feed, as your code would receive it.

Access and keys

No key is needed for the public feed. Your key is on your Account page and carries your plan.

No keyWith your key
Exchange announcementsLiveLive
X and Truth Social postsLiveLive
Blogs and US government pages5 seconds lateLive on any plan
Headlines (the wires)Economic data releases onlyOn a plan
Cases, Filings, Onchain, ScrapersNoOn a plan
Importance floor and scoresNoOn a plan, or with 10,000 TREE held
HistoryPublic sourcesThe sources of your plan

Plans lists what each plan includes.

  • HTTP: send the key in the tree-api-key header.
  • WebSocket: send login YOUR_API_KEY as a text message once connected.

Live feed

Open wss://tree.news/ws. Items start arriving at once: there is nothing to subscribe to. Every message is a text frame holding one JSON object, except the answer to ping.

JavaScript Python
const ws = new WebSocket("wss://tree.news/ws");

ws.onopen = () => {
  ws.send("login YOUR_API_KEY");   // leave out for the public feed
};

ws.onmessage = (event) => {
  if (event.data === "pong") return;
  const message = JSON.parse(event.data);
  if (!message._id) return;        // an answer to a command, not an item
  console.log(message.time, message.source || message.type, message.title);
};

ws.onclose = () => {
  // reconnect here, after a short wait that grows
};

After login the socket answers {"time": ..., "user": {...}}, or {"time": ..., "success": false} for a key that is not valid. Nothing is sent while the login is being checked. What was published meanwhile follows in order.

Messages

An item always has _id and time. It comes in one of two shapes.

A news item has source, title and url: an exchange announcement, a blog article, a headline.

{
  "_id": "1796303249805WBPtTLoMCSF",
  "time": 1796303249805,
  "source": "Blogs",
  "sourceName": "WSJ",
  "title": "WSJ: Bitcoin Plunges to Two-Year Low on Mounting Cryptography Security Fears",
  "en": "WSJ: Bitcoin Plunges to Two-Year Low on Mounting Cryptography Security Fears",
  "url": "https://www.wsj.com/finance/investing/bitcoin-sinks-below-56-000-as-cryptography-fears-grow-678bbc1c",
  "symbols": [],
  "suggestions": [
    {"coin": "BTC", "found": ["Bitcoin"], "supply": 20119925, "symbols": [
      {"exchange": "binance-futures", "symbol": "BTCUSDT"},
      {"exchange": "binance", "symbol": "BTCUSDT"},
      {"exchange": "bybit-perps", "symbol": "BTCUSDT"}]}
  ],
  "stockSuggestions": [{"ticker": "IBIT", "found": ["bitcoin"]}],
  "delay": 5000,
  "show_feed": true,
  "show_notif": true
}

A post has "type": "direct": the account in title, the text in body, the post in link. Its _id is the post's own number. The post below also named ETH, USDC, ARB and CRV: they are left out here.

{
  "_id": "2128475404679712979",
  "time": 1796303056692,
  "type": "direct",
  "title": "1inch (@1inch)",
  "body": "What are intent-based swaps? Intent-based swaps let you state the trade you want, then let independent resolvers ...",
  "link": "https://x.com/1inch/status/2128475404679712979#",
  "icon": "https://pbs.twimg.com/profile_images/2008094233266376705/gypmfWbU_400x400.jpg",
  "image": "https://pbs.twimg.com/media/HYdzUdiWwAANagY.jpg",
  "info": {"twitterId": "1137038394503114753", "isReply": false, "isRetweet": false, "isQuote": false, "truthId": null, "isSelfReply": false},
  "coin": "1INCH",
  "suggestions": [
    {"coin": "1INCH", "found": ["1INCH", "1inch"], "supply": 1500000000, "symbols": [
      {"exchange": "binance-futures", "symbol": "1INCHUSDT"},
      {"exchange": "binance", "symbol": "1INCHUSDT"},
      {"exchange": "bybit-perps", "symbol": "1INCHUSDT"}]}
  ],
  "stockSuggestions": [],
  "show_feed": true,
  "show_notif": true
}

Every field is in Item fields. Anything without _id is an answer to a command, a score follow-up or a heartbeat.

Commands

Commands are plain text messages you send. Each one is answered at once.

SendAnswer
login KEY{"time", "user"}Your plan on this socket.
pingpongPlain text, not JSON.
user{"time", "user"}The name you are logged in as, or Not Logged In.
heartbeat on{"time", "heartbeat", "every", "seq"}Then {"type": "heartbeat", "time", "seq"} every 5 seconds. heartbeat off stops it.
min 7{"time", "filter": {"min"}}Only items scored 7 or more. min off removes it, min asks.
scores on{"time", "scores"}The score of each item, sent after it. scores off stops it.

The same options work in the address, so they hold from the first message: wss://tree.news/ws?heartbeat=on&min=7.

Importance floor and scores

Each item is scored from 1 to 10 for how much it matters to traders. The floor and the scores come with a plan, or with 10,000 TREE held. Without either the answer carries a note saying so and the feed stays as it was.

  • No floor: an item is sent the moment it is published, before it is scored.
  • min from 5 to 10: an item is sent once scored, about 0.3 seconds later, with importance in it, and only at or above the floor. An item that tells again one you already received is skipped.
  • scores on without a floor: items arrive at once, and each is followed by {"id", "importance"}. A repeat also carries "old": true and "repeatOf", the _id of the earlier item.
{"id": "1796283087508SSIGPLoMbM2", "importance": 5.8}
{"id": "1796302675196TBcb5htlaAcfscm", "importance": 5.1, "old": true, "repeatOf": "2128164797464158537", "mainStock": "IBIT"}

Staying connected

  • The server pings every socket. A client that answers pings, as every WebSocket library does, stays open.
  • Sockets close when we restart. Reconnect after a short wait that grows with each failed try.
  • Ask for the heartbeat. No heartbeat for 15 seconds means the stream has stalled: close and reconnect.
  • seq in the heartbeat counts the items and score follow-ups pushed to your socket so far. If your own count is lower, you missed some.
  • After a reconnect, GET /api/news?limit=100 returns the latest items so you can fill the gap by _id.

History

GET https://tree.news/api/history answers a JSON array of items, newest first. It holds every item of the public feed since July 2020. An item appears here about a minute after it is published.

GET
Parameter
limitHow many items. 5,000 at most, and 5,000 when left out.
beforeOnly items published before this time, in milliseconds.
afterOnly items published after this time, in milliseconds.
coinOnly items tagged with this coin: coin=BTC.
sourceOnly this source, any case: source=blogs.
queryText that the headline or the link contains, any case.
matchLike query, and it can be given up to 12 times: every one must be found. match=etf|fund finds either word.
notWords that must not be found. Can be repeated.
minImportanceScored at least this, and not a repeat of an earlier item.
minMoveA tagged coin moved at least this many percent, up or down, within the hour after. Items younger than an hour never match.
sorttime for oldest first, -move for the biggest movers first, -importance for the highest scores first.
# the 20 latest items about ETH
curl "https://tree.news/api/history?coin=ETH&limit=20"

# Binance announcements that say "will list", with your plan's sources
curl -H "tree-api-key: YOUR_API_KEY" "https://tree.news/api/history?source=binance%20en&match=will%20list&limit=50"

# everything published on 21 November 2024 (UTC), oldest first
curl "https://tree.news/api/history?after=1732147199999&before=1732233600000&sort=time"

Paging

An answer stops at limit. For the next page, pass before with the time of the last item you received, and repeat until the answer is empty.

let before = Date.now(), all = [];
while (true) {
  const answer = await fetch("https://tree.news/api/history?coin=SOL&limit=1000&before=" + before);
  const page = await answer.json();
  if (!page.length) break;
  all.push(...page);
  before = page[page.length - 1].time;
}

To walk the archive forward, take it one window at a time with after and before together, a day or a week each.

One item, and the latest items

Request
GET /api/news?id=IDOne item by its _id, from any year.
GET /api/news?limit=100The latest items, 10 seconds behind the live feed.
curl "https://tree.news/api/news?id=1732193907594BUNLPwBC"

Times, for backtests

  • time is the millisecond we published the item, in UTC. The live feed sent it then. The HTTP routes show it from 10 seconds later.
  • There is one time per item. A later telling of the same story is a new item with its own time.
  • Known at time: title, source, url, the coin tags and firstPrice.
  • Added within about a second: importance, old, repeatOf. Added afterwards: kind. A blog's coin tags can be trimmed after it is published.
  • Added about an hour later: impact and reaction. They describe what the price did after the item, so keep them out of anything that decides at time.
  • Items carry a score from late September 2026 on.

Item fields

Field
_idThe item's id, a string. For a news item it starts with the millisecond it was published. For an X post it is the post's number.
timeWhen we published it, in milliseconds since 1970, UTC.
sourceWhere it came from. See Sources.
sourceNameThe outlet or project behind a blog item.
titleThe headline. For a post in the history: the account, then the text.
enThe headline in English when it was published in another language. Otherwise the same as title, or null.
urlThe original article, announcement or post.
suggestionsThe coins it is about. Each has coin, found (the words that matched), symbols (the pairs, each with exchange and symbol) and supply.
stockSuggestionsThe stocks it is about, each with ticker.
firstPriceThe Binance price of each tagged coin when the item was published: {"BTCUSDT": 52747.4}.
importanceThe score, 1 to 10. null when it could not be scored.
old, repeatOfold is true when the item tells again an earlier one. repeatOf is that item's _id.
kind, venueWhat kind of story it is: listing, delisting, launch, hack, etf, macro, policy, earnings, opinion and more. venue is the exchange of a listing or delisting.
tradersWho it matters to: crypto, stocks, both or neither.
mainStockThe stock it moves most, when there is one.
impactThe move in the hour after: coin, symbol, pct (the larger of the two swings), up, down, peakAt.
reactionThe first coin's minute-by-minute price around the item, as the site charts it.
bigTrue for a Big story, picked by the news desk.
icon, image, infoOn posts: the account's picture, the post's first image, and info with twitterId, isReply, isRetweet, isQuote, isSelfReply. A Truth Social post has truthId. A quote has quotedUser.

On the live feed only:

Field
type, body, linkA post: "type": "direct", its text, its address. The account is in title.
coin, videoOn a post: the first coin it is about, and its video when it has one.
delayHow long the item was held for a socket without a plan, in milliseconds.
show_feed, show_notifWhether your Settings show this source in the feed and alert on it. Both true without a login.

Sources

The value of source on an item, and what source= takes in the history.

SourceNeeds
Binance EN Upbit Bithumb ExchangesExchange announcements. Exchanges covers the other exchanges.Nothing
Twitter Truth SocialPosts of the accounts Tree News follows for everyone.Nothing
BlogsNews outlets, project blogs and press releases.Nothing
usGovUS government pages.Nothing
TerminalHeadlines: the wires.A plan
Cases FilingsUS court cases and SEC filings that carry news.A plan
Onchain ScrapersSuspected thefts read off the chains, and Tree News' own scrapers.A plan

Headlines+, the second and larger wire feed, comes with Sapling or a Tree NFT.

Limits

Live connections from one address5 without a plan, 7 with one. One more is refused when it connects.
Messages you send on a socket200 a minute. Past that they are not read. Far past that the socket is closed.
Size of a message you send16 KB.
A socket that does not readClosed once it is 2 MB behind for 15 seconds.
/api/news30 requests a minute from one address.
/api/history5,000 items an answer.

For new items, listen on the socket. Polling the history is slower and shows each item later.

Questions go to the Tree Discord.