### Initialize Synchronous Webflow Client and Get Site
Source: https://github.com/webflow/webflow-python/blob/main/README.md
Demonstrates how to initialize the synchronous Webflow client with an access token and retrieve site information. This is a basic usage example for making API calls.
```python
from webflow.client import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN"
)
site = client.sites.get("site-id")
```
--------------------------------
### Get Webflow Order
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Example usage for retrieving a specific order from a Webflow site using its unique identifiers. This demonstrates initializing the client and calling the get method.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.orders.get(
site_id="580e63e98c9a982ac9b8b741",
order_id="5e8518516e147040726cc415",
)
```
--------------------------------
### Install Webflow Python Library
Source: https://github.com/webflow/webflow-python/blob/main/README.md
Instructions for installing the Webflow Python SDK using pip or poetry. This is the first step to integrate Webflow's API into your Python project.
```bash
pip install webflow
# or
poetry add webflow
```
--------------------------------
### Initialize Asynchronous Webflow Client and Get Site
Source: https://github.com/webflow/webflow-python/blob/main/README.md
Shows how to initialize the asynchronous Webflow client and perform an async API call to get site data. This allows for non-blocking operations in your application.
```python
from webflow.client import AsyncWebflow
import asyncio
client = AsyncWebflow(
access_token="YOUR_ACCESS_TOKEN"
)
async def main() -> None:
site = await client.sites.get("site-id")
print("Received site", site)
asyncio.run(main())
```
--------------------------------
### Webflow Client Initialization and Custom Code Block Listing
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Demonstrates how to initialize the Webflow client with an access token and list custom code blocks for a given site ID. This snippet shows basic client setup and a common API interaction.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.sites.scripts.list_custom_code_blocks(
site_id="580e63e98c9a982ac9b8b741",
)
```
--------------------------------
### Update Webflow Order
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Example demonstrating how to update an order's details, such as comments or shipping information, using the webflow-python client. This includes optional parameters for tracking and related URLs.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.orders.update(
site_id="580e63e98c9a982ac9b8b741",
order_id="5e8518516e147040726cc415",
comment="Customer requested expedited shipping.",
shipping_provider="FedEx",
shipping_tracking="1234567890",
shipping_tracking_url="https://www.fedex.com/tracking/1234567890"
)
```
--------------------------------
### Webflow Pages API: Get Content Parameters
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Details the parameters for retrieving static content from a Webflow page. Includes page and locale identifiers. Note the required scope and localization behavior.
```APIDOC
get_content(page_id: str, locale_id: typing.Optional[str] = None)
Description:
Get static content from a static page. This includes text nodes, image nodes and component instances.
To retrieve the contents of components in the page use the [get component content](/data/reference/pages-and-components/components/get-content) endpoint.
Note: If you do not provide a Locale ID in your request, the response will return any content that can be localized from the Primary locale.
Required scope: pages:read
Parameters:
page_id (str): Unique identifier for a Page.
locale_id (typing.Optional[str]): Unique identifier for a specific locale. Applicable when using localization.
```
--------------------------------
### Get Webflow Collection Item Details (Python)
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Provides an example of retrieving the details for a specific item within a Webflow CMS Collection. It requires the collection ID and the item ID.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.collections.items.get_item(
collection_id="580e63fc8c9a982ac9b8b745",
item_id="580e64008c9a982ac9b8b754",
)
```
--------------------------------
### Get Form
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Get information about a given form. Requires 'forms:read' scope.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.forms.get(
form_id="580e63e98c9a982ac9b8b741",
)
```
--------------------------------
### Get Component Content using Webflow Python SDK
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Retrieves static content from a component definition, including text and image nodes, and nested component instances. To get dynamic content set by component properties, use the 'get component properties' endpoint. If no Locale ID is provided, content from the Primary locale is returned.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.components.get_content(
site_id="580e63e98c9a982ac9b8b741",
component_id="8505ba55-ef72-629e-f85c-33e4b703d48b",
locale_id="65427cf400e02b306eaa04a0",
)
```
--------------------------------
### Get Webhook
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Retrieves details for a specific webhook. Requires 'sites:read' scope.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.webhooks.get(
webhook_id="580e64008c9a982ac9b8b754",
)
```
--------------------------------
### Unfulfill Webflow Order
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Example for reverting an order's status to unfulfilled using the webflow-python client. This operation is useful for correcting fulfillment states.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.orders.update_unfulfill(
site_id="580e63e98c9a982ac9b8b741",
order_id="5e8518516e147040726cc415",
)
```
--------------------------------
### Get Webflow Page Content
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Retrieves static content from a Webflow page, including text nodes, image nodes, and component instances. If no locale ID is provided, content from the primary locale is returned. Requires 'pages:read' scope.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.pages.get_content(
page_id="63c720f9347c2139b248e552",
locale_id="65427cf400e02b306eaa04a0",
)
```
--------------------------------
### Get Page Custom Code - Python
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Retrieves all registered scripts applied to a specific Webflow Page. Requires page ID. Custom code must be registered first. Requires 'custom_code:read' scope and Data Client App token.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.pages.scripts.get_custom_code(
page_id="63c720f9347c2139b248e552",
)
```
--------------------------------
### List Products for Site (Python)
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Retrieves all products for a Webflow site, including their SKUs. Supports pagination using `limit` and `offset`. Requires site ID. Requires 'ecommerce:read' scope.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.products.list(
site_id="580e63e98c9a982ac9b8b741",
)
```
--------------------------------
### Webflow Products API Documentation
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Documentation for managing products and SKUs within the Webflow API using the Python SDK. Covers creating and updating SKUs, detailing parameters and usage.
```APIDOC
client.products.create_sku(...)
Description:
Create additional SKUs to manage every option and variant of your Product.
Creating SKUs through the API will set the product type to `Advanced`, which ensures all Product and SKU fields will be shown to users in the Designer.
Required scope | `ecommerce:write`
Parameters:
site_id (str): Unique identifier for a Site
product_id (str): Unique identifier for a Product
skus (typing.Sequence[Sku]): An array of the SKU data your are adding
publish_status (typing.Optional[PublishStatus]): Status for publishing the SKU.
request_options (typing.Optional[RequestOptions]): Request-specific configuration.
Usage Example:
from webflow import Sku, Webflow
client = Webflow(access_token="YOUR_ACCESS_TOKEN")
client.products.create_sku(
site_id="580e63e98c9a982ac9b8b741",
product_id="580e63fc8c9a982ac9b8b745",
skus=[Sku()],
)
client.products.update_sku(...)
Description:
Update a specified SKU. Updating an existing SKU will set the Product type to `Advanced`, which ensures all Product and SKU fields will be shown to users in the Designer.
Required scope | `ecommerce:write`
Parameters:
site_id (str): Unique identifier for a Site
product_id (str): Unique identifier for a Product
sku_id (str): Unique identifier for a SKU
sku (Sku): The SKU data to update.
publish_status (typing.Optional[PublishStatus]): Status for publishing the SKU.
request_options (typing.Optional[RequestOptions]): Request-specific configuration.
Usage Example:
from webflow import Sku, Webflow
client = Webflow(access_token="YOUR_ACCESS_TOKEN")
client.products.update_sku(
site_id="580e63e98c9a982ac9b8b741",
product_id="580e63fc8c9a982ac9b8b745",
sku_id="5e8518516e147040726cc415",
sku=Sku(),
)
```
--------------------------------
### Get Form Submission
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Get information about a given form submission. Requires 'forms:read' scope.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.forms.get_submission(
form_submission_id="580e63e98c9a982ac9b8b741",
)
```
--------------------------------
### List Components (Python)
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Retrieves a list of all components for a given site. This operation requires the 'components:read' scope and supports pagination with limit and offset parameters.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.components.list(
site_id="580e63e98c9a982ac9b8b741",
)
```
--------------------------------
### Create Asset Folder - Webflow Python
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Creates a new asset folder within a specified site. Requires `assets:write` scope.
```APIDOC
POST /sites/{site_id}/asset-folders
Description:
Create an Asset Folder within a given site.
Required scope: `assets:write`
Parameters:
site_id (str): Unique identifier for a Site.
request_options (Optional[RequestOptions]): Request-specific configuration.
```
--------------------------------
### Webflow Orders API Documentation
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Documentation for listing and retrieving orders from the Webflow API using the Python SDK. Includes parameters for filtering and pagination.
```APIDOC
client.orders.list(...)
Description:
List all orders created for a given site.
Required scope | `ecommerce:read`
Parameters:
site_id (str): Unique identifier for a Site
status (typing.Optional[OrdersListRequestStatus]): Filter the orders by status.
offset (typing.Optional[float]): Offset used for pagination if the results have more than limit records.
limit (typing.Optional[float]): Maximum number of records to be returned (max limit: 100).
request_options (typing.Optional[RequestOptions]): Request-specific configuration.
Usage Example:
from webflow import Webflow
client = Webflow(access_token="YOUR_ACCESS_TOKEN")
client.orders.list(site_id="580e63e98c9a982ac9b8b741")
client.orders.get(...)
Description:
Retrieve a single product by its ID. All of its SKUs will also be retrieved.
Required scope | `ecommerce:read`
Parameters:
(Parameters not fully provided in the input text for this method.)
```
--------------------------------
### Get Asset - Webflow Python
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Retrieves a specific asset by its unique identifier. Requires `assets:read` scope.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.assets.get(
asset_id="580e63fc8c9a982ac9b8b745",
)
```
```APIDOC
GET /sites/{site_id}/assets/{asset_id}
Description:
Get an Asset.
Required scope: `assets:read`
Parameters:
asset_id (str): Unique identifier for an Asset on a site.
request_options (Optional[RequestOptions]): Request-specific configuration.
```
--------------------------------
### Update Component Content using Webflow Python SDK
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Updates content within a component definition for secondary locales, supporting up to 1000 nodes per request. It's recommended to first use the 'get component content' endpoint to identify nodes and their types, and retrieve nested component instance properties using the 'get component properties' endpoint. This endpoint is specifically for localizing component definitions and requires a valid secondary locale ID.
```python
from webflow import (
ComponentInstanceNodePropertyOverridesWrite,
ComponentInstanceNodePropertyOverridesWritePropertyOverridesItem,
TextNodeWrite,
Webflow,
)
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.components.update_content(
site_id="580e63e98c9a982ac9b8b741",
component_id="8505ba55-ef72-629e-f85c-33e4b703d48b",
locale_id="65427cf400e02b306eaa04a0",
nodes=[
TextNodeWrite(
node_id="a245c12d-995b-55ee-5ec7-aa36a6cad623",
text="
The Hitchhiker's Guide to the Galaxy
",
),
TextNodeWrite(
node_id="a245c12d-995b-55ee-5ec7-aa36a6cad627",
text="Don't Panic!
Always know where your towel is.
",
),
ComponentInstanceNodePropertyOverridesWrite(
node_id="a245c12d-995b-55ee-5ec7-aa36a6cad629",
property_overrides=[
ComponentInstanceNodePropertyOverridesWritePropertyOverridesItem(
property_id="7dd14c08-2e96-8d3d-2b19-b5c03642a0f0",
text="Time is an illusion
",
),
ComponentInstanceNodePropertyOverridesWritePropertyOverridesItem(
property_id="7dd14c08-2e96-8d3d-2b19-b5c03642a0f1",
text="Life, the Universe and Everything",
),
],
),
],
)
```
--------------------------------
### Invite User to Webflow Site (Python)
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Creates and invites a new user to a Webflow site via email. The user receives an email to accept the invitation. Requires site ID, email, and optional access groups. Requires 'users:write' scope.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.users.invite(
site_id="580e63e98c9a982ac9b8b741",
email="some.one@home.com",
access_groups=["webflowers"],
)
```
--------------------------------
### Webflow Products API
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
API methods for managing products within a Webflow site. This includes creating new products with optional SKUs, retrieving existing products by ID, and updating product details. Each operation requires a site ID and may involve specific product or SKU data. The library handles pagination with offset and limit parameters, and allows for request-specific configurations.
```APIDOC
Products Resource:
Common Parameters:
site_id: str - Unique identifier for a Site.
offset: typing.Optional[float] - Offset used for pagination if the results have more than limit records.
limit: typing.Optional[float] - Maximum number of records to be returned (max limit: 100).
request_options: typing.Optional[RequestOptions] - Request-specific configuration.
Methods:
create(site_id: str, publish_status: typing.Optional[PublishStatus] = None, product: typing.Optional[Product] = None, sku: typing.Optional[Sku] = None, request_options: typing.Optional[RequestOptions] = None)
Description: Creates a new product and a default SKU. Supports creating products with multiple SKUs by defining product options and variants. The default product type is 'Advanced'. Requires 'ecommerce:write' scope.
Parameters:
site_id: Unique identifier for a Site.
publish_status: Optional status for the product.
product: Optional product data.
sku: Optional SKU data for the product.
request_options: Request-specific configuration.
Usage Example:
from webflow import Webflow
client = Webflow(access_token="YOUR_ACCESS_TOKEN")
client.products.create(site_id="580e63e98c9a982ac9b8b741")
get(site_id: str, product_id: str, request_options: typing.Optional[RequestOptions] = None)
Description: Retrieves a single product by its ID, including all associated SKUs. Requires 'ecommerce:read' scope.
Parameters:
site_id: Unique identifier for a Site.
product_id: Unique identifier for a Product.
request_options: Request-specific configuration.
Usage Example:
from webflow import Webflow
client = Webflow(access_token="YOUR_ACCESS_TOKEN")
client.products.get(site_id="580e63e98c9a982ac9b8b741", product_id="580e63fc8c9a982ac9b8b745")
update(site_id: str, product_id: str, request_options: typing.Optional[RequestOptions] = None)
Description: Updates an existing Product. Setting the product type to 'Advanced' ensures all fields are visible in the Designer. Requires 'ecommerce:write' scope.
Parameters:
site_id: Unique identifier for a Site.
product_id: Unique identifier for a Product.
request_options: Request-specific configuration.
Usage Example:
from webflow import Webflow
client = Webflow(access_token="YOUR_ACCESS_TOKEN")
client.products.update(site_id="580e63e98c9a982ac9b8b741", product_id="580e63fc8c9a982ac9b8b745")
```
--------------------------------
### Fulfill Webflow Order
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Code snippet for marking a Webflow order as fulfilled. This example shows how to call the update_fulfill method, with an option to trigger a customer notification email.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.orders.update_fulfill(
site_id="580e63e98c9a982ac9b8b741",
order_id="5e8518516e147040726cc415",
send_order_fulfilled_email=True
)
```
--------------------------------
### Webflow Site Management API
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Provides documentation for managing sites within the Webflow platform using the webflow-python library. Includes operations for updating sites, retrieving custom domains, and publishing sites. Requires specific scopes for write and read operations.
```APIDOC
Webflow Site Management:
Update Site:
Updates a site. This endpoint requires an Enterprise workspace.
Required scope: sites:write
Signature: client.sites.update(site_id: str, name: Optional[str] = None, parent_folder_id: Optional[str] = None, request_options: Optional[RequestOptions] = None)
Parameters:
- site_id (str): Unique identifier for a Site.
- name (Optional[str]): The name of the site.
- parent_folder_id (Optional[str]): The parent folder ID of the site.
- request_options (Optional[RequestOptions]): Request-specific configuration.
Example:
client.sites.update(site_id="580e63e98c9a982ac9b8b741")
Get Custom Domains:
Retrieves a list of all custom domains related to a site.
Required scope: sites:read
Signature: client.sites.get_custom_domain(site_id: str, request_options: Optional[RequestOptions] = None)
Parameters:
- site_id (str): Unique identifier for a Site.
- request_options (Optional[RequestOptions]): Request-specific configuration.
Example:
client.sites.get_custom_domain(site_id="580e63e98c9a982ac9b8b741")
Publish Site:
Publishes a site to one or more domains. This endpoint has a limit of one successful publish queue per minute.
Required scope: sites:write
Signature: client.sites.publish(site_id: str, custom_domains: Optional[Sequence[str]] = None, publish_to_webflow_subdomain: Optional[bool] = None, request_options: Optional[RequestOptions] = None)
Parameters:
- site_id (str): Unique identifier for a Site.
- custom_domains (Optional[Sequence[str]]): Array of Custom Domain IDs to publish.
- publish_to_webflow_subdomain (Optional[bool]): Choice of whether to publish to the default Webflow Subdomain.
- request_options (Optional[RequestOptions]): Request-specific configuration.
Example:
client.sites.publish(site_id="580e63e98c9a982ac9b8b741")
```
--------------------------------
### Webflow Assets API
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Provides methods for managing asset folders within a Webflow site, including creating and retrieving folder details. Requires appropriate site read/write permissions.
```APIDOC
Webflow Assets API:
create_folder(site_id: str, display_name: str, parent_folder: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None)
- Creates a new folder for organizing assets within a Webflow site.
- Parameters:
- site_id (str): Unique identifier for a Site.
- display_name (str): A human readable name for the Asset Folder.
- parent_folder (typing.Optional[str]): An optional pointer to a parent Asset Folder (or null for root).
- request_options (typing.Optional[RequestOptions]): Request-specific configuration.
- Usage Example:
```python
from webflow import Webflow
client = Webflow(access_token="YOUR_ACCESS_TOKEN")
client.assets.create_folder(
site_id="580e63e98c9a982ac9b8b741",
display_name="my asset folder",
)
```
get_folder(asset_folder_id: str, request_options: typing.Optional[RequestOptions] = None)
- Retrieves details about a specific Asset Folder.
- Required scope: `assets:read`
- Parameters:
- asset_folder_id (str): Unique identifier for an Asset Folder.
- request_options (typing.Optional[RequestOptions]): Request-specific configuration.
- Usage Example:
```python
from webflow import Webflow
client = Webflow(access_token="YOUR_ACCESS_TOKEN")
client.assets.get_folder(
asset_folder_id="6390c49774a71f0e3c1a08ee",
)
```
```
--------------------------------
### Get Webflow Collection Details (Python)
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Retrieves full details of a Webflow collection using its unique ID. Requires 'cms:read' scope. Takes collection_id and optional request_options.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.collections.get(
collection_id="580e63fc8c9a982ac9b8b745",
)
```
--------------------------------
### Webflow Sites Plans API
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
API documentation for retrieving site plan details for a specified Webflow site. This endpoint provides information about the current plan associated with a given site. Requires 'sites:read' scope.
```APIDOC
client.sites.plans.get_site_plan(site_id: str, request_options: typing.Optional[RequestOptions] = None)
- Retrieves site plan details for the specified Site.
- Parameters:
- site_id: Unique identifier for a Site.
- request_options: Request-specific configuration.
- Required scope: sites:read
```
--------------------------------
### Get Custom Code for Webflow Site
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Retrieves all registered scripts applied to a specific Webflow site. Access requires a bearer token from a Data Client App with the 'custom_code:read' scope.
```APIDOC
GET /sites/{site_id}/scripts
Description:
Get all registered scripts that have been applied to a specific Site.
Authentication:
Bearer token from a Data Client App.
Required Scope:
custom_code:read
Parameters:
site_id (str): Unique identifier for the Site.
request_options (RequestOptions, optional): Request-specific configuration.
Returns:
A list of applied custom scripts for the site.
```
```Python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.sites.scripts.get_custom_code(
site_id="580e63e98c9a982ac9b8b741",
)
```
--------------------------------
### Create Items in Webflow Collection (Python)
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Demonstrates how to create one or multiple items within a specified Webflow CMS Collection. It shows how to pass collection ID, locale IDs, draft/archive status, and item field data.
```python
from webflow import Webflow
from webflow.resources.collections.resources.items import SingleCmsItem
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.collections.items.create_items(
collection_id="580e63fc8c9a982ac9b8b745",
cms_locale_ids=[
"66f6e966c9e1dc700a857ca3",
"66f6e966c9e1dc700a857ca4",
"66f6e966c9e1dc700a857ca5",
],
is_archived=False,
is_draft=False,
field_data=SingleCmsItem(
name="Don’t Panic",
slug="dont-panic",
),
)
```
--------------------------------
### Get Component Properties - Webflow Python
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Retrieves default property values for a component definition. If no Locale ID is provided, properties from the Primary locale are returned. Requires the `components:read` scope.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.components.get_properties(
site_id="580e63e98c9a982ac9b8b741",
component_id="8505ba55-ef72-629e-f85c-33e4b703d48b",
locale_id="65427cf400e02b306eaa04a0",
)
```
--------------------------------
### List Asset Folders - Webflow Python
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Lists all asset folders within a specified site. Requires `assets:read` scope.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.assets.list_folders(
site_id="580e63e98c9a982ac9b8b741",
)
```
```APIDOC
GET /sites/{site_id}/asset-folders
Description:
List Asset Folders within a given site.
Required scope: `assets:read`
Parameters:
site_id (str): Unique identifier for a Site.
request_options (Optional[RequestOptions]): Request-specific configuration.
```
--------------------------------
### Webflow API - Components Endpoints
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Endpoints for managing components within a Webflow site. Includes functionality to list all components.
```APIDOC
client.components.list(site_id: str, limit: typing.Optional[float] = None, offset: typing.Optional[float] = None, request_options: typing.Optional[RequestOptions] = None)
List of all components for a site.
Requires 'components:read' scope.
Parameters:
site_id: Unique identifier for a Site.
limit: Maximum number of records to be returned (max limit: 100).
offset: Offset used for pagination.
request_options: Request-specific configuration.
```
--------------------------------
### Get Webflow Page Metadata (Python)
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Retrieves metadata information for a single Webflow page, supporting locale filtering. Requires 'pages:read' scope. Takes page_id, optional locale_id, and request_options.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.pages.get_metadata(
page_id="63c720f9347c2139b248e552",
locale_id="65427cf400e02b306eaa04a0",
)
```
--------------------------------
### Webflow Users: Get User by ID
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Fetches a specific user by their unique identifier within a given site. This operation requires the 'users:read' scope and takes the site ID and user ID as parameters.
```APIDOC
client.users.get(site_id: str, user_id: str, request_options: typing.Optional[RequestOptions] = None)
- Get a User by ID.
- Required scope: `users:read`
- Parameters:
- site_id: `str` — Unique identifier for a Site.
- user_id: `str` — Unique identifier for a User.
- request_options: `typing.Optional[RequestOptions]` — Request-specific configuration.
```
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.users.get(
site_id="580e63e98c9a982ac9b8b741",
user_id="580e63e98c9a982ac9b8b741",
)
```
--------------------------------
### Webflow Collection Management API
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Provides documentation for managing collections within a Webflow site using the webflow-python library. Includes operations for listing all collections and creating new collections. Requires specific scopes for read and write operations.
```APIDOC
Webflow Collection Management:
List Collections:
Lists all Collections within a Site.
Required scope: cms:read
Signature: client.collections.list(site_id: str, request_options: Optional[RequestOptions] = None)
Parameters:
- site_id (str): Unique identifier for a Site.
- request_options (Optional[RequestOptions]): Request-specific configuration.
Example:
client.collections.list(site_id="580e63e98c9a982ac9b8b741")
Create Collection:
Creates a Collection for a site.
Required scope: cms:write
Signature: client.collections.create(site_id: str, display_name: str, singular_name: str, slug: Optional[str] = None, request_options: Optional[RequestOptions] = None)
Parameters:
- site_id (str): Unique identifier for a Site.
- display_name (str): Name of the collection. Each collection name must be distinct.
- singular_name (str): Singular name of each item.
- slug (Optional[str]): Part of a URL that identifies the collection.
- request_options (Optional[RequestOptions]): Request-specific configuration.
Example:
client.collections.create(site_id="580e63e98c9a982ac9b8b741", display_name="Blog Posts", singular_name="Blog Post", slug="posts")
```
--------------------------------
### Webflow API: List Custom Code Blocks Parameters
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Details the parameters available for the `list_custom_code_blocks` API method. This includes required identifiers and optional parameters for pagination and request configuration.
```APIDOC
client.sites.scripts.list_custom_code_blocks(site_id, offset=None, limit=None, request_options=None)
Parameters:
site_id: str - Unique identifier for a Site.
offset: typing.Optional[float] - Offset used for pagination if the results have more than limit records.
limit: typing.Optional[float] - Maximum number of records to be returned (max limit: 100).
request_options: typing.Optional[RequestOptions] - Request-specific configuration.
```
--------------------------------
### Create Live Collection Item (Python)
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Demonstrates how to create new items in a Webflow collection. This operation requires a valid access token and collection ID. It allows for creating multiple items with specified field data, such as name and slug.
```python
from webflow import CollectionItem, CollectionItemFieldData, Webflow
from webflow.resources.collections.resources.items import MultipleLiveItems
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.collections.items.create_item_live(
collection_id="580e63fc8c9a982ac9b8b745",
request=MultipleLiveItems(
items=[
CollectionItem(
is_archived=False,
is_draft=False,
field_data=CollectionItemFieldData(
name="Senior Data Analyst",
slug="senior-data-analyst",
),
),
CollectionItem(
is_archived=False,
is_draft=False,
field_data=CollectionItemFieldData(
name="Product Manager",
slug="product-manager",
),
),
],
),
)
```
--------------------------------
### Site Management Operations
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Enables the creation, listing, retrieval, update, and deletion of sites within a Webflow workspace. Some operations require an Enterprise workspace and specific write scopes.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
# Create a site
client.sites.create(
workspace_id="580e63e98c9a982ac9b8b741",
name="The Hitchhiker's Guide to the Galaxy",
template_name="MyTemplate"
)
# List all sites
client.sites.list()
# Get site details
client.sites.get(
site_id="580e63e98c9a982ac9b8b741",
)
# Delete a site
client.sites.delete(
site_id="580e63e98c9a982ac9b8b741",
)
# Update a site (example signature, full details not provided in source)
# client.sites.update(site_id="...", name="New Site Name")
```
```APIDOC
client.sites.create(workspace_id: str, name: str, template_name: typing.Optional[str] = None, parent_folder_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None)
- Description: Create a site. This endpoint requires an Enterprise workspace.
- Required Scope: workspace:write
- Parameters:
- workspace_id: str — Unique identifier for a Workspace.
- name: str — The name of the site.
- template_name: typing.Optional[str] — The workspace or marketplace template to use.
- parent_folder_id: typing.Optional[str] — Identifier for a parent folder.
- request_options: typing.Optional[RequestOptions] — Request-specific configuration.
client.sites.list(request_options: typing.Optional[RequestOptions] = None)
- Description: List of all sites the provided access token is able to access.
- Required Scope: sites:read
- Parameters:
- request_options: typing.Optional[RequestOptions] — Request-specific configuration.
client.sites.get(site_id: str, request_options: typing.Optional[RequestOptions] = None)
- Description: Get details of a site.
- Required Scope: sites:read
- Parameters:
- site_id: str — Unique identifier for a Site.
- request_options: typing.Optional[RequestOptions] — Request-specific configuration.
client.sites.delete(site_id: str, request_options: typing.Optional[RequestOptions] = None)
- Description: Delete a site. This endpoint requires an Enterprise workspace.
- Required Scope: sites:write
- Parameters:
- site_id: str — Unique identifier for a Site.
- request_options: typing.Optional[RequestOptions] — Request-specific configuration.
client.sites.update(site_id: str, name: str, request_options: typing.Optional[RequestOptions] = None)
- Description: Update details of a site. (Signature inferred, full details not provided in source).
- Required Scope: sites:write
- Parameters:
- site_id: str — Unique identifier for a Site.
- name: str — The new name for the site.
- request_options: typing.Optional[RequestOptions] — Request-specific configuration.
```
--------------------------------
### Delete Live Collection Items (Python)
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Provides an example for removing items from a live Webflow site. This method can delete multiple items (up to 100) by their IDs. Deleting published items will unpublish them and set them to draft. If `cmsLocaleId` is not specified for localized items, only the primary locale will be affected.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.collections.items.delete_items_live(
collection_id="580e63fc8c9a982ac9b8b745",
)
```
--------------------------------
### Create Asset Entry - Webflow Python
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Creates a new asset entry in Webflow. This endpoint returns `uploadUrl` and `uploadDetails` which can be used to upload the file to Amazon S3. Requires `assets:write` scope.
```python
from webflow import Webflow
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.assets.create(
site_id="580e63e98c9a982ac9b8b741",
file_name="file.png",
file_hash="3c7d87c9575702bc3b1e991f4d3c638e",
)
```
```APIDOC
POST /sites/{site_id}/assets
Description:
Create a new asset entry.
This endpoint generates a response with `uploadUrl` and `uploadDetails`.
These properties can be used to upload the file to Amazon S3 by making a POST request to the `uploadUrl` with the `uploadDetails` object as header information.
Required scope: `assets:write`
Parameters:
site_id (str): Unique identifier for a Site.
file_name (str): File name including file extension. Must be less than 100 characters.
file_hash (str): MD5 hash of the file.
parent_folder (Optional[str]): ID of the Asset folder (optional).
request_options (Optional[RequestOptions]): Request-specific configuration.
```
--------------------------------
### Update Static Page Content (Python)
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Updates content on a static page in secondary locales. This endpoint supports updating up to 1000 nodes per request and requires the 'pages:write' scope. It is recommended to first retrieve content nodes using the get page content endpoint.
```python
from webflow import (
ComponentInstanceNodePropertyOverridesWrite,
ComponentInstanceNodePropertyOverridesWritePropertyOverridesItem,
TextNodeWrite,
Webflow,
)
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.pages.update_static_content(
page_id="63c720f9347c2139b248e552",
locale_id="localeId",
nodes=[
TextNodeWrite(
node_id="a245c12d-995b-55ee-5ec7-aa36a6cad623",
text="The Hitchhiker's Guide to the Galaxy
",
),
TextNodeWrite(
node_id="a245c12d-995b-55ee-5ec7-aa36a6cad627",
text="Don't Panic!
Always know where your towel is.
",
),
ComponentInstanceNodePropertyOverridesWrite(
node_id="a245c12d-995b-55ee-5ec7-aa36a6cad629",
property_overrides=[
ComponentInstanceNodePropertyOverridesWritePropertyOverridesItem(
property_id="7dd14c08-2e96-8d3d-2b19-b5c03642a0f0",
text="Time is an illusion
",
),
ComponentInstanceNodePropertyOverridesWritePropertyOverridesItem(
property_id="7dd14c08-2e96-8d3d-2b19-b5c03642a0f1",
text="Life, the Universe and Everything",
),
],
),
],
)
```
--------------------------------
### Webflow API - Pages and Components Parameters
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Common parameters used across various Webflow API endpoints for managing pages and components. These include identifiers, pagination controls, and request options.
```APIDOC
Parameters:
- page_id: `str`
Unique identifier for a Page.
- locale_id: `str` | `typing.Optional[str]`
Unique identifier for a specific locale. Applicable when using localization. For `update_static_content`, this must be a secondary locale.
- limit: `typing.Optional[float]`
Maximum number of records to be returned. Maximum limit is 100.
- offset: `typing.Optional[float]`
Offset used for pagination if the results have more than 'limit' records.
- request_options: `typing.Optional[RequestOptions]`
Request-specific configuration.
- site_id: `str`
Unique identifier for a Site.
```
--------------------------------
### Update Component Properties - Webflow Python
Source: https://github.com/webflow/webflow-python/blob/main/reference.md
Updates the default property values of a component definition in a specified locale. It's recommended to first use the 'get component properties' endpoint to identify available properties. The request requires a secondary locale ID; missing locale IDs will result in an error. Requires the `components:write` scope.
```python
from webflow import Webflow
from webflow.resources.components import ComponentPropertiesWritePropertiesItem
client = Webflow(
access_token="YOUR_ACCESS_TOKEN",
)
client.components.update_properties(
site_id="580e63e98c9a982ac9b8b741",
component_id="8505ba55-ef72-629e-f85c-33e4b703d48b",
locale_id="65427cf400e02b306eaa04a0",
properties=[
ComponentPropertiesWritePropertiesItem(
property_id="a245c12d-995b-55ee-5ec7-aa36a6cad623",
text="The Hitchhiker’s Guide to the Galaxy",
),
ComponentPropertiesWritePropertiesItem(
property_id="a245c12d-995b-55ee-5ec7-aa36a6cad627",
text="Dont Panic!
Always know where your towel is.
",
),
],
)
```