Skip to content
JNJ$270.36-0.60(-0.22%)Johnson & Johnson Announces New Investments Of $850M+ In California And Puerto Rico As Part Of Its $55B U.S. Investment Through Early 20296:47:54 AM ETTRV$398.67-4.97(-1.23%)Renewed JR EAST PASS Makes Its Winter Debut, Linking Eastern Japan's Top Snow Destinations6:47:00 AM ETNWS$28.43-0.82(-2.80%)PRESS DIGEST-Canada - December 16:46:51 AM ETMCO$482.70+0.02(+0.00%)First Pacific Company Limited -- Moody's Ratings changes First Pacific's outlook to positive; affirms Baa3 rating6:45:47 AM ETABNB$178.00-1.16(-0.65%)Truist Lifts Price Target on Airbnb to $164 From $161, Keeps Hold Rating6:44:07 AM ETSPOT$622.82+0.27(+0.04%)Guggenheim Adjusts Price Target on Spotify Technology to $700 From $650, Maintains Buy Rating6:42:48 AM ETBP$44.22+0.64(+1.47%)BRIEF-BP's Ian Tyler to Step Down from Audit Committee Effective Dec. 16:40:34 AM ETAPP$410.51+1.90(+0.46%)Why is Applovin stock slipping today?6:40:16 AM ETKHC$25.27-0.08(-0.32%)Kraft Heinz or Kimberly-Clark? Here's Where I'd Invest $1,000.6:38:53 AM ETGOOG$294.18+2.38(+0.82%)*Google To Establish New Manufacturing, Logistics, And AI-Focused Integration Facility In Visakhapatnam, Andhra Pradesh; To Include Specialized AI Hardware Manufacturing, Supply-Chain Capabilities6:38:15 AM ETCBIO$19.45+0.48(+2.53%)Guggenheim Adjusts Price Target on Crescent Biopharma to $45 From $35, Maintains Buy Rating6:37:53 AM ETNVDA$159.60+7.20(+4.72%)If You'd Invested $10,000 in Nvidia at Its 2022 Low, Here's How Much You'd Have Today6:37:02 AM ETSRFM$0.41+0.01(+2.30%)*Surf Air Mobility Signs Definitive Agreement With QuikCharter For OperatorOS, Surf Air Mobility's SurfOS Flight Operations Software For Part 135 Operators Powered By Palantir Technologies6:33:17 AM ETNFLX$61.39-0.20(-0.32%)Italy fines Netflix over joke about Michelangelo's David genitals6:33:03 AM ETBNS$84.550.00(0.00%)CANADA STOCKS-TSX futures rise on commodity strength; investors await bank earnings6:32:40 AM ETACN$238.35-3.49(-1.44%)Update: Citigroup Adjusts Price Target on Accenture to $245 From $220, Maintains Neutral Rating6:32:31 AM ETWCN$183.00-2.57(-1.38%)Waste Connections: Best Margins In The Sector, But Not Cheap Enough6:32:18 AM ETBE$208.83+16.96(+8.81%)Social Buzz: Wallstreetbets Stocks Mostly Advancing Premarket Tuesday; Bloom Energy, Nvidia to Open Higher6:31:44 AM ETAAPL$352.58-1.40(-0.40%)Actor Michael Patrick Thornton says ‘Being Heumann’ is part of a new era for disabled actors [Chicago Tribune]6:31:36 AM ETISRG$430.00+1.17(+0.27%)Is Intuitive Surgical Stock Riskier When The Fed Hikes?6:30:25 AM ETV$428.33-0.42(-0.10%)Tech Tops Holiday Wish Lists: What's in Store for Mastercard?6:30:18 AM ETAPD$318.21-0.88(-0.28%)Here's Why You Should Retain Air Products Stock in Your Portfolio6:30:15 AM ETBAC$48.96+0.32(+0.66%)JPMorgan Tops FSB's G-SIB List: What Does It Mean for Investors?6:30:07 AM ETTT$415.50+2.63(+0.64%)Trane Technologies Launches Nationally Registered Apprenticeship Program for Controls Technicians6:30:03 AM ET
Tutorial 5 min read

