Skip to main content

List Assets

Fetch a paginated list of assets with filtering, sorting, and search.
query GetAssets(
  $type: String
  $tags: [String!]
  $search: String
  $filter: AssetFilter
  $sort: [SortCriteria!]
  $page: Int
  $limit: Int
) {
  assets(
    type: $type
    tags: $tags
    search: $search
    filter: $filter
    sort: $sort
    page: $page
    limit: $limit
  ) {
    data {
      id
      name
      type
      url
      size
      width
      height
      tags
    }
    pagination {
      page
      limit
      total
      pages
    }
  }
}

Parameters

ParameterTypeDefaultDescription
typeString-Filter by MIME type
tags[String!]-Filter by tags (AND logic)
searchString-Search in name and description
filterAssetFilter-Advanced field filtering
sort[SortCriteria!]-Sort criteria
pageInt1Page number
limitInt20Items per page

Filter Example

query {
  assets(
    type: "image/jpeg"
    tags: ["hero"]
    filter: {
      name: { like: "%banner%" }
      size: { lte: 500000 }
    }
    sort: [{ field: "updatedAt", order: DESC }]
    page: 1
    limit: 10
  ) {
    data {
      id
      name
      type
      url
      size
      width
      height
      tags
    }
    pagination {
      total
      pages
    }
  }
}
Response:
{
  "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": {
        "total": 1,
        "pages": 1
      }
    }
  }
}

Get Single Asset

Fetch a specific asset by ID.
query GetAsset($id: ID!) {
  asset(id: $id) {
    id
    name
    description
    type
    url
    size
    width
    height
    tags
    createdAt
    updatedAt
  }
}

Parameters

ParameterTypeRequiredDescription
idID!YesAsset ID

Example

query {
  asset(id: "asset123") {
    id
    name
    type
    url
    size
    width
    height
  }
}
Response:
{
  "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

FieldTypeDescription
idID!Unique identifier
nameString!File name
descriptionStringAsset description
typeString!MIME type
urlString!CDN URL
sizeInt!File size in bytes
widthIntImage width (images only)
heightIntImage height (images only)
tags[String!]Associated tags
createdAtDateTime!Upload timestamp
updatedAtDateTime!Last update timestamp

Common MIME Types

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