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

# Assets

> Query media assets with filtering

## List Assets

Fetch a paginated list of assets with filtering, sorting, and search.

```graphql theme={null}
query GetAssets(
  $type: String
  $tags: [String!]
  $search: String
  $filter: AssetFilter
  $sort: [SortCriteria!]
  $cursor: String
  $limit: Int
) {
  assets(
    type: $type
    tags: $tags
    search: $search
    filter: $filter
    sort: $sort
    cursor: $cursor
    limit: $limit
  ) {
    data {
      id
      name
      type
      url
      size
      width
      height
      tags
    }
    pagination {
      cursor
      hasMore
      limit
    }
  }
}
```

### Parameters

| Parameter | Type             | Default | Description                    |
| --------- | ---------------- | ------- | ------------------------------ |
| `type`    | String           | -       | Filter by MIME type            |
| `tags`    | \[String!]       | -       | Filter by tags (AND logic)     |
| `search`  | String           | -       | Search in name and description |
| `filter`  | AssetFilter      | -       | Advanced field filtering       |
| `sort`    | \[SortCriteria!] | -       | Sort criteria                  |
| `cursor`  | String           | null    | Cursor for pagination          |
| `limit`   | Int              | 20      | Items per page                 |

### Filter Example

```graphql theme={null}
query {
  assets(
    type: "image/jpeg"
    tags: ["hero"]
    filter: {
      name: { like: "%banner%" }
      size: { lte: 500000 }
    }
    sort: [{ field: "updatedAt", order: DESC }]
    limit: 10
  ) {
    data {
      id
      name
      type
      url
      size
      width
      height
      tags
    }
    pagination {
      cursor
      hasMore
    }
  }
}
```

Response:

```json theme={null}
{
  "data": {
    "assets": {
      "data": [
        {
          "id": "asset123",
          "name": "hero-banner.jpg",
          "type": "image/jpeg",
          "url": "https://cdn.metabind.ai/assets/hero-banner.jpg",
          "size": 245000,
          "width": 1920,
          "height": 1080,
          "tags": ["hero", "banner"]
        }
      ],
      "pagination": {
        "cursor": null,
        "hasMore": false
      }
    }
  }
}
```

## Get Single Asset

Fetch a specific asset by ID.

```graphql theme={null}
query GetAsset($id: ID!) {
  asset(id: $id) {
    id
    name
    description
    type
    url
    size
    width
    height
    tags
    createdAt
    updatedAt
  }
}
```

### Parameters

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id`      | ID!  | Yes      | Asset ID    |

### Example

```graphql theme={null}
query {
  asset(id: "asset123") {
    id
    name
    type
    url
    size
    width
    height
  }
}
```

Response:

```json theme={null}
{
  "data": {
    "asset": {
      "id": "asset123",
      "name": "hero-banner.jpg",
      "type": "image/jpeg",
      "url": "https://cdn.metabind.ai/assets/hero-banner.jpg",
      "size": 245000,
      "width": 1920,
      "height": 1080
    }
  }
}
```

## Asset Fields

| Field         | Type        | Description                |
| ------------- | ----------- | -------------------------- |
| `id`          | ID!         | Unique identifier          |
| `name`        | String!     | File name                  |
| `description` | String!     | Asset description          |
| `type`        | String!     | MIME type                  |
| `url`         | String!     | CDN URL                    |
| `size`        | Int!        | File size in bytes         |
| `width`       | Int         | Image width (images only)  |
| `height`      | Int         | Image height (images only) |
| `tags`        | \[String!]! | Associated tags            |
| `createdAt`   | DateTime!   | Upload timestamp           |
| `updatedAt`   | DateTime!   | Last update timestamp      |

## Common MIME Types

| Type              | Description   |
| ----------------- | ------------- |
| `image/jpeg`      | JPEG images   |
| `image/png`       | PNG images    |
| `image/gif`       | GIF images    |
| `image/webp`      | WebP images   |
| `image/svg+xml`   | SVG graphics  |
| `video/mp4`       | MP4 videos    |
| `video/webm`      | WebM videos   |
| `application/pdf` | PDF documents |