Stock news API pagination: how do you page through results without skipping a row?

Page through a stock news API with cursor pagination: keep tickers, from, to, sort, and limit fixed, pass meta.next_cursor, and stop when it is gone.

To page through a stock news API without skipping a row, send the same filters on every request and pass the cursor from meta.next_cursor until it is absent. That matters at real volume. From 16 November 2026 through 20 November 2026, midnight to midnight Eastern, MarketNewsAPI indexed 28141 publisher stock news articles (category stocks, type news). At the maximum limit of 100, that is a walk of about 282 pages. A cursor walk reads each of those rows once, in order.

This tutorial pages through a single day. If you need years of history, read the backfill post after this one. The reference for every paging rule is the pagination docs.

Why cursors, not page numbers

Stock news keeps arriving while you read it. Busy hours come in the Eastern morning, around 8:00 and 9:00 a.m. Suppose a page number API returns page 2 while new stories land at the top of the list. Every row shifts down. You read some rows twice and you can miss others at the page boundary.

A cursor marks a position in one fixed, sorted result set. The next page starts right after the last row you received. New articles do not push your position around. That is the whole reason to use it.

The first request

The first request defines the result set. Set these five parameters and do not change them for the rest of the walk:

  • tickers: up to 50 symbols, comma-separated. Commas inside one filter mean OR.
  • from and to: the time window. Dates are UTC. A bare date such as 2026-11-20 means that UTC day.
  • sort: published_desc, published_asc, or relevance.
  • limit: 1 to 100. The default is 20. Use 100 to cut request count.

Here is a first request for one UTC day of news on three tickers, oldest first:

curl -G https://api.marketnewsapi.com/v1/news \
  -H "Authorization: Bearer mna-live-..." \
  --data-urlencode "tickers=PFE,MRK,JNJ" \
  --data-urlencode "type=news" \
  --data-urlencode "from=2026-11-20" \
  --data-urlencode "to=2026-11-20" \
  --data-urlencode "sort=published_asc" \
  --data-urlencode "limit=100"

The response has a data array of articles and a meta object. When more rows exist, meta.next_cursor holds an opaque string. Treat it as a token. Do not parse it or build one yourself.

A note on the count above. The 28141 total is a filter count over category stocks and type news. It is not a q search. A q search covers title, summary, and snippet, and would return a different, smaller set. The window was also Eastern days, while from and to read as UTC days, so a request like the one above will not match it row for row.

Every later request

Each later request repeats the same filters and adds cursor:

curl -G https://api.marketnewsapi.com/v1/news \
  -H "Authorization: Bearer mna-live-..." \
  --data-urlencode "tickers=PFE,MRK,JNJ" \
  --data-urlencode "type=news" \
  --data-urlencode "from=2026-11-20" \
  --data-urlencode "to=2026-11-20" \
  --data-urlencode "sort=published_asc" \
  --data-urlencode "limit=100" \
  --data-urlencode "cursor=VALUE_FROM_META_NEXT_CURSOR"

Stop when meta.next_cursor is absent. That is the only stop signal. A page with fewer rows than limit is a hint, but the missing cursor is the rule.

Do not change filters mid-walk

If you add a ticker, move to, or switch sort while holding a cursor, you are asking about a different result set. The old cursor described a position in the old set. Start a new walk from the first request instead. The same applies to exchange, category, type, include_legal, sources, exclude_sources, and q.

One easy trap: legal notices are included on stocks unless include_legal is 0, false, no, or off, or type is news,press_release. Decide this on the first request and keep it.

A Python loop

This loop fills a list from oldest to newest. It keeps the filters in one dict so they cannot drift, and it honors Retry-After on a 429.

import time
import requests

BASE = "https://api.marketnewsapi.com/v1/news"
HEADERS = {"Authorization": "Bearer mna-live-..."}

FILTERS = {
    "tickers": "PFE,MRK,JNJ",
    "type": "news",
    "from": "2026-11-20",
    "to": "2026-11-20",
    "sort": "published_asc",
    "limit": 100,
}

