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

# Asset

> Media files with CDN URLs

The `Asset` type represents media files (images, videos, documents) stored in Metabind with CDN-delivered URLs.

## Type Definition

```graphql theme={null}
type Asset {
  id: ID!
  name: String!
  description: String!
  type: String!
  url: String!
  size: Int!
  width: Int
  height: Int
  tags: [String!]!
  createdAt: DateTime!
  updatedAt: DateTime!
}
```

## Fields

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

## Field Details

### type

The MIME type of the asset:

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

### url

Assets are served from the Metabind CDN with automatic optimization:

```
https://cdn.metabind.ai/assets/proj123/hero-image.jpg
```

### width and height

Image dimensions are automatically extracted during upload. These fields are `null` for non-image assets.

## Example Queries

### List Assets

```graphql theme={null}
query GetAssets($type: String, $tags: [String!], $cursor: String) {
  assets(type: $type, tags: $tags, cursor: $cursor, limit: 20) {
    data {
      id
      name
      type
      url
      size
      width
      height
      tags
    }
    pagination {
      cursor
      hasMore
      limit
    }
  }
}
```

### Get Single Asset

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

Response:

```json theme={null}
{
  "data": {
    "asset": {
      "id": "asset123",
      "name": "hero-banner.jpg",
      "description": "Homepage hero banner image",
      "type": "image/jpeg",
      "url": "https://cdn.metabind.ai/assets/proj123/hero-banner.jpg",
      "size": 245000,
      "width": 1920,
      "height": 1080,
      "tags": ["hero", "banner", "homepage"],
      "createdAt": "2024-01-10T10:00:00Z",
      "updatedAt": "2024-01-10T10:00:00Z"
    }
  }
}
```

### Filter by Size

```graphql theme={null}
query GetSmallImages {
  assets(
    type: "image/jpeg"
    filter: { size: { lte: 100000 } }
  ) {
    data {
      id
      name
      url
      size
    }
  }
}
```

## Related Types

* [Package](/graphql/types/package) - Assets can be bundled with packages
* [Tag](/graphql/types/tag) - Tags for asset categorization
