> ## 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.

# Queries Overview

> GraphQL query operations for fetching data

All queries return the latest published versions only. For draft content, use the [preview query](/graphql/queries/preview) with a preview token.

## Query Schema

```graphql theme={null}
type Query {
  # Components
  components(search: String, cursor: String, limit: Int = 20): ComponentList!
  component(id: ID!): Component

  # Packages
  packages(cursor: String, limit: Int = 20): PackageList!
  package(version: String!): Package

  # Content
  contents(
    typeId: ID
    tags: [String!]
    locale: String
    search: String
    filter: ContentFilter
    sort: [SortCriteria!]
    cursor: String
    limit: Int = 20
  ): ContentList!
  content(id: ID!): Content

  # Content Types
  contentTypes(search: String, cursor: String, limit: Int = 20): ContentTypeList!
  contentType(id: ID!): ContentType

  # Assets
  assets(
    type: String
    tags: [String!]
    search: String
    filter: AssetFilter
    sort: [SortCriteria!]
    cursor: String
    limit: Int = 20
  ): AssetList!
  asset(id: ID!): Asset

  # Tags
  tags(search: String, cursor: String, limit: Int = 20): TagList!
  tag(id: ID!): Tag

  # Saved Searches
  savedSearches(type: SavedSearchType, cursor: String, limit: Int = 20): SavedSearchList!
  savedSearch(id: ID!): SavedSearch
  executeSavedSearch(id: ID!, cursor: String, limit: Int = 20): SavedSearchResult!

  # Preview Links (token-based auth)
  preview(token: String!, version: Int): PreviewResult

  # Normalized caching
  resolvedPackageData(packageId: ID!): ResolvedPackageData
  previewResolvedPackageData(token: String!, packageId: ID!): ResolvedPackageData
}
```

## Common Parameters

### Pagination

The GraphQL API uses cursor-based pagination for efficient data retrieval:

| Parameter | Type   | Default | Description                                              |
| --------- | ------ | ------- | -------------------------------------------------------- |
| `cursor`  | String | null    | Opaque cursor for the next page (from previous response) |
| `limit`   | Int    | 20      | Items per page (max 100)                                 |

List responses include a `pagination` object with:

* `cursor`: The cursor to use for the next page (null if no more pages)
* `hasMore`: Boolean indicating if more results exist
* `limit`: The limit used for this request

### Filtering

List queries support filtering via the `filter` parameter:

```graphql theme={null}
filter: {
  fieldName: { operator: value }
}
```

Common operators: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `like`, `in`, `notIn`

### Sorting

List queries support sorting via the `sort` parameter:

```graphql theme={null}
sort: [{ field: "fieldName", order: ASC }]
```

## Available Queries

<CardGroup cols={2}>
  <Card title="Components" icon="puzzle-piece" href="/graphql/queries/components">
    Query UI components by search term or ID
  </Card>

  <Card title="Packages" icon="box" href="/graphql/queries/packages">
    Query published component packages
  </Card>

  <Card title="Content" icon="file-lines" href="/graphql/queries/content">
    Query content items with filtering and sorting
  </Card>

  <Card title="Content Types" icon="shapes" href="/graphql/queries/content-types">
    Query content type schemas
  </Card>

  <Card title="Assets" icon="image" href="/graphql/queries/assets">
    Query media assets with filtering
  </Card>

  <Card title="Tags" icon="tags" href="/graphql/queries/tags">
    Query tags for organizing content
  </Card>

  <Card title="Saved Searches" icon="bookmark" href="/graphql/queries/saved-searches">
    Query and execute saved searches
  </Card>

  <Card title="Preview" icon="eye" href="/graphql/queries/preview">
    Access draft content via preview tokens
  </Card>

  <Card title="Package Data" icon="database" href="/graphql/queries/package-data">
    Fetch resolved package data for caching
  </Card>
</CardGroup>
