Skip to main content

List Content

Fetch a paginated list of content with filtering, sorting, and search.
query GetContents(
  $typeId: ID
  $tags: [String!]
  $locale: String
  $search: String
  $filter: ContentFilter
  $sort: [SortCriteria!]
  $page: Int
  $limit: Int
) {
  contents(
    typeId: $typeId
    tags: $tags
    locale: $locale
    search: $search
    filter: $filter
    sort: $sort
    page: $page
    limit: $limit
  ) {
    data {
      id
      name
      description
      tags
      locale
      updatedAt
    }
    pagination {
      page
      limit
      total
      pages
    }
  }
}

Parameters

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

Filter Example

query {
  contents(
    typeId: "ct123"
    tags: ["tutorial"]
    locale: "en-US"
    filter: {
      createdAt: { gte: "2024-01-01T00:00:00Z" }
    }
    sort: [{ field: "updatedAt", order: DESC }]
    page: 1
    limit: 20
  ) {
    data {
      id
      name
      tags
      locale
    }
    pagination {
      total
      pages
    }
  }
}
Response:
{
  "data": {
    "contents": {
      "data": [
        {
          "id": "cont456",
          "name": "Getting Started Guide",
          "tags": ["tutorial", "beginner"],
          "locale": "en-US"
        }
      ],
      "pagination": {
        "total": 1,
        "pages": 1
      }
    }
  }
}

Get Single Content

Fetch a specific content item by ID.
query GetContent($id: ID!) {
  content(id: $id) {
    id
    name
    description
    compiled
    tags
    locale
    contentType {
      id
      name
      schema
    }
    createdAt
    updatedAt
  }
}

Parameters

ParameterTypeRequiredDescription
idID!YesContent ID

Get Content with Resolved Package

Include all package data needed to render the content.
query GetContentResolved($id: ID!) {
  content(id: $id) {
    id
    name
    compiled
    contentType {
      name
      schema
    }
    resolved {
      package {
        id
        version
        components
        assets
      }
      dependencies {
        id
        version
        components
        assets
      }
    }
  }
}

Get Content with Caching References

For optimal caching, fetch only package IDs and resolve separately.
query GetContentWithCaching($id: ID!) {
  content(id: $id) {
    id
    name
    compiled
    resolvedRef {
      package
      dependencies
    }
  }
}
Response:
{
  "data": {
    "content": {
      "id": "cont123",
      "name": "Getting Started",
      "compiled": "const body = () => { ... }",
      "resolvedRef": {
        "package": "abc123def456...",
        "dependencies": ["xyz789ghi012..."]
      }
    }
  }
}
Use resolvedPackageData to fetch the actual package content by ID.

Content Fields

FieldTypeDescription
idID!Unique identifier
nameString!Content name
descriptionStringContent description
compiledStringCompiled content data
tags[String!]Associated tags
localeStringContent locale
contentTypeContentType!Associated content type
resolvedResolvedPackageFull package data
resolvedRefResolvedPackageRefPackage IDs for caching
createdAtDateTime!Creation timestamp
updatedAtDateTime!Last update timestamp