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

Type Definition

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

FieldTypeDescription
idID!Unique identifier
nameString!File name
descriptionString!Asset description
typeString!MIME type
urlString!CDN URL for the asset
sizeInt!File size in bytes
widthIntImage width in pixels (images only)
heightIntImage height in pixels (images only)
tags[String!]!Tags for categorization
createdAtDateTime!Upload timestamp
updatedAtDateTime!Last update timestamp

Field Details

type

The MIME type of the asset:
TypeDescription
image/jpegJPEG images
image/pngPNG images
image/gifGIF images
image/webpWebP images
image/svg+xmlSVG graphics
video/mp4MP4 videos
video/webmWebM videos
application/pdfPDF 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

query GetAssets($type: String, $tags: [String!]) {
  assets(type: $type, tags: $tags) {
    data {
      id
      name
      type
      url
      size
      width
      height
      tags
    }
    pagination {
      total
    }
  }
}

Get Single Asset

query GetAsset($id: ID!) {
  asset(id: $id) {
    id
    name
    description
    type
    url
    size
    width
    height
    tags
    createdAt
    updatedAt
  }
}
Response:
{
  "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

query GetSmallImages {
  assets(
    type: "image/jpeg"
    filter: { size: { lte: 100000 } }
  ) {
    data {
      id
      name
      url
      size
    }
  }
}
  • Package - Assets can be bundled with packages
  • Tag - Tags for asset categorization