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.fromandto: the time window. Dates are UTC. A bare date such as 2026-11-20 means that UTC day.sort:published_desc,published_asc, orrelevance.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.
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:
| Field | Value |
|---|---|
| title | Pfizer: Struggling To Meet Dividend Beyond 2027 |
| tickers | PFE, PFE:CA, ZPFE:CA |
| source | Seeking Alpha |
| published_at | 2026-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
- Set
tickers,from,to,sort, andlimitonce. - Send the first request without
cursor. - Repeat the identical filters and add
cursorfrommeta.next_cursor. - Stop when
meta.next_cursoris absent. - On a filter change, start over.
- Deduplicate on
id.