def walk():
    rows = []
    cursor = None
    while True:
        params = dict(FILTERS)
        if cursor:
            params["cursor"] = cursor
        r = requests.get(BASE, headers=HEADERS, params=params, timeout=30)
        if r.status_code == 429:
            time.sleep(int(r.headers.get("Retry-After", "1")))
            continue
        r.raise_for_status()
        body = r.json()
        rows.extend(body["data"])
        cursor = body.get("meta", {}).get("next_cursor")
        if not cursor:
            return rows

articles = walk()
print(len(articles))

Keep the key on a server. Do not ship it in a browser.

Try it for 7 days. Signup starts Pro. A card is required. Real-time REST, WebSocket, and MCP, with 250 REST requests a day, 1 WebSocket connection, and 2,500 WebSocket messages a day. Paid Pro removes the caps. After that it's $15/month, or Free if you stop.

Start 7-day free trial

Choose published_asc for tables

Use published_asc when you fill a table from oldest to newest. Each page appends to the end. If the job stops, the last stored published_at tells you where you were, and you can restart a fresh walk with from set near that point. Deduplicate on id so a restart never writes a row twice.

Use published_desc when a person reads a feed and wants the newest story first. Use relevance with q when ranking matters more than time.

A real row from the measured window shows what you store:

FieldValue
titlePfizer: Struggling To Meet Dividend Beyond 2027
tickersPFE, PFE:CA, ZPFE:CA
sourceSeeking Alpha
published_at2026-11-21T04:59:40Z

That row has three tickers, including Canadian listings. Listings carry the exchange, so a TSX symbol stays distinct from a US one. Store id, published_at, source, url, and tickers at minimum. summary and body can be null for a short time on a new article, so a later GET /news/{id} can fill them in.

Budget your requests

Every page is one REST request. Plan the count before you start:

  • Free allows 50 REST requests a day and the last 365 days of history, with headlines delayed 15 minutes.
  • The 7-day Pro trial allows 250 REST requests a day at 5 requests per second. A card is required. Nothing is charged during the trial. Unless you cancel, Pro is billed when it ends.
  • Paid Pro at $15 a month has no daily REST cap and a burst of 20 requests per second. It is for non-commercial use.

A narrow ticker list on one day may take a handful of pages. All stock news for five busy days took about 282 pages at limit=100. GET /usage does not count toward the Free daily cap, so you can check your budget mid-walk for free. See pricing for plan details and the docs for every parameter.

Checklist

  1. Set tickers, from, to, sort, and limit once.
  2. Send the first request without cursor.
  3. Repeat the identical filters and add cursor from meta.next_cursor.
  4. Stop when meta.next_cursor is absent.
  5. On a filter change, start over.
  6. Deduplicate on id.

Frequently asked questions

What is cursor pagination in a news API?
Cursor pagination returns an opaque token with each page that marks where the page ended. You send that token back with the same filters to get the next page. On MarketNewsAPI the token is meta.next_cursor and you pass it as the cursor parameter. Because the position is tied to a sorted result set, new articles arriving at the top do not shift rows between pages the way page numbers can.
How do I know when I have reached the last page?
Stop when meta.next_cursor is absent from the response. That is the stop signal. A page with fewer rows than your limit usually means you are near the end, but rely on the missing cursor. Keep the filters identical on every request, or the cursor will not describe the result set you think you are reading.
Can I change the date range or tickers while paging?
No. Changing tickers, from, to, sort, limit, or any other filter starts a different result set, so the old cursor no longer fits. If you need a different query, begin a new walk with a first request that has no cursor. To resume a stopped table load, start a new walk near your last stored published_at and deduplicate on id.
Can I use the Pro plan commercially?
No. The Pro plan cannot be used for commercial work. A product you sell, work you do for a client, or redistribution of the feed needs a custom plan and a license. Email [email protected].

Real-time stock news for $15 a month.

Start a 7-day Pro trial. A card is required. REST, WebSocket, and MCP are included, with 250 REST requests a day, 1 WebSocket connection, 5 requests per second, and 2,500 WebSocket messages a day. You won't be charged during the trial. Unless you cancel, the card is billed for Pro when it ends.