APITube Help Center

How to Filter News by Date Range

Choose publication dates with absolute or relative time values

Tasha Tatum

Written by Tasha Tatum

June 26, 2026

Updated October 16, 2026

Open this example in the API Playground ↗

How to filter news by date range

Set published_at.start for the earliest included publication time and published_at.end for the latest. Both bounds are inclusive. This example runs from January 1 through midnight at the start of January 31:

curl "https://api.apitube.io/v1/news/everything?published_at.start=2024-01-01&published_at.end=2024-01-31&api_key=YOUR_API_KEY"

Send the key through api_key or X-API-Key. A date without time means midnight UTC; it does not make an end date include that whole day.

What parameters set a date range?

Use either bound or both. An omitted side stays open, subject to any endpoint or headline-search limits. published_at instead selects a 24-hour period starting at the supplied date or time.

curl "https://api.apitube.io/v1/news/everything?published_at.start=2024-06-01&api_key=YOUR_API_KEY"

For a date-only published_at, that period starts at midnight UTC and includes the next midnight boundary.

Which date formats are accepted?

Accepted values include 2024-12-25, ISO timestamps such as 2024-12-25T10:30:00Z or one with an offset, 25-12-2024, 25.12.2024, and Unix seconds such as 1735084800.

Values must be 1–30 characters. Encode a + in an offset as part of the query value, or let your HTTP client encode it.

How do I use relative dates like the last 7 days?

Relative expressions are evaluated when the request runs:

curl "https://api.apitube.io/v1/news/everything?published_at.start=NOW-7DAYS&api_key=YOUR_API_KEY"

Use NOW, offsets such as NOW-7DAYS, or rounding such as NOW/DAY and NOW/MONTH. NOW-1DAY/DAY is the start of yesterday in UTC. Bare durations such as 7DAYS mean that long ago; short forms include 1w, 3d, 4h and 5y.

The units are hours, days, weeks, months and years. This example runs from yesterday’s start through today’s start:

curl "https://api.apitube.io/v1/news/everything?published_at.start=NOW-1DAY/DAY&published_at.end=NOW/DAY&api_key=YOUR_API_KEY"

Because both bounds include their endpoint, adjacent ranges can overlap at the boundary. Skip repeated article IDs when combining results.

How do I sort articles within the range by date?

Newest publication dates come first by default. Use ascending order for oldest-first:

curl "https://api.apitube.io/v1/news/everything?published_at.start=NOW-30DAYS&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY"

See sorting, language filters and the parameter reference.

Is there a maximum width for a date range?

Main article searches without headline filters do not have the headline-specific 31-day limit. Other endpoints can have their own limits.

title, title prefixes, suffixes, patterns and Boolean query trigger the 31-day window rule:

RequestResult
Headline filter, no published_at dates at allRuns against the last 31 days. HTTP 200 with warning ER0366 in meta.warnings and header x-query-window-clamped: 31
Headline filter, start and end 31 days apart or lessRuns exactly as written
Headline filter, range wider than 31 daysHTTP 400 with error ER0110

An old start without an end runs up to now and can exceed that limit. Set both bounds for an archive window:

# 200 — archive month, headline filter, window inside the ceiling
curl "https://api.apitube.io/v1/news/everything?title=inflation&published_at.start=2026-05-01&published_at.end=2026-05-31&api_key=YOUR_API_KEY"

Use separate windows for longer headline studies. See title search.

Common Questions

Are the start and end dates inclusive?

Yes. An article at either exact boundary is included.

What does the single published_at parameter return?

A 24-hour period from the supplied value. published_at=2024-12-25 starts at midnight UTC and includes the next midnight boundary. A timestamp starts the period at that time instead.

Can I leave one side of the range open?

Yes, but an old start can exceed a headline search’s 31-day limit. With only a headline-search end date, the missing start is set 31 days before it.

What error do I get for an invalid date?

400 ER0104 for start, ER0106 for end or ER0109 for the single-date parameter. Check the value and its encoding.

Does the 31-day ceiling apply to the single published_at parameter?

Its 24-hour period is already within the limit, even for an old date with a headline filter. It does not trigger the default-window warning.


Related Articles