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

# Saved Searches

> Query and execute saved searches

## List Saved Searches

Fetch a paginated list of saved searches, optionally filtered by type.

```graphql theme={null}
query GetSavedSearches($type: SavedSearchType, $cursor: String, $limit: Int) {
  savedSearches(type: $type, cursor: $cursor, limit: $limit) {
    data {
      id
      name
      description
      type
    }
    pagination {
      cursor
      hasMore
      limit
    }
  }
}
```

### Parameters

| Parameter | Type            | Default | Description                              |
| --------- | --------------- | ------- | ---------------------------------------- |
| `type`    | SavedSearchType | -       | Filter by search type (CONTENT or ASSET) |
| `cursor`  | String          | null    | Cursor for pagination                    |
| `limit`   | Int             | 20      | Items per page                           |

### Example

```graphql theme={null}
query {
  savedSearches(type: CONTENT, limit: 10) {
    data {
      id
      name
      description
      type
    }
    pagination {
      cursor
      hasMore
    }
  }
}
```

Response:

```json theme={null}
{
  "data": {
    "savedSearches": {
      "data": [
        {
          "id": "ss123",
          "name": "Recent Tutorials",
          "description": "Tutorials updated in the last 30 days",
          "type": "CONTENT"
        },
        {
          "id": "ss124",
          "name": "Published Articles",
          "description": "All published blog articles",
          "type": "CONTENT"
        }
      ],
      "pagination": {
        "cursor": null,
        "hasMore": false
      }
    }
  }
}
```

## Get Single Saved Search

Fetch a specific saved search by ID.

```graphql theme={null}
query GetSavedSearch($id: ID!) {
  savedSearch(id: $id) {
    id
    name
    description
    type
  }
}
```

### Parameters

| Parameter | Type | Required | Description     |
| --------- | ---- | -------- | --------------- |
| `id`      | ID!  | Yes      | Saved search ID |

## Execute Saved Search

Run a saved search and get paginated results.

```graphql theme={null}
query ExecuteSavedSearch($id: ID!, $cursor: String, $limit: Int) {
  executeSavedSearch(id: $id, cursor: $cursor, limit: $limit) {
    ... on ContentList {
      data {
        id
        name
        tags
        compiled
      }
      pagination {
        cursor
        hasMore
        limit
      }
    }
    ... on AssetList {
      data {
        id
        name
        type
        url
      }
      pagination {
        cursor
        hasMore
        limit
      }
    }
  }
}
```

### Parameters

| Parameter | Type   | Required | Description                  |
| --------- | ------ | -------- | ---------------------------- |
| `id`      | ID!    | Yes      | Saved search ID              |
| `cursor`  | String | No       | Cursor for pagination        |
| `limit`   | Int    | No       | Items per page (default: 20) |

### Example

```graphql theme={null}
query {
  executeSavedSearch(id: "ss123", limit: 10) {
    ... on ContentList {
      data {
        id
        name
        tags
      }
      pagination {
        cursor
        hasMore
      }
    }
  }
}
```

Response:

```json theme={null}
{
  "data": {
    "executeSavedSearch": {
      "data": [
        {
          "id": "cont456",
          "name": "Getting Started Guide",
          "tags": ["tutorial", "beginner"]
        },
        {
          "id": "cont457",
          "name": "Advanced Patterns",
          "tags": ["tutorial", "advanced"]
        }
      ],
      "pagination": {
        "cursor": "eyJsYXN0SWQiOiJjb250NDU3IiwibGFzdFVwZGF0ZWRBdCI6IjIwMjQtMDEtMTVUMTA6MDA6MDBaIn0=",
        "hasMore": false
      }
    }
  }
}
```

## Saved Search Fields

| Field         | Type             | Description        |
| ------------- | ---------------- | ------------------ |
| `id`          | ID!              | Unique identifier  |
| `name`        | String!          | Search name        |
| `description` | String           | Search description |
| `type`        | SavedSearchType! | CONTENT or ASSET   |

## SavedSearchType Enum

| Value     | Description                  |
| --------- | ---------------------------- |
| `CONTENT` | Search returns content items |
| `ASSET`   | Search returns asset items   |

<Note>
  The `executeSavedSearch` query returns a union type. Use inline fragments (`... on ContentList` or `... on AssetList`) to access the appropriate fields based on the saved search type.
</Note>
