{"id":13563122,"url":"https://github.com/webflow/js-webflow-api","last_synced_at":"2025-04-03T19:32:22.520Z","repository":{"id":38365423,"uuid":"73836338","full_name":"webflow/js-webflow-api","owner":"webflow","description":"Node.js SDK for the Webflow Data API","archived":false,"fork":false,"pushed_at":"2025-03-26T20:47:57.000Z","size":2270,"stargazers_count":307,"open_issues_count":20,"forks_count":100,"subscribers_count":91,"default_branch":"master","last_synced_at":"2025-03-26T21:35:09.327Z","etag":null,"topics":["api","business-critical-yes","cms","ecommerce","membership","oauth2","sdk","webflow"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/webflow-api","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-15T17:05:03.000Z","updated_at":"2025-03-24T09:54:03.000Z","dependencies_parsed_at":"2024-01-19T07:10:43.243Z","dependency_job_id":"cf436ae7-fda5-4fc4-a730-71fdbcc86c3b","html_url":"https://github.com/webflow/js-webflow-api","commit_stats":{"total_commits":105,"total_committers":15,"mean_commits":7.0,"dds":0.6476190476190475,"last_synced_commit":"9d36bb178ec86e6d97785ccb2dcb9941c1ab2297"},"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webflow%2Fjs-webflow-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webflow%2Fjs-webflow-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webflow%2Fjs-webflow-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webflow%2Fjs-webflow-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webflow","download_url":"https://codeload.github.com/webflow/js-webflow-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247065407,"owners_count":20877769,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","business-critical-yes","cms","ecommerce","membership","oauth2","sdk","webflow"],"created_at":"2024-08-01T13:01:15.367Z","updated_at":"2025-04-03T19:32:22.504Z","avatar_url":"https://github.com/webflow.png","language":"TypeScript","readme":"# Webflow JS SDK\n\n[![npm shield](https://img.shields.io/npm/v/webflow-api)](https://www.npmjs.com/package/webflow-api)\n[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern)\n\nThe Webflow JavaScript SDK provides convenient access to the [Webflow Data API](https://developers.webflow.com/reference/rest-introduction) from\napplications written in JS.\n\nThe SDK contains typings and request builders for the Webflow Data API.\n\n## Documentation\n\nExplore the [API reference documentation](https://developers.webflow.com/reference/rest-introduction).\n\n## Installation\n\nAdd this dependency to your project's package.json file:\n\nUsing npm:\n\n```shell\n$ npm install webflow-api\n```\n\nUsing yarn\n\n```shell\n$ yarn add webflow-api\n```\n\n## Usage\n\nSimply import `Webflow` and start making calls to our API.\n\n```javascript\nimport { WebflowClient } from \"webflow-api\";\n\nconst webflow = new WebflowClient({ accessToken });\n\n// Env. variables\n// in format of string, e.g.: \"639656400769508adc12fe42\"\nconst site_id = process.env.SITE_ID;\nconst custom_domain_id_1 = process.env.CUSTOM_DOMAIN_ID_1;\nconst custom_domain_id_2 = process.env.CUSTOM_DOMAIN_ID_2;\n\n// Sites\n\n// List Sites\nconst sites = await webflow.sites.list();\n\n// Get Site\nconst site = await webflow.sites.get(\"site_id\");\n\n// Get Custom Domains\nconst customDomains = await webflow.sites.getCustomDomain(site_id);\n\n// Publish Site\nconst site = await webflow.sites.publish(site_id, {\n  customDomains: [custom_domain_id_1, custom_domain_id_2],\n  publishToWebflowSubdomain: true,\n});\n```\n\n## OAuth\n\nTo implement OAuth, you'll need to [register a Webflow App in your Workspace](https://developers.webflow.com/reference/authorization)\n\n### Step 1: Authorize URL\n\nThe first step in OAuth is to generate an Authorization URL. Use this URL\nto fetch your Authorization Code. See the [docs](https://docs.developers.webflow.com/v1.0.0/docs/oauth#user-authorization)\nfor more details.\n\n```javascript\nimport { WebflowClient } from \"webflow-api\";\n\nconst authorizeUrl = WebflowClient.authorizeURL({\n    state: \"your_state\",\n    scope: \"sites:read\",\n    clientId: \"your_client_id\",\n    redirectUri: \"your_redirect_uri\",\n});\n\nconsole.log(authorizeUrl);\n```\n\n### Step 2: Retrieve your access token\n\nUse the `getAccessToken` function and pass in your `client_id`,\n`client_secret`, and `authorization_code`.\n\n```javascript\nimport { WebflowClient } from \"webflow-api\";\n\nconst accessToken = WebflowClient.getAccessToken({\n  clientId: \"your_client_id\", \n  clientSecret: \"your_client_secret\",\n  code: \"your_authorization_code\"\n});\n```\n\n### Step 3: Instantiate the client\n\nInstantiate the client using your `access_token`.\n\n```javascript\nimport { WebflowClient } from \"webflow-api\";\n\nconst webflow = WebflowClient({ accessToken });\n```\n\n## Webflow Types\n\nAll of the types are nested within the `Webflow` namespace. Let IntelliSense\nguide you!\n\n## Exception Handling\n\nAll errors thrown by the SDK will be subclasses of [`WebflowError`](./src/errors/WebflowError.ts).\n\n```javascript\nimport { WebflowClient, Webflow } from 'webflow';\nconst webflow = new WebflowClient({ accessToken: 'your_access_token' });\n\ntry {\n  const sites = await webflow.sites.get(...);\n} catch (e) {\n  if (e instanceof Webflow.ForbiddenError) {\n    console.log(e.body.message);\n  } else if (e instanceof Webflow.BadRequestError) {\n    console.log(e.body.message);\n  } else {\n    throw e;\n  }\n}\n```\n\n## Advanced\n\n### Timeouts\n\nBy default, requests time out after 60 seconds. You can configure the timeout and # of max retries\n\n```javascript\nimport { WebflowClient } from 'webflow';\n\nconst sites = await webflow.sites.get(..., {\n  timeoutInSeconds: 30 // override the timeout\n});\n```\n\n### Retries\nThe SDK will automatically retry failures with exponential backoff. \nYou can configure the retries by setting maxRetries.\n\n```javascript\nimport { WebflowClient } from 'webflow';\n\nconst sites = await webflow.sites.get(..., {\n  maxRetries: 10 // override the retries\n});\n```\n\n## Beta Status\n\nThis SDK is in **Preview**, and there may be breaking changes between versions without a major\nversion update.\n\nTo ensure a reproducible environment (and minimize risk of breaking changes), we recommend pinning a specific package version.\n\n## Contributing\n\nWhile we value open-source contributions to this SDK, this library is generated programmatically.\nAdditions made directly to this library would have to be moved over to our generation code,\notherwise they would be overwritten upon the next generated release. Feel free to open a PR as\na proof of concept, but know that we will not be able to merge it as-is. We suggest opening\nan issue first to discuss with us!\n\nOn the other hand, contributions to the README are always very welcome!\n","funding_links":[],"categories":["JavaScript","主机效能与全球内容传递网络"],"sub_categories":["📖 开发者资源"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebflow%2Fjs-webflow-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebflow%2Fjs-webflow-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebflow%2Fjs-webflow-api/lists"}