Registry / http-networking / webflow-api

webflow-api

JSON →
library3.3.4jsnpmunverified

The `webflow-api` package provides a JavaScript/TypeScript SDK for interacting with the Webflow Data API. It offers convenient access to Webflow resources such as sites, CMS items, assets, and comments, along with robust support for authentication via workspace or site tokens and OAuth. The SDK, currently at version 3.3.4, is actively maintained with frequent releases driven by its Fern-generated structure, ensuring up-to-date typings and request builders that align closely with the latest Webflow API specifications. Key differentiators include its comprehensive type definitions, automatic regeneration via Fern, and integrated utilities for complex operations like asset uploads and OAuth flows, distinguishing it from manual API client implementations. It requires Node.js version 18 or higher.

npm install webflow-api
INSTALL
IMPORT
SIG · WEBFLOW-API
W
webflow-api
http-networkingjavascriptv3.3.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WebflowClient
import { WebflowClient } from 'webflow-api';
const WebflowClient = require('webflow-api');
The library primarily uses ES modules. If using CommonJS, ensure proper interoperability or transpile. Directly requiring the package without destructuring will not yield the client constructor.
WebflowClient.authorizeURL
import { WebflowClient } from 'webflow-api'; const authorizeUrl = WebflowClient.authorizeURL({...});
import { authorizeURL } from 'webflow-api';
`authorizeURL` is a static method on the `WebflowClient` class, not a top-level named export. It must be called on the imported class.
Site
import type { Site } from 'webflow-api';
import { Site } from 'webflow-api';
For importing data model types (e.g., `Site`, `Collection`, `Item`), use `import type` to explicitly denote a type-only import, which improves bundle size and clarity in TypeScript projects.

This quickstart initializes the WebflowClient with an access token from environment variables, then demonstrates listing all sites, retrieving a specific site's details, and conditionally publishing a site. It highlights basic API interaction patterns.

import { WebflowClient } from "webflow-api"; // Ensure WEBFLOW_API_TOKEN and SITE_ID are set in your environment const WEBFLOW_API_TOKEN = process.env.WEBFLOW_API_TOKEN ?? ''; const SITE_ID = process.env.SITE_ID ?? ''; const CUSTOM_DOMAIN_ID_1 = process.env.CUSTOM_DOMAIN_ID_1 ?? ''; const CUSTOM_DOMAIN_ID_2 = process.env.CUSTOM_DOMAIN_ID_2 ?? ''; if (!WEBFLOW_API_TOKEN) { console.error("WEBFLOW_API_TOKEN environment variable is not set."); process.exit(1); } if (!SITE_ID) { console.error("SITE_ID environment variable is not set."); process.exit(1); } async function main() { const webflow = new WebflowClient({ accessToken: WEBFLOW_API_TOKEN, }); console.log("Listing sites..."); const sites = await webflow.sites.list(); console.log("Sites:", sites.data.sites.map(s => s.displayName)); console.log(`Getting site details for ID: ${SITE_ID}...`); try { const site = await webflow.sites.get(SITE_ID); console.log(`Site '${site.data.displayName}' found.`); } catch (error) { console.error(`Error getting site: ${(error as Error).message}`); } // Example for publishing, requiring custom domain IDs to be set if (CUSTOM_DOMAIN_ID_1 && CUSTOM_DOMAIN_ID_2) { console.log(`Publishing site ${SITE_ID}...`); try { const publishRequest = await webflow.sites.publish(SITE_ID, { customDomains: [CUSTOM_DOMAIN_ID_1, CUSTOM_DOMAIN_ID_2], publishToWebflowSubdomain: true, }); console.log("Publish request sent:", publishRequest); } catch (error) { console.error(`Error publishing site: ${(error as Error).message}`); } } } main().catch(console.error);
Debug
Known issues
breakingThe `webflow-api` SDK now requires Node.js version 18.0.0 or higher. Running on older Node.js versions will result in runtime errors.
fix
Upgrade your Node.js environment to version 18.0.0 or later.
affects: <3.0.0
breakingThe API endpoints and SDK methods for handling Form Submissions were updated in version 3.3.0-beta. Previous methods for listing, getting, updating, or deleting form submissions are no longer valid and new dedicated SDK methods must be used.
fix
Refer to the latest Webflow Data API documentation for updated methods to interact with form submissions and migrate your code accordingly.
affects: >=3.3.0-beta
breakingThe `isMembersOnly` property was removed from the `Page` type in version 3.1.4. Code relying on this property in page objects will encounter type errors or undefined values.
fix
Remove any direct references to the `isMembersOnly` property from `Page` type objects in your code. Consult the latest API documentation for alternative properties if needed.
affects: >=3.1.4
gotchaAll API calls require an `accessToken` (either a Workspace or Site token) to be provided during `WebflowClient` initialization. Missing or invalid tokens will result in authentication errors.
fix
Ensure you generate a valid API token from your Webflow Dashboard and pass it as the `accessToken` option when creating a new `WebflowClient` instance. Example: `new WebflowClient({ accessToken: process.env.WEBFLOW_API_TOKEN });`
affects: >=3.0.0
gotchaImplementing OAuth with the SDK requires careful management of client ID, client secret, redirect URIs, and authorization codes. Incorrect configuration or handling of these values will prevent successful token generation.
fix
Follow the official Webflow OAuth documentation precisely. Ensure your Webflow App is registered correctly, and that `clientId`, `redirectUri`, and `state` parameters match your application's setup when calling `WebflowClient.authorizeURL` and `WebflowClient.getAccessToken`.
affects: >=3.0.0
Errors
Common errors & fixes
Error: Access Token not provided.
The `accessToken` property was not supplied to the `WebflowClient` constructor, or it was an empty string.
fix
Initialize `WebflowClient` with a valid Webflow API token: `new WebflowClient({ accessToken: 'your-webflow-token' });` Ensure the token is not empty or undefined.
TypeError: WebflowClient is not a constructor
This typically occurs in CommonJS environments where `require('webflow-api')` is used without correctly accessing the named export, or when attempting to use a default import in an ESM context when only named exports exist.
fix
For ES Modules, use `import { WebflowClient } from 'webflow-api';`. For CommonJS, use `const { WebflowClient } = require('webflow-api');` to destructure the named export correctly.
Property 'formSubmissions' does not exist on type 'WebflowClient'.
Attempting to use an outdated or non-existent property/method related to form submissions after the API and SDK breaking changes introduced in `v3.3.0-beta`.
fix
Update your code to use the new, dedicated API endpoints and methods for form submissions as per the latest Webflow API documentation. The structure for interacting with these resources has changed.
ReferenceError: process is not defined
The code is attempting to access `process.env` in a browser environment without a bundler like Webpack or Rollup configured to provide a `process` polyfill or environment variable replacement.
fix
If running in a browser, ensure your bundler is configured to replace `process.env` with actual environment variables or a polyfill. Alternatively, pass tokens directly without relying on `process.env`.
Upgrade
Version history
3.3.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
46 hits · last 30 days
node
40
OpenAI (training)
1
Resources