Skip to main content

List Content Types

Fetch a paginated list of content types with optional search.
query GetContentTypes($search: String, $page: Int, $limit: Int) {
  contentTypes(search: $search, page: $page, limit: $limit) {
    data {
      id
      name
      description
      packageVersion
    }
    pagination {
      page
      limit
      total
      pages
    }
  }
}

Parameters

ParameterTypeDefaultDescription
searchString-Filter by name
pageInt1Page number
limitInt20Items per page

Example

query {
  contentTypes(search: "Article", page: 1, limit: 10) {
    data {
      id
      name
      description
      packageVersion
    }
    pagination {
      total
    }
  }
}
Response:
{
  "data": {
    "contentTypes": {
      "data": [
        {
          "id": "ct123",
          "name": "Article",
          "description": "Blog articles and news posts",
          "packageVersion": "2.0.0"
        },
        {
          "id": "ct124",
          "name": "ArticleSummary",
          "description": "Compact article display",
          "packageVersion": "2.0.0"
        }
      ],
      "pagination": {
        "total": 2
      }
    }
  }
}

Get Single Content Type

Fetch a specific content type by ID.
query GetContentType($id: ID!) {
  contentType(id: $id) {
    id
    name
    description
    packageVersion
    schema
    createdAt
    updatedAt
  }
}

Parameters

ParameterTypeRequiredDescription
idID!YesContent type ID

Example

query {
  contentType(id: "ct123") {
    id
    name
    description
    packageVersion
    schema
  }
}
Response:
{
  "data": {
    "contentType": {
      "id": "ct123",
      "name": "Article",
      "description": "Blog articles and news posts",
      "packageVersion": "2.0.0",
      "schema": "{\"type\":\"object\",\"properties\":{\"title\":{\"type\":\"string\"},\"body\":{\"type\":\"string\"},\"author\":{\"type\":\"string\"}}}"
    }
  }
}

Content Type Fields

FieldTypeDescription
idID!Unique identifier
nameString!Content type name
descriptionStringDescription
packageVersionStringBound package version
schemaStringJSON Schema defining content structure
createdAtDateTime!Creation timestamp
updatedAtDateTime!Last update timestamp

Schema Structure

The schema field contains a JSON Schema that defines the content structure:
{
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "description": "Article title"
    },
    "body": {
      "type": "string",
      "description": "Article body content"
    },
    "author": {
      "type": "string",
      "description": "Author name"
    },
    "publishDate": {
      "type": "string",
      "format": "date-time"
    },
    "tags": {
      "type": "array",
      "items": { "type": "string" }
    }
  },
  "required": ["title", "body"]
}
Content items of this type must conform to this schema.