Skip to content
NewsDataHub NewsDataHub Learning Center

How Do I Filter News by Political Bias or Source Alignment? NewsDataHub Political Leaning Filter

Use the political_leaning parameter with GET /v1/news and GET /v1/top-news to focus results by a source’s editorial alignment. This guide explains accepted values, single vs. multi‑value syntax, practical combinations with other filters, and ready‑to‑run curl examples.

What is NewsDataHub? It’s a developer‑friendly news API that aggregates and normalizes global news from mainstream outlets, digital‑native publishers, press releases, and specialty sources. We standardize metadata like language, topics, source type, reliability, and political leaning so you can build precise, repeatable news API filtering without curating long source lists.

Why political leaning matters: it helps you design balanced feeds, reduce echo chambers, and compare how the same story is framed across the spectrum. It also supports compliance and brand‑safety workflows by letting you include or exclude certain alignments at query time. In short, the political leaning filter enables transparent, bias‑aware content curation.

Note: Examples below use GET /v1/top-news because it returns cleaner mainstream results over the last 24–72 hours. The political_leaning filter works the same way with GET /v1/news.

Related guides for deeper context:

  • Content discovery: Surface under‑represented perspectives and uncover angles you’d miss when sampling only a few outlets.
  • Viewpoints from all sides: Compare coverage tone and framing (e.g., left vs. right) on the same event to build balanced dashboards.
  • Audience alignment: Tailor feeds for different audiences while staying transparent about which viewpoints are emphasized.
  • Editorial balance checks: Enforce diversity of sources in newsletters, landing pages, or recommendation carousels.
  • Research and fact‑checking: Study bias, media ecosystems, and narrative differences across the spectrum.
  • Brand safety and policy: Include/exclude specific alignments to comply with organizational or advertiser guidelines.
  • Personalization with fairness: Let users tune their experience while providing easy ways to add counter‑balancing perspectives.

It’s a source‑level filter that restricts results to publishers with a specified editorial alignment. It supports single or multiple values (comma‑separated or repeated parameters), is case‑insensitive, and works identically on /v1/top-news and /v1/news.

The political_leaning filter accepts one or more of the following values (case‑insensitive):

  • left
  • center_left
  • center
  • center_right
  • right
  • far_left
  • far_right

Notes:

  • You can pass a single value, a comma‑separated list, or repeat the parameter multiple times.
  • Invalid values return HTTP 400 with a helpful error listing the allowed options.
  • GET /v1/top-news — Curated mainstream coverage from the last 24–72 hours.
  • GET /v1/news — Full article stream with historical access and rich filters.

Both endpoints support political_leaning and can combine it with topic, country, source, language, q, start_date, end_date, and more.

Include your API key in X-API-Key. A convenient pattern is an environment variable:

export NEWSDATAHUB_API_KEY='YOUR_API_KEY_HERE'

Single value (center):

curl -G https://api.newsdatahub.com/v1/top-news \
-H "X-API-Key: $NEWSDATAHUB_API_KEY" \
-H "User-Agent: newsdatahub-political-leaning-filter/1.0-curl" \
--data-urlencode 'hours=48' \
--data-urlencode 'political_leaning=center' \
--data-urlencode 'per_page=5'

Multiple values, comma‑separated (center-left OR center-right sources):

curl -G https://api.newsdatahub.com/v1/top-news \
-H "X-API-Key: $NEWSDATAHUB_API_KEY" \
-H "User-Agent: newsdatahub-political-leaning-filter/1.0-curl" \
--data-urlencode 'hours=48' \
--data-urlencode 'political_leaning=center_left,center_right' \
--data-urlencode 'per_page=5'

Real-World Use Case: Comparing Political Coverage

Section titled “Real-World Use Case: Comparing Political Coverage”

Compare how different political perspectives cover the same topic or event:

Terminal window
curl -G https://api.newsdatahub.com/v1/news \
-H "X-API-Key: $NEWSDATAHUB_API_KEY" \
-H "User-Agent: newsdatahub-political-leaning-filter/1.0-curl" \
--data-urlencode 'country=US' \
--data-urlencode 'topic=politics' \
--data-urlencode 'political_leaning=left,center_left' \
--data-urlencode 'language=en' \
--data-urlencode 'per_page=20'
Terminal window
curl -G https://api.newsdatahub.com/v1/news \
-H "X-API-Key: $NEWSDATAHUB_API_KEY" \
-H "User-Agent: newsdatahub-political-leaning-filter/1.0-curl" \
--data-urlencode 'country=US' \
--data-urlencode 'topic=politics' \
--data-urlencode 'political_leaning=right,center_right' \
--data-urlencode 'language=en' \
--data-urlencode 'per_page=20'
Terminal window
curl -G https://api.newsdatahub.com/v1/news \
-H "X-API-Key: $NEWSDATAHUB_API_KEY" \
-H "User-Agent: newsdatahub-political-leaning-filter/1.0-curl" \
--data-urlencode 'country=US' \
--data-urlencode 'topic=politics' \
--data-urlencode 'political_leaning=center' \
--data-urlencode 'language=en' \
--data-urlencode 'per_page=20'

Use case: Build a “view from all sides” feature where users can toggle between left, center, and right coverage of the same events.

Live feed example: US Political News

Monitor election news with balanced perspective representation:

