Managing CMS Collections and Items
An end-to-end guide for creating and managing CMS content programmatically.
This page covers how to programmatically manage your Webflow CMS content. You’ll learn how to:
- Create a collection and define its schema.
- Populate the collection with content and perform CRUD operations on those items.
- Publish a collection and its items.
Generate schemas and content with AI
Use the MCP Server to create a Collection and its Items from a single natural language prompt. Go from a simple description to a fully populated Collection in seconds.
1. Creating a collection
The first step in managing your content is to create a collection, which serves as a blueprint for your items. This process involves getting your site_id
, defining a schema, and then creating the collection via the API. To learn more about collections, see the Collections Reference.
Get your site ID
Every collection is associated with a specific Webflow site. You’ll need your site_id
to create a collection. You can find this by calling the List Sites endpoint and locating the site you want to work with in the response.
Define the collection schema
Next, you’ll define the schema for your collection. This includes the displayName
for the collection, the singularName
for its items, the slug
for the collection, and an array of fields
.
Default fields
Each collection will always have the following fields in its schema:
name
- The name of the itemslug
- The slug of the item. Slugs should be unique, and formatted as all lowercase with no spaces. Any spaces will be converted to ”-”.
Custom fields
You can add additional custom fields to the collection. Each field will have its own type
, displayName
, slug
, and other properties to configure its behavior. A collection’s schema can have up to 60 fields. To see the different field types and their properties, see the Field Types & Item Values Reference.
Here is an example of a schema for a “Hitchhiker’s Guide” collection that includes various field types:
Field Validations
When defining a field in the Webflow UI, you can also specify validations for the field. Currently, the API doesn’t support field validations. All validations must be specified in the Webflow UI.
Create the collection
With your site_id
and schema, you can now create the collection by making a POST
request to the Create Collection endpoint.
Adding advanced field types
When defining a collection’s schema, Option
and Reference
fields require a metadata
object to be configured.
Defining an Option Field
The Option
field allows you to create a predefined list of choices for an item, which can be selected from a dropdown menu in the CMS.
When creating an Option
field, you must provide a metadata
object containing an options
array. Each object in the array defines a choice with a name
. Webflow will automatically generate an id
for each option.
Defining Reference and Multi-Reference Fields
The Reference
and Multi-Reference
fields allow you to link a collection item to one or more other items from another collection.
When creating Reference
or Multi-Reference
fields, you must provide a metadata
object containing the collectionId
of the collection you intend to reference.
Get the Collection ID
First, you need the id
of the collection you want to reference. You can get this by calling the List Collections endpoint and finding the target collection in the response.
2. Managing collection items
Once your collection is created, you can begin to populate it with items. The following sections demonstrate how to perform CRUD (Create, Read, Update, Delete) operations on the items in your new collection.
When creating collection items, you can use the staged or live endpoints to manage the item’s publishing state. For more details on publishing options when creating an item, see the Publishing Guide.
Creating an item
Get the collection ID
First, you need the id
of the collection you want to create an item for. The Create Collection response will include the collection’s id
. However, you can also get the collection ID by calling the List Collections endpoint and finding the collection in the response.
Create a collection item
To add an item, send a POST
request to the Create Collection Item endpoint. The fieldData
object in the request body must match the schema you defined for the collection.
Populating advanced field types
Most fields accept simple values like strings or numbers. However, fields like Option
, and Reference
require specific identifiers. The sections below explain how to get the correct IDs to populate these fields when creating or updating an item.
Populating an option field
Option
fields require the unique id
of the choice, which is defined in the collection’s schema.
Get collection details
To find the id
for each option, retrieve the collection’s schema by calling the Get Collection Details endpoint.
Populating reference and multi-reference fields
Reference
and Multi-Reference
fields link an item to one or more other collection items. To create a reference, you need the id
of the item you want to link to.
To reference a collection item, the collection must be published to the site.
Find the item IDs
To get the id
of the item you want to reference, call the List Items endpoint on the collection that contains the target item. You can filter the results to find the specific items you need.
Listing, updating, and deleting items
List collection items
To get a list of all items in a collection, send a GET
request to the List Collection Items endpoint.
Pagination
When listing items, the response will be paginated. You can control the pagination using the limit
and offset
query parameters.
limit
: The maximum number of items to return (up to 100).offset
: The number of items to skip from the beginning of the list.
By default, the API will return up to 100 items. If a collection contains more than 100 items, you can use offset
to retrieve additional pages of results. For example, to get the second page of 100 items, you would set offset
to 100
.
The response will include a pagination
object with total
, limit
, and offset
fields, which you can use to loop through the pages of results.
Update a collection item
To modify an existing item, you’ll first need its id
. You can get the item’s id
by calling the List Collection Items endpoint and finding the item in the response.
Then, use the PATCH
endpoint to Update a Collection Item. You only need to provide the fields you want to change in the fieldData
object.
Delete a collection item
To remove an item from a collection, you’ll need its id
. You can get the item’s id
by calling the List Collection Items endpoint and finding the item in the response.
Then, use the DELETE
endpoint to Delete a Collection Item.
3. Publishing a collection
Once you’ve created your collection and its items, you can publish the collection. This will make the collection and its items visible on your live site. Additionally, this allows the collection’s items to be referenced by other collections.
To publish a collection or any collection items, you’ll need to publish the entire site. You can publish the site by calling the Publish Site endpoint.
Next steps
Once you have created your collections and populated them with content, you can explore more advanced topics like publishing and localization.