Skip to content

pull

Terminal window
ctkit pull

Fetches every content type from your Contentful space and generates a TypeScript schema file for each one in your schemas/ directory. Files are automatically formatted with Prettier if a configuration is detected in your project.

Pulled 5 content types:
schemas/blogPost.ts
schemas/author.ts
schemas/category.ts
schemas/settings.ts
schemas/navigation.ts

By default, ctkit will not overwrite existing schema files. If a file already exists for a content type, it is skipped and a warning is shown.

Terminal window
ctkit pull --content-type blogPost

Pulls only the specified content type instead of everything in the space. Useful when you want to add a single existing type to your local schemas without touching the rest.

Terminal window
ctkit pull --force

Overwrites existing schema files instead of skipping them. Use this to reset a local schema to match exactly what’s in Contentful.

FlagDescription
--content-type <id>Pull only the content type with this ID.
--forceOverwrite existing schema files instead of skipping them.

Each pulled content type produces a TypeScript file using the ctkit schema API:

schemas/blogPost.ts
import { contentType, fields } from '@ctkit/core';
export const blogPost = contentType('blogPost', {
name: 'Blog Post',
description: 'A blog post with a title, body, and author.',
displayField: 'title',
fields: {
title: fields.symbol({
name: 'Title',
required: true,
}),
body: fields.richText({
name: 'Body',
}),
author: fields.link({
name: 'Author',
linkType: 'Entry',
validations: [{ linkContentType: ['author'] }],
}),
},
});

All field options, validations, and appearances are preserved in the generated schema so the file is a complete representation of the remote content type.

pull is the recommended way to adopt ctkit on an existing Contentful space. Instead of rewriting your content model from scratch:

  1. Run ctkit pull to generate schema files for your current content types.
  2. Review the generated files — adjust naming or organization as needed.
  3. Run ctkit check to confirm local and remote are in sync.
  4. From here on, use generate + migrate (or push) to manage changes in code.