---
title: Filtering Stories by Defining a Value Range
description: Learn how to filter stories within a specific value range using gt_float and lt_float for price filtering and similar use cases.
url: https://www.storyblok.com/docs/api/content-delivery/v2/filter-queries/examples/filtering-stories-by-defining-a-value-range
---

# Filtering Stories by Defining a Value Range

In a common shop content structure implementation, a simple price range products filter is often necessary. A single `filter_query` can be crafted to retrieve products that exceed or fall below a specified price point. In this scenario, the `gt_float` and `lt_float` filters are combined to obtain all products within a given price range.

## Example Request and Response

The following example demonstrates how to receive products (stories of that story type) with a `price` value between `200` and `300`.

-   cURL
    
    ```shellscript
    curl "https://api.storyblok.com/v2/cdn/stories\
    ?starts_with=products\
    &token=ask9soUkv02QqbZgmZdeDAtt\
    &filter_query%5Bprice%5D%5Blt_float%5D=300\
    &filter_query%5Bprice%5D%5Bgt_float%5D=200"
    ```
    
-   JS
    
    ```javascript
    // storyblok-js-client@>=7, node@>=18
    import Storyblok from "storyblok-js-client";
    
    const storyblok = new Storyblok({
      accessToken: "ask9soUkv02QqbZgmZdeDAtt",
    });
    
    try {
      const response = await storyblok.get('cdn/stories', {
        "starts_with": "products",
        "filter_query[price][lt_float]": "300",
        "filter_query[price][gt_float]": "200"
      })
      console.log({ response })
    } catch (error) {
      console.log(error)
    }
    ```
    
-   PHP
    
    ```php
    $client = new \Storyblok\Client('YOUR_STORYBLOK_SPACE_ACCESS_TOKEN');
    
    $client->getStories([
      "starts_with" => "products",
      "filter_query[price][lt_float]" => "300",
      "filter_query[price][gt_float]" => "200"
    ])->getBody();
    ```
    
-   Java
    
    ```java
    HttpResponse<String> response = Unirest.get("https://api.storyblok.com/v2/cdn/stories?starts_with=products&token=ask9soUkv02QqbZgmZdeDAtt&filter_query%5Bprice%5D%5Blt_float%5D=300&filter_query%5Bprice%5D%5Bgt_float%5D=200")
      .asString();
    ```
    
-   C#
    
    ```csharp
    var client = new RestClient("https://api.storyblok.com/v2/cdn/stories?starts_with=products&token=ask9soUkv02QqbZgmZdeDAtt&filter_query%5Bprice%5D%5Blt_float%5D=300&filter_query%5Bprice%5D%5Bgt_float%5D=200");
    var request = new RestRequest(Method.GET);
    
    IRestResponse response = client.Execute(request);
    ```
    
-   Python
    
    ```python
    import requests
    
    url = "https://api.storyblok.com/v2/cdn/stories"
    
    querystring = {"starts_with":"products","token":"ask9soUkv02QqbZgmZdeDAtt","filter_query[price][lt_float]":"300","filter_query[price][gt_float]":"200"}
    
    payload = ""
    headers = {}
    
    response = requests.request("GET", url, data=payload, headers=headers, params=querystring)
    
    print(response.text)
    ```
    
-   Ruby
    
    ```ruby
    require 'storyblok'
    client = Storyblok::Client.new(token: 'YOUR_TOKEN')
    
    client.stories({:params => {
      "starts_with" => "products",
      "filter_query[price][lt_float]" => "300",
      "filter_query[price][gt_float]" => "200"
    }})
    ```
    
-   Swift
    
    ```swift
    // .package(url: "https://github.com/storyblok/storyblok-swift.git", from: "1.1.0")
    // Requires a `Block` content model — see https://www.storyblok.com/docs/quickstarts/apple-platforms/content-modeling
    let client = StoryblokClient(
        library: Block.self,
        accessToken: "ask9soUkv02QqbZgmZdeDAtt",
        version: .published,
        region: .eu
    )
    
    let stories: Page<Story<Block.Product>>? = try await client
        .stories { @Sendable (query: inout StoriesQuery<Block.Product>) in
            query.startsWith = "products"
            query.filter {
                $0.price.asDecimal < 300
                $0.price.asDecimal > 200
            }
        }
        .last()
        .values
        .first { @Sendable _ in true }
    
    print(stories!)
    ```
    
-   Kotlin
    
    ```kotlin
    // implementation("com.storyblok:content-api-client:0.7.1")
    // Requires a `Product` component model — see https://www.storyblok.com/docs/quickstarts/android/content-modeling
    val client = StoryblokClient(
        accessToken = "ask9soUkv02QqbZgmZdeDAtt",
        version = Published,
    )
    
    val stories = client
        .stories<Product> {
            startsWith = "products"
            filter {
                Product::price lessThan 300.0
                Product::price greaterThan 200.0
            }
        }
        .flow
        .asItemSnapshotListFlow()
        .first()
    
    println(stories)
    ```

Response

```json
{
  "stories": [
    {
      "name": "Coat",
      "created_at": "2018-12-10T17:50:34.547Z",
      "published_at": "2026-11-03T10:00:23.774Z",
      "updated_at": "2026-11-03T10:00:23.787Z",
      "id": 461933,
      "uuid": "0186a027-4f04-4750-b743-8855ad4e71d4",
      "content": {
        "_uid": "baa8057c-a928-4fda-b322-9499a081a9c9",
        "link": {
          "id": "",
          "url": "",
          "linktype": "story",
          "fieldtype": "multilink",
          "cached_url": ""
        },
        "name": "Coat",
        "image": "//a.storyblok.com/f/44203/5616x3744/8cff02e5d6/coat.jpg",
        "price": "279",
        "featured": true,
        "component": "product",
        "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In erat mauris, faucibus quis pharetra sit amet, pretium ac libero. Etiam vehicula eleifend bibendum."
      },
      "slug": "coat",
      "full_slug": "products/coat",
      "sort_by_date": null,
      "position": -10,
      "tag_list": [
        "red",
        "sale"
      ],
      "is_startpage": false,
      "parent_id": 461931,
      "meta_data": null,
      "group_id": "d17c3137-d695-45f0-a418-bce81b148567",
      "first_published_at": "2018-12-10T17:50:47.000Z",
      "release_id": null,
      "lang": "default",
      "path": null,
      "alternates": [],
      "default_full_slug": null,
      "translated_slugs": null
    }
  ],
  "cv": 1793700142,
  "rels": [],
  "links": []
}
```

## Pagination

-   [Previous: Filtering Stories by a Boolean Value](/docs/api/content-delivery/v2/filter-queries/examples/filtering-stories-by-a-boolean-value)
-   [Next: Retrieve a Single Link](/docs/api/content-delivery/v2/links/retrieve-a-single-link)
