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:
Why Filter by Political Leaning
Section titled “Why Filter by Political Leaning”- 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.
What Is the political_leaning Parameter?
Section titled “What Is the political_leaning Parameter?”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.
Accepted Values
Section titled “Accepted Values”The political_leaning filter accepts one or more of the following values (case‑insensitive):
leftcenter_leftcentercenter_rightrightfar_leftfar_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.
Endpoints That Support It
Section titled “Endpoints That Support It”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.
Authentication
Section titled “Authentication”Include your API key in X-API-Key. A convenient pattern is an environment variable:
export NEWSDATAHUB_API_KEY='YOUR_API_KEY_HERE'Usage Patterns
Section titled “Usage Patterns”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:
Left-Leaning Coverage of US Politics
Section titled “Left-Leaning Coverage of US Politics”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'Right-Leaning Coverage of US Politics
Section titled “Right-Leaning Coverage of US Politics”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'Centrist/Nonpartisan Coverage
Section titled “Centrist/Nonpartisan Coverage”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
Election Coverage Across the Spectrum
Section titled “Election Coverage Across the Spectrum”Monitor election news with balanced perspective representation:
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'Continued example:
Section titled “Continued example:”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'Combine with Topics, Country, and Search
Section titled “Combine with Topics, Country, and Search”Balance or contrast coverage using topics, geography, and boolean search:
# Center and center-right technology coverage from US and GBcurl -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'Response Shape: Where to Read the Leaning
Section titled “Response Shape: Where to Read the Leaning”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.
Best Practices
Section titled “Best Practices”- Start broad, then refine: Begin with
centerorcenter_left,center_right, then addtopic,country, orqas needed. - Compare viewpoints: Pair
leftvs.right, orfar_leftvs.far_righton the same query to analyze framing. - Use repeated params in code: Many HTTP clients make it easy to append
political_leaningmultiple times. - Validate and handle errors: If you pass an invalid value, the API responds with 400 and lists allowed values.
- Keep results readable: Use
fieldsto include only what you need;idis always included.
Common Errors and Tips
Section titled “Common Errors and Tips”- 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_leaningparameter 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_leaningin results.
- A source metadata filter that selects articles by the publisher’s editorial alignment (e.g., left, center, right). It’s matched against
- Can I pass multiple values? Comma vs repeated params?
- Yes.
political_leaning=center_left,center_rightis equivalent to providing the parameter twice. Whitespace is trimmed; case is ignored.
- Yes.
- Does
/v1/top-newssupportpolitical_leaningthe same as/v1/news?- Yes. The behavior is the same. We showcase
/v1/top-newsfor cleaner, recent coverage, but the same filter works with/v1/news.
- Yes. The behavior is the same. We showcase
- 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-newsand/v1/news. Authentication is via API key in theX-API-Keyheader.
- 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
- 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.
- 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
Further Reading
Section titled “Further Reading”- Related Articles Endpoint — GET
/v1/news/{article_id}/related— Find similar articles to any story to help users explore connected coverage, build “More like this” widgets, and compare narratives across outlets.
Conclusion
Section titled “Conclusion”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.