Back to Blog
API Features February 17, 2026

Mastering Filters: Query Your Data Like a Pro

Learn how to use exact match, comparison, and pattern filters to retrieve exactly the data you need.

Understanding the filter syntax

csv-api uses a simple, nested query parameter format for filtering. All filters go through the filter parameter:

# Exact match
?filter[column]=value

# With an operator
?filter[column][operator]=value

Exact match filters

The simplest filter is an exact match. This returns only rows where the column value equals your specified value exactly.

Find all products in the "Electronics" category:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://csv-api.com/api/v1/datasets/YOUR_ID/records?filter[category]=Electronics"

You can combine multiple exact match filters. They are joined with AND logic, so all conditions must be true:

# Electronics that are in stock
?filter[category]=Electronics&filter[in_stock]=true

Comparison operators

For numeric, date, and other ordered data, use comparison operators to find ranges of values.

Operator Meaning Example
gt Greater than filter[price][gt]=50
gte Greater than or equal filter[age][gte]=18
lt Less than filter[score][lt]=100
lte Less than or equal filter[weight][lte]=50
ne Not equal filter[status][ne]=inactive

Find products priced between $20 and $100:

?filter[price][gte]=20&filter[price][lte]=100

Pattern matching with LIKE

The like operator performs a case-insensitive substring search. It's perfect for searching text columns when you don't know the exact value.

Find all products with "mouse" in the name:

?filter[name][like]=mouse

This will match "Wireless Mouse", "Gaming Mouse", "mouse pad", etc. The search is case-insensitive, so "mouse", "Mouse", and "MOUSE" all match.

Combining filters

All filters are combined with AND logic. Here's a real-world example that combines multiple filter types:

Find in-stock electronics under $100 with "wireless" in the name:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://csv-api.com/api/v1/datasets/YOUR_ID/records?\
filter[category]=Electronics&\
filter[in_stock]=true&\
filter[price][lt]=100&\
filter[name][like]=wireless"

Filtering with dates

If your CSV contains date columns, csv-api auto-detects them and you can filter with comparison operators. Dates should be passed in YYYY-MM-DD format.

Find orders placed after January 1, 2026:

?filter[order_date][gt]=2026-01-01

Find orders from Q1 2026:

?filter[order_date][gte]=2026-01-01&filter[order_date][lte]=2026-03-31

Tips and gotchas

  • Column names must match exactly — use the column names from your CSV headers. Check your dataset detail page to see the exact names.
  • Comparison operators respect types — numeric comparisons work on number columns, date comparisons on date columns. Filtering on a text column with gt will use lexicographic ordering.
  • Boolean values — filter with true or false (lowercase).

We use essential cookies to keep you logged in. No tracking or analytics. Privacy policy