Advanced Query Building

When working with the Finlight.me API, you have the power to retrieve exactly the data you need through advanced query building techniques. This guide will walk you through complex filtering, sorting, and pagination methods to help you optimize your data retrieval process. Quickly access the API and test your queries using our Dashboard - API Tester.


Query Filtering

The query parameter allows you to filter news results using flexible keyword-based logic. Here's how to use it effectively:

Basic Usage

Single keyword:

query=Nvidia stock

Exact phrase: Wrap phrases in double quotes to search for exact matches.

query="Elon Musk"

Keyword Inclusion & Exclusion

Force inclusion (+) and exclusion (-): Use + to require terms and - to exclude them.

query=stock +market -google

This will return articles that contain "stock" and "market", but exclude any that mention "google".

Boolean Operators

AND / OR / NOT logic is fully supported:

query=stock AND google
query=amazon OR google
query=market AND NOT bitcoin

Use parentheses for grouping: Combine logical expressions for advanced filtering.

query=("Elon Musk") AND (twitter OR tesla)

💡 Tips for Power Users

  • Boolean operators like AND, OR, and NOT are case-insensitive.
  • Surround multi-word terms with double quotes to avoid partial matches.
  • You can combine all techniques to craft powerful, targeted queries.

Sources Filtering

Filtering by sources

You can filter your queries by specific sources. This is particularly useful when you want to focus on data from certain providers or platforms. To filter by sources, use the sources parameter in your query. API Documentation - Get All Sources provides a comprehensive list of available sources.

Example Single Source Filtering

sources=source1

Example Multiple Source Filtering

sources=source1,source2

Exclude Sources

You can also exclude specific sources from your query results. This is helpful when you want to filter out data from certain providers or platforms. To exclude sources, use the excludeSources parameter in your query.

Example Single Source Exclude

excludeSources=source1

Example Multiple Source Exclude

excludeSources=source1,source2

If you ever feel stuck, have a question, or see room for improvement, don’t hesitate to reach out. We look forward to hearing from you and supporting your success with the Finlight.me API.

Was this page helpful?