Breaking changes in JavaScript SDK: December 17, 2024 release

This document outlines the breaking changes introduced in the December 17, 2024 release of the Webflow Data API and JavaScript SDK. Review these changes carefully as they may require updates to your existing implementations.

Breaking changes in JavaScript SDK

These changes require updates to existing code if you’re using the JavaScript SDK. Review and update your implementation to ensure compatibility.

Collection management

  • Changed method name for deleting collections

    1// Old
    2client.collections.deleteCollection()
    3
    4// New
    5client.collections.delete(collectionId)
  • New method for deleting collection fields

    1client.collections.deleteField(collectionId, fieldId)

CMS item creation

  • Changed: client.collections.createItems() replaces previous methods
  • Removed: client.collections.createItemForMultipleLocales()

Pages localization

  • Changed parameter name: The locale query parameter is now localeId

Migration guide

Deleting collection items

If you’re using the existing collection deletion method, update your code to use the new method name:

Delete collection item
1// Before
2await client.collections.deleteCollection(collectionId);
3
4// After
5await client.collections.delete(collectionId);

Collection item creation

Replace any usage of the deprecated methods with the new unified method:

Create collection item
1// Before (deprecated)
2await client.collections.createItemForMultipleLocales(collectionId, {
3 localeIds: [primaryCmsLocaleId, secondaryCmsLocaleId],
4 // other params
5});
6
7// After
8await client.collections.items.createItems(collectionId, {
9 cmsLocaleIds: [primaryCmsLocaleId, secondaryCmsLocaleId],
10 isArchived: false,
11 isDraft: false,
12 fieldData: {
13 // your fields here
14 },
15});

Page localization

Update any code that queries localized pages to use the new parameter name:

Page localization
1// Before
2const pages = await client.pages.list({ locale: "507f1f77bcf86cd799439011" });
3
4// After
5const pages = await client.pages.list({ localeId: "507f1f77bcf86cd799439011" });

If you encounter any issues with these changes, please contact our support team for assistance.

SDK improvements

  • Type improvements

    • Removed requirement for id in request payloads when creating resources
    • fieldData type in CMS Items now allows arbitrary key/value pairs, supporting custom fields
  • Flexible CMS item creation The SDK now allows creation of CMS items with custom fields without requiring type updates