To upload a media file using the Webflow API key with CURL, you need to follow a few steps to ensure it’s done correctly.
1. Generate Webflow API Key
- Log into your Webflow account and navigate to your project.
- Go to Project Settings.
- Select the Integrations tab.
- Generate a new API token under the API Access section.
2. Identify Your Site ID
- In the Webflow Dashboard, find your site.
- Select the site you want to upload assets to.
- Locate the Site ID unique to that particular project, usually found within the project settings or URL.
3. Prepare Your CURL Command
- Use the bash terminal or command line tool to prepare your CURL command.
- Ensure you have the correct URL format:
https://api.webflow.com/sites/{site_id}/assets. - Replace
{site_id} with your actual site ID. - Your CURL command should follow this structure (ensure to replace placeholders with actual values):
```
curl -X POST "https://api.webflow.com/sites/{site_id}/assets" \
-H "Authorization: Bearer {yourapikey}" \
-H "Content-Type: multipart/form-data" \
-F "file=@/path/to/your/file.jpg"
```
- Ensure
{yourapikey} is replaced with the actual API key obtained earlier. - Replace
/path/to/your/file.jpg with the actual path to your file.
4. Execute the CURL Command
- Run the command in your terminal.
- Check for responses to confirm success or capture any error messages.
Summary
To upload a media file to the assets folder using Webflow's API, generate an API key, identify your site ID, and use a properly structured CURL command. Always replace placeholders with real values based on your project configuration.