> ## Documentation Index
> Fetch the complete documentation index at: https://docs.b3os.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Filter Array

Keep only the items in a list that match your conditions. Supports AND/OR logic and comparisons like equals, greater than, and membership checks.

Logic action Logic

Keep only the items in a list that match your conditions. Supports AND/OR logic and comparisons like equals, greater than, and membership checks.


## At a Glance

| Field | Value |
| --- | --- |
| Action ID | `filter` |
| Category | Logic |
| Connector | Not required |
| Requires gas | No |
| Funds movement | None declared |
| Tags | `logic`, `filter`, `array`, `query`, `control-flow` |

## Payload Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `array` | `array` | Yes | Array of objects to filter |
| `filter` | `object` | Yes | Filter DSL with $and or $or logical operators containing field conditions. Supports $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin operators. |

## Result Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `filtered` | `array` | Yes | Filtered array items that match the filter |

## Examples

**Workflow node**

```json
{
  "type": "filter",
  "payload": {
    "array": [
      {
        "id": "1",
        "amount": 1500,
        "status": "active"
      },
      {
        "id": "2",
        "amount": 50,
        "status": "pending"
      }
    ],
    "filter": {
      "$and": [
        {
          "status": {
            "$eq": "active"
          }
        },
        {
          "amount": {
            "$gte": 1000
          }
        }
      ]
    }
  },
  "children": []
}
```
  **Test with API**

```bash
curl -X POST "https://api.b3os.org/v1/actions/filter/test" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "inputs": {
    "array": [
      {
        "id": "1",
        "amount": 1500,
        "status": "active"
      },
      {
        "id": "2",
        "amount": 50,
        "status": "pending"
      }
    ],
    "filter": {
      "$and": [
        {
          "status": {
            "$eq": "active"
          }
        },
        {
          "amount": {
            "$gte": 1000
          }
        }
      ]
    }
  }
}'
```

**Use expressions for dynamic values**

Payload fields can use workflow expressions such as `{{$trigger.body.amount}}`, `{{$nodes.fetch.result.price}}`, and `{{$props.asset}}` when the value should come from a trigger, prior node, or reusable workflow prop.