---
title: Filter Queries with Nestable Blocks and Fields
description: Use filter queries to target nestable bloks and fields.
url: https://storyblok.com/docs/api/content-delivery/v2/filter-queries/nested-blocks-and-fields
---

# Filter Queries with Nestable Blocks and Fields

It is possible to use filter queries with nestable blocks and fields that return objects. The following syntax applies:

`stories/?filter_query[field.property][operation]=value`

## Examples Use Cases

-   `filter_query[body.0.name][in]=This is a nested blok`
    
    Returns all stories which meet the following criteria:  
    a top-level blocks field named `body`
    
      
    
    the first nested block in this field (represented by the `0`) has a `name` field with the value “This is a nested block”
    
-   `filter_query[seo.description][is]=not_empty`
    
    Returns all stories configured with an `seo` field (using the [SEO App](https://www.storyblok.com/apps/seo)) with the property `description` that is not empty
    

## Example Request and Response

The following example demonstrates how to use the `filter_query` parameter with nestable blocks.

-   cURL
    
    ```shellscript
    curl "https://api.storyblok.com/v2/cdn/stories\
    ?filter_query%5Bbody.0.name%5D%5Bin%5D=This+is+a+nested+blok\
    &token=ask9soUkv02QqbZgmZdeDAtt"
    ```
    
-   JS
    
    ```javascript
    // storyblok-js-client@>=7, node@>=18
    import Storyblok from "storyblok-js-client";
    
    const storyblok = new Storyblok({
      accessToken: "krcV6QGxWORpYLUWt12xKQtt",
    });
    
    try {
      const response = await storyblok.get('cdn/stories', {
        "filter_query[body.0.name][in]": "This is a nested blok"
      })
      console.log({ response })
    } catch (error) {
      console.log(error)
    }
    ```
    
-   PHP
    
    ```php
    $client = new \Storyblok\Client('YOUR_STORYBLOK_SPACE_ACCESS_TOKEN');
    
    $client->getStories([
      "filter_query[body.0.name][in]" => "This is a nested blok"
    ])->getBody();
    ```
    
-   Java
    
    ```java
    HttpResponse<String> response = Unirest.get("https://api.storyblok.com/v2/cdn/stories?filter_query%5Bbody.0.name%5D%5Bin%5D=This+is+a+nested+blok&token=ask9soUkv02QqbZgmZdeDAtt")
      .asString();
    ```
    
-   C#
    
    ```csharp
    var client = new RestClient("https://api.storyblok.com/v2/cdn/stories?filter_query%5Bbody.0.name%5D%5Bin%5D=This+is+a+nested+blok&token=ask9soUkv02QqbZgmZdeDAtt");
    var request = new RestRequest(Method.GET);
    
    IRestResponse response = client.Execute(request);
    ```
    
-   Python
    
    ```python
    import requests
    
    url = "https://api.storyblok.com/v2/cdn/stories"
    
    querystring = {"filter_query[body.0.name][in]":"This is a nested blok","token":"ask9soUkv02QqbZgmZdeDAtt"}
    
    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 => {
      "filter_query[body.0.name][in]" => "This is a nested blok"
    }})
    ```
    
-   Swift
    
    ```swift
    let storyblok = URLSession(storyblok: .cdn(accessToken: "ask9soUkv02QqbZgmZdeDAtt"))
    var request = URLRequest(storyblok: storyblok, path: "stories")
    request.url!.append(queryItems: [
        URLQueryItem(name: "filter_query[body.0.name][in]", value: "This is a nested blok")
    ])
    let (data, _) = try await storyblok.data(for: request)
    print(try JSONSerialization.jsonObject(with: data))
    ```
    
-   Kotlin
    
    ```kotlin
    val client = HttpClient {
        install(Storyblok(CDN)) {
            accessToken = "ask9soUkv02QqbZgmZdeDAtt"
        }
    }
    
    val response = client.get("stories") {
        url {
            parameters.append("filter_query[body.0.name][in]", "This is a nested blok")
        }
    }
    
    println(response.body<JsonElement>())
    ```

Response

```json
{
  "stories": [
    {
      "name": "Nestable bloks",
      "created_at": "2024-03-07T18:22:10.389Z",
      "published_at": "2024-03-07T18:32:44.919Z",
      "id": 457784924,
      "uuid": "387914f2-0d36-4172-93c6-0f5535be2d27",
      "content": {
        "seo": {
          "_uid": "d3797349-49c9-4155-8d31-acdd15d47b05",
          "title": "SEO title",
          "plugin": "seo_metatags",
          "og_image": "",
          "og_title": "",
          "description": "Just a test",
          "twitter_image": "",
          "twitter_title": "",
          "og_description": "",
          "twitter_description": ""
        },
        "_uid": "a925a690-464c-4a88-b99f-35234e4bf49c",
        "body": [
          {
            "_uid": "73997a89-085a-44df-87d5-4f1b4f053b24",
            "name": "This is a nested blok",
            "component": "feature"
          }
        ],
        "component": "page"
      },
      "slug": "nested-fields",
      "full_slug": "nested-fields",
      "sort_by_date": null,
      "position": -40,
      "tag_list": [],
      "is_startpage": false,
      "parent_id": null,
      "meta_data": null,
      "group_id": "bb4c871c-fac7-47c0-8dc9-2bd58024647f",
      "first_published_at": "2024-03-07T18:23:14.717Z",
      "release_id": null,
      "lang": "default",
      "path": null,
      "alternates": [],
      "default_full_slug": null,
      "translated_slugs": null
    }
  ],
  "cv": 1709836364,
  "rels": [],
  "links": []
}
```

## Pagination

-   [Previous: Field-level Translation](/docs/api/content-delivery/v2/filter-queries/field-level-translation)
-   [Next: Filtering Stories by a Boolean Value](/docs/api/content-delivery/v2/filter-queries/examples/filtering-stories-by-a-boolean-value)
