Fields

Create and update fields in CMS collections using the Fields tools. Fields define the data structure for collection items.

Create static field

Create a new static field in a CMS collection (e.g., text, number, date, etc.).

Tool: collection_fields_create_static

collection_id
stringRequired

Unique identifier for the collection

request
objectRequired

Static field definition

displayName
stringRequired

Field name

slug
stringRequired

Field slug

fieldType
stringRequired

Type of field (text, number, date, etc.)

isRequired
boolean

Whether the field is required

isUnique
boolean

Whether values must be unique

POST
/v2/collections/:collection_id/fields
1from webflow import StaticField, Webflow
2
3client = Webflow(
4 access_token="YOUR_ACCESS_TOKEN",
5)
6client.collections.fields.create(
7 collection_id="580e63fc8c9a982ac9b8b745",
8 request=StaticField(
9 id="562ac0395358780a1f5e6fbc",
10 is_editable=True,
11 is_required=False,
12 type="RichText",
13 display_name="Post Body",
14 help_text="Add the body of your post here",
15 ),
16)

Returns: Created field object


Create option field

Create a new option field in a CMS collection with predefined choices.

Tool: collection_fields_create_option

collection_id
stringRequired

Unique identifier for the collection

request
objectRequired

Option field definition

displayName
stringRequired

Field name

slug
stringRequired

Field slug

options
arrayRequired

Array of option values

isRequired
boolean

Whether the field is required

POST
/v2/collections/:collection_id/fields
1from webflow import Metadata, MetadataOptionsItem, OptionField, Webflow
2
3client = Webflow(
4 access_token="YOUR_ACCESS_TOKEN",
5)
6client.collections.fields.create(
7 collection_id="580e63fc8c9a982ac9b8b745",
8 request=OptionField(
9 id="562ac0395358780a1f5e6fbc",
10 is_editable=True,
11 is_required=False,
12 display_name="Post Type",
13 help_text="Add the body of your post here",
14 metadata=Metadata(
15 options=[
16 MetadataOptionsItem(
17 name="Feature",
18 ),
19 MetadataOptionsItem(
20 name="News",
21 ),
22 MetadataOptionsItem(
23 name="Product Highlight",
24 ),
25 ],
26 ),
27 ),
28)

Returns: Created field object


Create reference field

Create a new reference field in a CMS collection that links to items in another collection.

Tool: collection_fields_create_reference

collection_id
stringRequired

Unique identifier for the collection

request
objectRequired

Reference field definition

displayName
stringRequired

Field name

slug
stringRequired

Field slug

referencedCollectionId
stringRequired

ID of the referenced collection

isRequired
boolean

Whether the field is required

POST
/v2/collections/:collection_id/fields
1from webflow import ReferenceField, ReferenceFieldMetadata, Webflow
2
3client = Webflow(
4 access_token="YOUR_ACCESS_TOKEN",
5)
6client.collections.fields.create(
7 collection_id="580e63fc8c9a982ac9b8b745",
8 request=ReferenceField(
9 id="562ac0395358780a1f5e6fbd",
10 is_editable=True,
11 is_required=False,
12 type="Reference",
13 display_name="Author",
14 help_text="Add the post author here",
15 metadata=ReferenceFieldMetadata(
16 collection_id="63692ab61fb2852f582ba8f5",
17 ),
18 ),
19)

Returns: Created field object


Update field

Update properties of an existing field in a CMS collection.

Tool: collection_fields_update

collection_id
stringRequired

Unique identifier for the collection

field_id
stringRequired

Unique identifier for the field

request
objectRequired

Field update object with properties to modify

PATCH
/v2/collections/:collection_id/fields/:field_id
1from webflow import Webflow
2
3client = Webflow(
4 access_token="YOUR_ACCESS_TOKEN",
5)
6client.collections.fields.update(
7 collection_id="580e63fc8c9a982ac9b8b745",
8 field_id="580e63fc8c9a982ac9b8b745",
9 is_required=False,
10 display_name="Post Body",
11 help_text="Add the body of your post here",
12)

Returns: Updated field object