Skip to content

Data Range Filter

An optional parameter called date_range_filters is available in the endpoints listed below, allowing their responses to be filtered based on specific date ranges:

  • POST /v1/items/search
  • POST /v1/items/recommend
  • POST /v1/items/purchased/together
  • POST /v1/users/recommend
  • POST /v1/users/search/recommend

There are four types of filters available, as described below:

  • lt (less than): Excludes the specified date or datetime from the range. It's used when you want the range to go up to, but not include, the provided date.
  • lte (less than or equal to): Includes the specified date or datetime. It's used when you want the range to go up to and include the provided date.
  • gt (greater than): Excludes the specified date or datetime from the range. This is used when you want the range to start just after the provided date.
  • gte (greater than or equal to): Includes the specified date or datetime. This is used when you want the range to start from the provided date itself.

Example

For example, if your item creation date is represented by the created_at key, to display items created between January 1, 2023, and December 31, 2023, inclusive:

"date_range_filters": [
    {
      "key": "created_at",
      "gte": "2023-01-01",
      "lte": "2023-12-31"
    }
  • gte (greater than or equal to): This is used to include the start date, January 1, 2023.
  • lte (less than or equal to): This is used to include the end date, December 31, 2023.

Supported formats

  • "2023-02-08T10:49:00Z" (RFC 3339, UTC)
  • "2023-02-08T11:49:00+01:00" (RFC 3339, with timezone)
  • "2023-02-08T10:49:00" (without timezone, UTC is assumed)
  • "2023-02-08T10:49" (without timezone and seconds)
  • "2023-02-08" (only date, midnight is assumed).