Terminal window
curl -G https://api.newsdatahub.com/v1/news \
-H "X-API-Key: $NEWSDATAHUB_API_KEY" \
-H "User-Agent: newsdatahub-political-leaning-filter/1.0-curl" \
--data-urlencode 'q=(election OR voting OR ballot OR campaign)' \
--data-urlencode 'country=US' \
--data-urlencode 'topic=politics' \
--data-urlencode 'political_leaning=center_left,center,center_right' \
--data-urlencode 'language=en' \
--data-urlencode 'per_page=30'
curl -G https://api.newsdatahub.com/v1/top-news \
-H "X-API-Key: $NEWSDATAHUB_API_KEY" \
-H "User-Agent: newsdatahub-political-leaning-filter/1.0-curl" \
--data-urlencode 'hours=48' \
--data-urlencode 'political_leaning=center_left,center_right' \
--data-urlencode 'per_page=5'

Multiple values, repeated params (equivalent to comma‑separated):

curl -G https://api.newsdatahub.com/v1/top-news \
-H "X-API-Key: $NEWSDATAHUB_API_KEY" \
-H "User-Agent: newsdatahub-political-leaning-filter/1.0-curl" \
--data-urlencode 'hours=48' \
--data-urlencode 'political_leaning=center_left' \
--data-urlencode 'political_leaning=center_right' \
--data-urlencode 'per_page=5'

Case‑insensitive input:

curl -G https://api.newsdatahub.com/v1/top-news \
-H "X-API-Key: $NEWSDATAHUB_API_KEY" \
-H "User-Agent: newsdatahub-political-leaning-filter/1.0-curl" \
--data-urlencode 'hours=48' \
--data-urlencode 'political_leaning=Center_Right' \
--data-urlencode 'per_page=5'

Balance or contrast coverage using topics, geography, and boolean search:

# Center and center-right technology coverage from US and GB
curl -G https://api.newsdatahub.com/v1/top-news \
-H "X-API-Key: $NEWSDATAHUB_API_KEY" \
-H "User-Agent: newsdatahub-political-leaning-filter/1.0-curl" \
--data-urlencode 'hours=48' \
--data-urlencode 'topic=technology' \
--data-urlencode 'country=US,GB' \
--data-urlencode 'political_leaning=center,center_right' \
--data-urlencode 'per_page=5'
# Compare narratives around a specific event (boolean query)
curl -G https://api.newsdatahub.com/v1/top-news \
-H "X-API-Key: $NEWSDATAHUB_API_KEY" \
-H "User-Agent: newsdatahub-political-leaning-filter/1.0-curl" \
--data-urlencode 'hours=48' \
--data-urlencode 'q="interest rates" AND inflation' \
--data-urlencode 'topic=finance' \
--data-urlencode 'political_leaning=left,right' \
--data-urlencode 'per_page=5'

Time window (hours) works the same with or without political leaning:

curl -G https://api.newsdatahub.com/v1/top-news \
-H "X-API-Key: $NEWSDATAHUB_API_KEY" \
-H "User-Agent: newsdatahub-political-leaning-filter/1.0-curl" \
--data-urlencode 'hours=72' \
--data-urlencode 'topic=politics' \
--data-urlencode 'political_leaning=center' \
--data-urlencode 'per_page=5'

Articles include a nested source object with source metadata, including political leaning:

{
"id": "...",
"title": "...",
"source_title": "...",
"pub_date": "2025-10-10T14:22:00",
"source": {
"id": "src_123",
"country": "US",
"political_leaning": "center",
"reliability_score": 0.87,
"type": "mainstream_news"
}
}

Use this field to label results in your UI, build comparison charts, or audit coverage balance.

  • Start broad, then refine: Begin with center or center_left,center_right, then add topic, country, or q as needed.
  • Compare viewpoints: Pair left vs. right, or far_left vs. far_right on the same query to analyze framing.
  • Use repeated params in code: Many HTTP clients make it easy to append political_leaning multiple times.
  • Validate and handle errors: If you pass an invalid value, the API responds with 400 and lists allowed values.
  • Keep results readable: Use fields to include only what you need; id is always included.
  • Invalid value: Ensure your value is one of left, center_left, center, center_right, right, far_left, far_right.
  • Whitespace: If using comma‑separated lists, extra spaces are trimmed automatically.
  • Case: Input is case‑insensitive; the API normalizes values internally.
  • Free tier freshness: Free requests include a 48‑hour delay; paid tiers can access fresher content.
  • What is the political_leaning parameter in NewsDataHub?
    • A source metadata filter that selects articles by the publisher’s editorial alignment (e.g., left, center, right). It’s matched against source.political_leaning in results.
  • Can I pass multiple values? Comma vs repeated params?
    • Yes. political_leaning=center_left,center_right is equivalent to providing the parameter twice. Whitespace is trimmed; case is ignored.
  • Does /v1/top-news support political_leaning the same as /v1/news?
    • Yes. The behavior is the same. We showcase /v1/top-news for cleaner, recent coverage, but the same filter works with /v1/news.
  • What is NewsDataHub API?
    • NewsDataHub is a developer‑focused news API that aggregates and normalizes global coverage from mainstream, digital‑native, and specialty publishers. It supports boolean search, rich filters (topic, source, language, country, political_leaning, source_type), cursor‑based pagination, and REST endpoints like /v1/top-news and /v1/news. Authentication is via API key in the X-API-Key header.
  • How can I try your service?
    • Start with our free tier by signing up to get an API key, then test queries without code using the Interactive API Sandbox: https://newsdatahub.com/docs#interactive-api. When you’re ready, switch the same calls into your app with curl, JavaScript fetch, or your preferred HTTP client.

The political_leaning filter gives you precise, bias‑aware control over your news feed. Combine it with topics, countries, sources, and boolean search to build balanced dashboards, competitive monitors, and editorial workflows — all with a few parameters.

Olga S.

Founder of NewsDataHub — Distributed Systems & Data Engineering

Connect on LinkedIn